X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=8076e251b85ed9039859d20a1df09320007a610e;hb=4894d52d30399c21b7994952a8de0d1d7848c58d;hp=4a1e2255d0688321dee1d69459a50511488c3b96;hpb=e4b516dd8a62166c206e7aa5363a0c07add1d3a9;p=rust-lightning diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 4a1e2255..8076e251 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -7,7 +7,7 @@ #include #include #include -#include + /** * An error when accessing the chain via [`Access`]. @@ -174,8 +174,8 @@ typedef enum LDKSecp256k1Error { LDKSecp256k1Error_InvalidSecretKey, LDKSecp256k1Error_InvalidRecoveryId, LDKSecp256k1Error_InvalidTweak, + LDKSecp256k1Error_TweakCheckFailed, LDKSecp256k1Error_NotEnoughMemory, - LDKSecp256k1Error_CallbackPanicked, /** * Must be last for serialization purposes */ @@ -206,174 +206,264 @@ typedef struct LDKTransaction { bool data_is_owned; } LDKTransaction; -typedef struct LDKCVecTempl_u8 { +typedef struct LDKCVec_u8Z { uint8_t *data; uintptr_t datalen; -} LDKCVecTempl_u8; - -typedef struct LDKCVecTempl_u8 LDKCVec_u8Z; +} LDKCVec_u8Z; /** * A transaction output including a scriptPubKey and value. * This type *does* own its own memory, so must be free'd appropriately. */ typedef struct LDKTxOut { - LDKCVec_u8Z script_pubkey; + struct LDKCVec_u8Z script_pubkey; uint64_t value; } LDKTxOut; -typedef struct LDKC2TupleTempl_usize__Transaction { - uintptr_t a; - struct LDKTransaction b; -} LDKC2TupleTempl_usize__Transaction; +typedef struct LDKSecretKey { + uint8_t bytes[32]; +} LDKSecretKey; + +typedef union LDKCResult_SecretKeyErrorZPtr { + struct LDKSecretKey *result; + enum LDKSecp256k1Error *err; +} LDKCResult_SecretKeyErrorZPtr; -typedef struct LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ; +typedef struct LDKCResult_SecretKeyErrorZ { + union LDKCResult_SecretKeyErrorZPtr contents; + bool result_ok; +} LDKCResult_SecretKeyErrorZ; -typedef union LDKCResultPtr_u8__ChannelMonitorUpdateErr { - uint8_t *result; - enum LDKChannelMonitorUpdateErr *err; -} LDKCResultPtr_u8__ChannelMonitorUpdateErr; +typedef struct LDKPublicKey { + uint8_t compressed_form[33]; +} LDKPublicKey; + +typedef union LDKCResult_PublicKeyErrorZPtr { + struct LDKPublicKey *result; + enum LDKSecp256k1Error *err; +} LDKCResult_PublicKeyErrorZPtr; -typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr { - union LDKCResultPtr_u8__ChannelMonitorUpdateErr contents; +typedef struct LDKCResult_PublicKeyErrorZ { + union LDKCResult_PublicKeyErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__ChannelMonitorUpdateErr; +} LDKCResult_PublicKeyErrorZ; + + -typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ; +/** + * The set of public keys which are used in the creation of one commitment transaction. + * These are derived from the channel base keys and per-commitment data. + * + * A broadcaster key is provided from potential broadcaster of the computed transaction. + * A countersignatory key is coming from a protocol participant unable to broadcast the + * transaction. + * + * These keys are assumed to be good, either because the code derived them from + * channel basepoints via the new function, or they were obtained via + * CommitmentTransaction.trust().keys() because we trusted the source of the + * pre-calculated keys. + */ +typedef struct MUST_USE_STRUCT LDKTxCreationKeys { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeTxCreationKeys *inner; + bool is_owned; +} LDKTxCreationKeys; /** - * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is - * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this - * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was - * corrupted. - * Contains a developer-readable error message. + * An error in decoding a message or struct. */ -typedef struct MUST_USE_STRUCT LDKMonitorUpdateError { +typedef struct MUST_USE_STRUCT LDKDecodeError { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMonitorUpdateError *inner; + LDKnativeDecodeError *inner; bool is_owned; -} LDKMonitorUpdateError; +} LDKDecodeError; -typedef union LDKCResultPtr_u8__MonitorUpdateError { - uint8_t *result; - struct LDKMonitorUpdateError *err; -} LDKCResultPtr_u8__MonitorUpdateError; +typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr { + struct LDKTxCreationKeys *result; + struct LDKDecodeError *err; +} LDKCResult_TxCreationKeysDecodeErrorZPtr; -typedef struct LDKCResultTempl_u8__MonitorUpdateError { - union LDKCResultPtr_u8__MonitorUpdateError contents; +typedef struct LDKCResult_TxCreationKeysDecodeErrorZ { + union LDKCResult_TxCreationKeysDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__MonitorUpdateError; - -typedef struct LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ; +} LDKCResult_TxCreationKeysDecodeErrorZ; /** - * A reference to a transaction output. - * - * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32 - * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way. + * One counterparty's public keys which do not change over the life of a channel. */ -typedef struct MUST_USE_STRUCT LDKOutPoint { +typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeOutPoint *inner; + LDKnativeChannelPublicKeys *inner; bool is_owned; -} LDKOutPoint; +} LDKChannelPublicKeys; -typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z { - struct LDKOutPoint a; - LDKCVec_u8Z b; -} LDKC2TupleTempl_OutPoint__CVec_u8Z; +typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr { + struct LDKChannelPublicKeys *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelPublicKeysDecodeErrorZPtr; -typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ; +typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ { + union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelPublicKeysDecodeErrorZ; + +typedef union LDKCResult_TxCreationKeysErrorZPtr { + struct LDKTxCreationKeys *result; + enum LDKSecp256k1Error *err; +} LDKCResult_TxCreationKeysErrorZPtr; + +typedef struct LDKCResult_TxCreationKeysErrorZ { + union LDKCResult_TxCreationKeysErrorZPtr contents; + bool result_ok; +} LDKCResult_TxCreationKeysErrorZ; -typedef struct LDKC2TupleTempl_u32__TxOut { - uint32_t a; - struct LDKTxOut b; -} LDKC2TupleTempl_u32__TxOut; -typedef struct LDKC2TupleTempl_u32__TxOut LDKC2Tuple_u32TxOutZ; /** - * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to - * look up the corresponding function in rust-lightning's docs. + * Information about an HTLC as it appears in a commitment transaction */ -typedef struct LDKThirtyTwoBytes { - uint8_t data[32]; -} LDKThirtyTwoBytes; +typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeHTLCOutputInCommitment *inner; + bool is_owned; +} LDKHTLCOutputInCommitment; -typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut { - struct LDKC2TupleTempl_u32__TxOut *data; - uintptr_t datalen; -} LDKCVecTempl_C2TupleTempl_u32__TxOut; +typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr { + struct LDKHTLCOutputInCommitment *result; + struct LDKDecodeError *err; +} LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr; -typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut { - struct LDKThirtyTwoBytes a; - struct LDKCVecTempl_C2TupleTempl_u32__TxOut b; -} LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut; +typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ { + union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_HTLCOutputInCommitmentDecodeErrorZ; -typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; -typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_u32TxOutZZ; -typedef struct LDKPublicKey { - uint8_t compressed_form[33]; -} LDKPublicKey; +/** + * Late-bound per-channel counterparty data used to build transactions. + */ +typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeCounterpartyChannelTransactionParameters *inner; + bool is_owned; +} LDKCounterpartyChannelTransactionParameters; + +typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { + struct LDKCounterpartyChannelTransactionParameters *result; + struct LDKDecodeError *err; +} LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr; + +typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ; /** - * One counterparty's public keys which do not change over the life of a channel. + * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction). + * The fields are organized by holder/counterparty. + * + * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters + * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions. */ -typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { +typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelPublicKeys *inner; + LDKnativeChannelTransactionParameters *inner; bool is_owned; -} LDKChannelPublicKeys; +} LDKChannelTransactionParameters; -typedef struct LDKC2TupleTempl_u64__u64 { - uint64_t a; - uint64_t b; -} LDKC2TupleTempl_u64__u64; +typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr { + struct LDKChannelTransactionParameters *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelTransactionParametersDecodeErrorZPtr; -typedef struct LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z; +typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ { + union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelTransactionParametersDecodeErrorZ; typedef struct LDKSignature { uint8_t compact_form[64]; } LDKSignature; -typedef struct LDKCVecTempl_Signature { +typedef struct LDKCVec_SignatureZ { struct LDKSignature *data; uintptr_t datalen; -} LDKCVecTempl_Signature; +} LDKCVec_SignatureZ; -typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature { - struct LDKSignature a; - struct LDKCVecTempl_Signature b; -} LDKC2TupleTempl_Signature__CVecTempl_Signature; -typedef union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 { - struct LDKC2TupleTempl_Signature__CVecTempl_Signature *result; - uint8_t *err; -} LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8; -typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 { - union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 contents; +/** + * Information needed to build and sign a holder's commitment transaction. + * + * The transaction is only signed once we are ready to broadcast. + */ +typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeHolderCommitmentTransaction *inner; + bool is_owned; +} LDKHolderCommitmentTransaction; + +typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr { + struct LDKHolderCommitmentTransaction *result; + struct LDKDecodeError *err; +} LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr; + +typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ { + union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8; +} LDKCResult_HolderCommitmentTransactionDecodeErrorZ; + + + +/** + * A pre-built Bitcoin commitment transaction and its txid. + */ +typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBuiltCommitmentTransaction *inner; + bool is_owned; +} LDKBuiltCommitmentTransaction; -typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; +typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr { + struct LDKBuiltCommitmentTransaction *result; + struct LDKDecodeError *err; +} LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr; + +typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ { + union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_BuiltCommitmentTransactionDecodeErrorZ; @@ -394,2138 +484,3138 @@ typedef struct MUST_USE_STRUCT LDKCommitmentTransaction { bool is_owned; } LDKCommitmentTransaction; +typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr { + struct LDKCommitmentTransaction *result; + struct LDKDecodeError *err; +} LDKCResult_CommitmentTransactionDecodeErrorZPtr; + +typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ { + union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_CommitmentTransactionDecodeErrorZ; + /** - * Information needed to build and sign a holder's commitment transaction. + * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin + * transaction and the transaction creation keys) are trusted. * - * The transaction is only signed once we are ready to broadcast. + * See trust() and verify() functions on CommitmentTransaction. + * + * This structure implements Deref. */ -typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction { +typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeHolderCommitmentTransaction *inner; + LDKnativeTrustedCommitmentTransaction *inner; bool is_owned; -} LDKHolderCommitmentTransaction; +} LDKTrustedCommitmentTransaction; -typedef union LDKCResultPtr_Signature__u8 { - struct LDKSignature *result; - uint8_t *err; -} LDKCResultPtr_Signature__u8; +typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr { + struct LDKTrustedCommitmentTransaction *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_TrustedCommitmentTransactionNoneZPtr; + +typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ { + union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents; + bool result_ok; +} LDKCResult_TrustedCommitmentTransactionNoneZ; + +typedef union LDKCResult_CVec_SignatureZNoneZPtr { + struct LDKCVec_SignatureZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_SignatureZNoneZPtr; -typedef struct LDKCResultTempl_Signature__u8 { - union LDKCResultPtr_Signature__u8 contents; +typedef struct LDKCResult_CVec_SignatureZNoneZ { + union LDKCResult_CVec_SignatureZNoneZPtr contents; bool result_ok; -} LDKCResultTempl_Signature__u8; +} LDKCResult_CVec_SignatureZNoneZ; -typedef struct LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ; +typedef struct LDKCVec_PublicKeyZ { + struct LDKPublicKey *data; + uintptr_t datalen; +} LDKCVec_PublicKeyZ; /** - * Information about an HTLC as it appears in a commitment transaction + * Error for PeerManager errors. If you get one of these, you must disconnect the socket and + * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the + * descriptor. */ -typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment { +typedef struct MUST_USE_STRUCT LDKPeerHandleError { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeHTLCOutputInCommitment *inner; + LDKnativePeerHandleError *inner; bool is_owned; -} LDKHTLCOutputInCommitment; +} LDKPeerHandleError; + +typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { + struct LDKCVec_u8Z *result; + struct LDKPeerHandleError *err; +} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; + +typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ { + union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; + bool result_ok; +} LDKCResult_CVec_u8ZPeerHandleErrorZ; + +typedef union LDKCResult_NonePeerHandleErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + struct LDKPeerHandleError *err; +} LDKCResult_NonePeerHandleErrorZPtr; + +typedef struct LDKCResult_NonePeerHandleErrorZ { + union LDKCResult_NonePeerHandleErrorZPtr contents; + bool result_ok; +} LDKCResult_NonePeerHandleErrorZ; + +typedef union LDKCResult_boolPeerHandleErrorZPtr { + bool *result; + struct LDKPeerHandleError *err; +} LDKCResult_boolPeerHandleErrorZPtr; + +typedef struct LDKCResult_boolPeerHandleErrorZ { + union LDKCResult_boolPeerHandleErrorZPtr contents; + bool result_ok; +} LDKCResult_boolPeerHandleErrorZ; /** - * The unsigned part of a channel_announcement + * Features used within an `init` message. */ -typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { +typedef struct MUST_USE_STRUCT LDKInitFeatures { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUnsignedChannelAnnouncement *inner; + LDKnativeInitFeatures *inner; bool is_owned; -} LDKUnsignedChannelAnnouncement; +} LDKInitFeatures; + +typedef union LDKCResult_InitFeaturesDecodeErrorZPtr { + struct LDKInitFeatures *result; + struct LDKDecodeError *err; +} LDKCResult_InitFeaturesDecodeErrorZPtr; + +typedef struct LDKCResult_InitFeaturesDecodeErrorZ { + union LDKCResult_InitFeaturesDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_InitFeaturesDecodeErrorZ; /** - * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction). - * The fields are organized by holder/counterparty. - * - * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters - * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions. + * Features used within a `node_announcement` message. */ -typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters { +typedef struct MUST_USE_STRUCT LDKNodeFeatures { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelTransactionParameters *inner; + LDKnativeNodeFeatures *inner; bool is_owned; -} LDKChannelTransactionParameters; +} LDKNodeFeatures; + +typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr { + struct LDKNodeFeatures *result; + struct LDKDecodeError *err; +} LDKCResult_NodeFeaturesDecodeErrorZPtr; + +typedef struct LDKCResult_NodeFeaturesDecodeErrorZ { + union LDKCResult_NodeFeaturesDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_NodeFeaturesDecodeErrorZ; + + /** - * Set of lightning keys needed to operate a channel as described in BOLT 3. - * - * Signing services could be implemented on a hardware wallet. In this case, - * the current ChannelKeys would be a front-end on top of a communication - * channel connected to your secure device and lightning key material wouldn't - * reside on a hot server. Nevertheless, a this deployment would still need - * to trust the ChannelManager to avoid loss of funds as this latest component - * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys. - * - * A more secure iteration would be to use hashlock (or payment points) to pair - * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager - * at the price of more state and computation on the hardware wallet side. In the future, - * we are looking forward to design such interface. - * - * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted - * to act, as liveness and breach reply correctness are always going to be hard requirements - * of LN security model, orthogonal of key management issues. - * - * If you're implementing a custom signer, you almost certainly want to implement - * Readable/Writable to serialize out a unique reference to this set of keys so - * that you can serialize the full ChannelManager object. - * - */ -typedef struct LDKChannelKeys { - void *this_arg; - /** - * Gets the per-commitment point for a specific commitment number - * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. - */ - struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); - /** - * Gets the commitment secret for a specific commitment number as part of the revocation process - * - * An external signer implementation should error here if the commitment was already signed - * and should refuse to sign it in the future. - * - * May be called more than once for the same index. - * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. - * TODO: return a Result so we can signal a validation error - */ - struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); - /** - * Gets the holder's channel public keys and basepoints - */ - struct LDKChannelPublicKeys pubkeys; - /** - * Fill in the pubkeys field as a reference to it will be given to Rust after this returns - * Note that this takes a pointer to this object, not the this_ptr like other methods do - * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. - */ - void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR ); - /** - * Gets arbitrary identifiers describing the set of keys which are provided back to you in - * some SpendableOutputDescriptor types. These should be sufficient to identify this - * ChannelKeys object uniquely and lookup or re-derive its keys. - */ - LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg); - /** - * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. - * - * Note that if signing fails or is rejected, the channel will be force-closed. - */ - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx); - /** - * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. - * This will only ever be called with a non-revoked commitment_tx. This will be called with the - * latest commitment_tx when we initiate a force-close. - * This will be called with the previous latest, just to get claiming HTLC signatures, if we are - * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to - * the latest. - * This may be called multiple times for the same transaction. - * - * An external signer implementation should check that the commitment has not been revoked. - * - * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case. - */ - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); - /** - * Create a signature for the given input in a transaction spending an HTLC or commitment - * transaction output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiples outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiples time for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * per_commitment_key is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder revocation_secret to do - * so). - * - * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus - * changing the format of the witness script (which is committed to in the BIP 143 - * signatures). - */ - LDKCResult_SignatureNoneZ (*sign_justice_transaction)(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); - /** - * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment - * transaction, either offered or received. - * - * Such a transaction may claim multiples offered outputs at same time if we know the - * preimage for each when we create it, but only the input at index `input` should be - * signed for here. It may be called multiple times for same output(s) if a fee-bump is - * needed with regards to an upcoming timelock expiration. - * - * Witness_script is either a offered or received script as defined in BOLT3 for HTLC - * outputs. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * Per_commitment_point is the dynamic point corresponding to the channel state - * 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. - */ - LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); - /** - * Create a signature for a (proposed) closing transaction. - * - * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have - * chosen to forgo their output as dust. - */ - LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx); - /** - * Signs a channel announcement message with our funding key, proving it comes from one - * of the channel participants. - * - * 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. - */ - LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); - /** - * Set the counterparty static channel data, including basepoints, - * counterparty_selected/holder_selected_contest_delay and funding outpoint. - * This is done as soon as the funding outpoint is known. Since these are static channel data, - * they MUST NOT be allowed to change to different values once set. - * - * channel_parameters.is_populated() MUST be true. - * - * We bind holder_selected_contest_delay late here for API convenience. - * - * Will be called before any signatures are applied. - */ - void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); - void *(*clone)(const void *this_arg); - LDKCVec_u8Z (*write)(const void *this_arg); - void (*free)(void *this_arg); -} LDKChannelKeys; - - - -/** - * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates - * on-chain transactions to ensure no loss of funds occurs. - * - * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date - * information and are actively monitoring the chain. - * - * Pending Events or updated HTLCs which have not yet been read out by - * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and - * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events - * gotten are fully handled before re-serializing the new state. - * - * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the - * returned block hash and the the current chain and then reconnecting blocks to get to the - * best chain) upon deserializing the object! + * Features used within a `channel_announcement` message. */ -typedef struct MUST_USE_STRUCT LDKChannelMonitor { +typedef struct MUST_USE_STRUCT LDKChannelFeatures { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelMonitor *inner; + LDKnativeChannelFeatures *inner; bool is_owned; -} LDKChannelMonitor; - -typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor { - struct LDKThirtyTwoBytes a; - struct LDKChannelMonitor b; -} LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor; +} LDKChannelFeatures; -typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor LDKC2Tuple_BlockHashChannelMonitorZ; +typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr { + struct LDKChannelFeatures *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelFeaturesDecodeErrorZPtr; -typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ; +typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ { + union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelFeaturesDecodeErrorZ; -typedef struct LDKCVecTempl_Signature LDKCVec_SignatureZ; -/** - * A Rust str object, ie a reference to a UTF8-valid string. - * This is *not* null-terminated so cannot be used directly as a C string! - */ -typedef struct LDKStr { - const uint8_t *chars; - uintptr_t len; -} LDKStr; /** - * Indicates an error on the client's part (usually some variant of attempting to use too-low or - * too-high values) + * Options which apply on a per-channel basis and may change at runtime or based on negotiation + * with our counterparty. */ -typedef enum LDKAPIError_Tag { - /** - * Indicates the API was wholly misused (see err for more). Cases where these can be returned - * are documented, but generally indicates some precondition of a function was violated. - */ - LDKAPIError_APIMisuseError, - /** - * Due to a high feerate, we were unable to complete the request. - * For example, this may be returned if the feerate implies we cannot open a channel at the - * requested value, but opening a larger channel would succeed. - */ - LDKAPIError_FeeRateTooHigh, - /** - * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, - * too-many-hops, etc). - */ - LDKAPIError_RouteError, - /** - * We were unable to complete the request as the Channel required to do so is unable to - * complete the request (or was not found). This can take many forms, including disconnected - * peer, channel at capacity, channel shutting down, etc. - */ - LDKAPIError_ChannelUnavailable, - /** - * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the - * attempted action to fail. - */ - LDKAPIError_MonitorUpdateFailed, +typedef struct MUST_USE_STRUCT LDKChannelConfig { /** - * Must be last for serialization purposes + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKAPIError_Sentinel, -} LDKAPIError_Tag; - -typedef struct LDKAPIError_LDKAPIMisuseError_Body { - LDKCVec_u8Z err; -} LDKAPIError_LDKAPIMisuseError_Body; - -typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { - LDKCVec_u8Z err; - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; - -typedef struct LDKAPIError_LDKRouteError_Body { - struct LDKStr err; -} LDKAPIError_LDKRouteError_Body; - -typedef struct LDKAPIError_LDKChannelUnavailable_Body { - LDKCVec_u8Z err; -} LDKAPIError_LDKChannelUnavailable_Body; - -typedef struct MUST_USE_STRUCT LDKAPIError { - LDKAPIError_Tag tag; - union { - LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; - LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; - LDKAPIError_LDKRouteError_Body route_error; - LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; - }; -} LDKAPIError; + LDKnativeChannelConfig *inner; + bool is_owned; +} LDKChannelConfig; -typedef union LDKCResultPtr_u8__APIError { - uint8_t *result; - struct LDKAPIError *err; -} LDKCResultPtr_u8__APIError; +typedef union LDKCResult_ChannelConfigDecodeErrorZPtr { + struct LDKChannelConfig *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelConfigDecodeErrorZPtr; -typedef struct LDKCResultTempl_u8__APIError { - union LDKCResultPtr_u8__APIError contents; +typedef struct LDKCResult_ChannelConfigDecodeErrorZ { + union LDKCResult_ChannelConfigDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__APIError; - -typedef struct LDKCResultTempl_u8__APIError LDKCResult_NoneAPIErrorZ; +} LDKCResult_ChannelConfigDecodeErrorZ; /** - * If a payment fails to send, it can be in one of several states. This enum is returned as the - * Err() type describing which state the payment is in, see the description of individual enum - * states for more. + * An Err type for failure to process messages. */ -typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { +typedef struct MUST_USE_STRUCT LDKLightningError { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativePaymentSendFailure *inner; + LDKnativeLightningError *inner; bool is_owned; -} LDKPaymentSendFailure; +} LDKLightningError; -typedef union LDKCResultPtr_u8__PaymentSendFailure { - uint8_t *result; - struct LDKPaymentSendFailure *err; -} LDKCResultPtr_u8__PaymentSendFailure; +typedef union LDKCResult_boolLightningErrorZPtr { + bool *result; + struct LDKLightningError *err; +} LDKCResult_boolLightningErrorZPtr; -typedef struct LDKCResultTempl_u8__PaymentSendFailure { - union LDKCResultPtr_u8__PaymentSendFailure contents; +typedef struct LDKCResult_boolLightningErrorZ { + union LDKCResult_boolLightningErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__PaymentSendFailure; - -typedef struct LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ; +} LDKCResult_boolLightningErrorZ; /** - * An update generated by the underlying Channel itself which contains some new information the - * ChannelMonitor should be made aware of. + * A channel_announcement message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { +typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelMonitorUpdate *inner; + LDKnativeChannelAnnouncement *inner; bool is_owned; -} LDKChannelMonitorUpdate; +} LDKChannelAnnouncement; /** - * An event to be processed by the ChannelManager. + * A channel_update message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKMonitorEvent { +typedef struct MUST_USE_STRUCT LDKChannelUpdate { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMonitorEvent *inner; + LDKnativeChannelUpdate *inner; bool is_owned; -} LDKMonitorEvent; +} LDKChannelUpdate; -typedef struct LDKCVecTempl_MonitorEvent { - struct LDKMonitorEvent *data; +typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + struct LDKChannelAnnouncement a; + struct LDKChannelUpdate b; + struct LDKChannelUpdate c; +} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; + +typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data; uintptr_t datalen; -} LDKCVecTempl_MonitorEvent; +} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; + -typedef struct LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ; /** - * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as - * blocks are connected and disconnected. - * - * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are - * responsible for maintaining a set of monitors such that they can be updated accordingly as - * channel state changes and HTLCs are resolved. See method documentation for specific - * requirements. - * - * Implementations **must** ensure that updates are successfully applied and persisted upon method - * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down - * without taking any further action such as persisting the current state. - * - * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing - * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it - * could result in a revoked transaction being broadcast, allowing the counterparty to claim all - * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle - * multiple instances. - * - * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html - * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html - * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure + * A node_announcement message to be sent or received from a peer */ -typedef struct LDKWatch { - void *this_arg; - /** - * Watches a channel identified by `funding_txo` using `monitor`. - * - * Implementations are responsible for watching the chain for the funding transaction along - * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means - * calling [`block_connected`] and [`block_disconnected`] on the monitor. - * - * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch - * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected - * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected - */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); - /** - * Updates a channel identified by `funding_txo` by applying `update` to its monitor. - * - * Implementations must call [`update_monitor`] with the given update. See - * [`ChannelMonitorUpdateErr`] for invariants around returning an error. - * - * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor - * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html - */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); +typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { /** - * Returns any monitor events since the last call. Subsequent calls must only return new - * events. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); - void (*free)(void *this_arg); -} LDKWatch; + LDKnativeNodeAnnouncement *inner; + bool is_owned; +} LDKNodeAnnouncement; -/** - * An interface to send a transaction to the Bitcoin network. - */ -typedef struct LDKBroadcasterInterface { - void *this_arg; +typedef struct LDKCVec_NodeAnnouncementZ { + struct LDKNodeAnnouncement *data; + uintptr_t datalen; +} LDKCVec_NodeAnnouncementZ; + +typedef union LDKCResult_NoneLightningErrorZPtr { /** - * Sends a transaction out to (hopefully) be mined. + * Note that this value is always NULL, as there are no contents in the OK variant */ - void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); - void (*free)(void *this_arg); -} LDKBroadcasterInterface; + void *result; + struct LDKLightningError *err; +} LDKCResult_NoneLightningErrorZPtr; -typedef struct LDKSecretKey { - uint8_t bytes[32]; -} LDKSecretKey; +typedef struct LDKCResult_NoneLightningErrorZ { + union LDKCResult_NoneLightningErrorZPtr contents; + bool result_ok; +} LDKCResult_NoneLightningErrorZ; /** - * An error in decoding a message or struct. + * An accept_channel message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKDecodeError { +typedef struct MUST_USE_STRUCT LDKAcceptChannel { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeDecodeError *inner; + LDKnativeAcceptChannel *inner; bool is_owned; -} LDKDecodeError; - -typedef union LDKCResultPtr_ChannelKeys__DecodeError { - struct LDKChannelKeys *result; - struct LDKDecodeError *err; -} LDKCResultPtr_ChannelKeys__DecodeError; - -typedef struct LDKCResultTempl_ChannelKeys__DecodeError { - union LDKCResultPtr_ChannelKeys__DecodeError contents; - bool result_ok; -} LDKCResultTempl_ChannelKeys__DecodeError; +} LDKAcceptChannel; -typedef struct LDKCResultTempl_ChannelKeys__DecodeError LDKCResult_ChanKeySignerDecodeErrorZ; -typedef struct LDKu8slice { - const uint8_t *data; - uintptr_t datalen; -} LDKu8slice; /** - * A trait to describe an object which can get user secrets and key material. + * An open_channel message to be sent or received from a peer */ -typedef struct LDKKeysInterface { - void *this_arg; - /** - * Get node secret key (aka node_id or network_key) - */ - struct LDKSecretKey (*get_node_secret)(const void *this_arg); - /** - * Get destination redeemScript to encumber static protocol exit points. - */ - LDKCVec_u8Z (*get_destination_script)(const void *this_arg); - /** - * Get shutdown_pubkey to use as PublicKey at channel closure - */ - struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg); - /** - * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! - */ - struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); - /** - * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting - * onion packets and for temporary channel IDs. There is no requirement that these be - * persisted anywhere, though they must be unique across restarts. - */ - struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); +typedef struct MUST_USE_STRUCT LDKOpenChannel { /** - * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream. - * This is only called during deserialization of other objects which contain - * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); - void (*free)(void *this_arg); -} LDKKeysInterface; + LDKnativeOpenChannel *inner; + bool is_owned; +} LDKOpenChannel; + -/** - * A trait which should be implemented to provide feerate information on a number of time - * horizons. - * - * 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). - */ -typedef struct LDKFeeEstimator { - void *this_arg; - /** - * Gets estimated satoshis of fee required per 1000 Weight-Units. - * - * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs - * don't put us below 1 satoshi-per-byte). - * - * This translates to: - * * satoshis-per-byte * 250 - * * ceil(satoshis-per-kbyte / 4) - */ - uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); - void (*free)(void *this_arg); -} LDKFeeEstimator; /** - * A trait encapsulating the operations required of a logger + * A funding_created message to be sent or received from a peer */ -typedef struct LDKLogger { - void *this_arg; +typedef struct MUST_USE_STRUCT LDKFundingCreated { /** - * Logs the `Record` + * Nearly everywhere, 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 (*log)(const void *this_arg, const char *record); - void (*free)(void *this_arg); -} LDKLogger; + LDKnativeFundingCreated *inner; + bool is_owned; +} LDKFundingCreated; /** - * Manager which keeps track of a number of channels and sends messages to the appropriate - * channel, also tracking HTLC preimages and forwarding onion packets appropriately. - * - * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through - * to individual Channels. - * - * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for - * all peers during write/read (though does not modify this instance, only the instance being - * serialized). This will result in any channels which have not yet exchanged funding_created (ie - * called funding_transaction_generated for outbound channels). - * - * Note that you can be a bit lazier about writing out ChannelManager than you can be with - * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before - * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates - * happens out-of-band (and will prevent any other ChannelManager operations from occurring during - * the serialization process). If the deserialized version is out-of-date compared to the - * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the - * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). - * - * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call - * block_connected() to step towards your best block) upon deserialization before using the - * object! - * - * Note that 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_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect. - * - * 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. + * A funding_signed message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChannelManager { +typedef struct MUST_USE_STRUCT LDKFundingSigned { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelManager *inner; + LDKnativeFundingSigned *inner; bool is_owned; -} LDKChannelManager; - -typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager { - struct LDKThirtyTwoBytes a; - struct LDKChannelManager b; -} LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager; - -typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager LDKC2Tuple_BlockHashChannelManagerZ; +} LDKFundingSigned; /** - * A channel_announcement message to be sent or received from a peer + * A funding_locked message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { +typedef struct MUST_USE_STRUCT LDKFundingLocked { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelAnnouncement *inner; + LDKnativeFundingLocked *inner; bool is_owned; -} LDKChannelAnnouncement; +} LDKFundingLocked; /** - * A channel_update message to be sent or received from a peer + * An announcement_signatures message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChannelUpdate { +typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { /** * Nearly everywhere, 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; + LDKnativeAnnouncementSignatures *inner; bool is_owned; -} LDKChannelUpdate; - -typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate { - struct LDKChannelAnnouncement a; - struct LDKChannelUpdate b; - struct LDKChannelUpdate c; -} LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate; - -typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; +} LDKAnnouncementSignatures; /** - * An Err type for failure to process messages. + * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment + * transaction updates if they were pending. */ -typedef struct MUST_USE_STRUCT LDKLightningError { +typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeLightningError *inner; + LDKnativeCommitmentUpdate *inner; bool is_owned; -} LDKLightningError; - -typedef union LDKCResultPtr_u8__LightningError { - uint8_t *result; - struct LDKLightningError *err; -} LDKCResultPtr_u8__LightningError; - -typedef struct LDKCResultTempl_u8__LightningError { - union LDKCResultPtr_u8__LightningError contents; - bool result_ok; -} LDKCResultTempl_u8__LightningError; - -typedef struct LDKCResultTempl_u8__LightningError LDKCResult_NoneLightningErrorZ; +} LDKCommitmentUpdate; /** - * Error for PeerManager errors. If you get one of these, you must disconnect the socket and - * generate no further read_event/write_buffer_space_avail calls for the descriptor, only - * triggering a single socket_disconnected call (unless it was provided in response to a - * new_*_connection event, in which case no such socket_disconnected() must be called and the - * socket silently disconencted). + * A revoke_and_ack message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKPeerHandleError { +typedef struct MUST_USE_STRUCT LDKRevokeAndACK { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativePeerHandleError *inner; + LDKnativeRevokeAndACK *inner; bool is_owned; -} LDKPeerHandleError; +} LDKRevokeAndACK; -typedef union LDKCResultPtr_u8__PeerHandleError { - uint8_t *result; - struct LDKPeerHandleError *err; -} LDKCResultPtr_u8__PeerHandleError; -typedef struct LDKCResultTempl_u8__PeerHandleError { - union LDKCResultPtr_u8__PeerHandleError contents; - bool result_ok; -} LDKCResultTempl_u8__PeerHandleError; -typedef struct LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ; +/** + * A closing_signed message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKClosingSigned { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeClosingSigned *inner; + bool is_owned; +} LDKClosingSigned; /** - * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin - * transaction and the transaction creation keys) are trusted. - * - * See trust() and verify() functions on CommitmentTransaction. - * - * This structure implements Deref. + * A shutdown message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction { +typedef struct MUST_USE_STRUCT LDKShutdown { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeTrustedCommitmentTransaction *inner; + LDKnativeShutdown *inner; bool is_owned; -} LDKTrustedCommitmentTransaction; +} LDKShutdown; -typedef union LDKCResultPtr_TrustedCommitmentTransaction__u8 { - struct LDKTrustedCommitmentTransaction *result; - uint8_t *err; -} LDKCResultPtr_TrustedCommitmentTransaction__u8; -typedef struct LDKCResultTempl_TrustedCommitmentTransaction__u8 { - union LDKCResultPtr_TrustedCommitmentTransaction__u8 contents; - bool result_ok; -} LDKCResultTempl_TrustedCommitmentTransaction__u8; -typedef struct LDKCResultTempl_TrustedCommitmentTransaction__u8 LDKCResult_TrustedCommitmentTransactionNoneZ; +/** + * A channel_reestablish message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelReestablish { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelReestablish *inner; + bool is_owned; +} LDKChannelReestablish; -typedef union LDKCResultPtr_CVecTempl_Signature_____u8 { - struct LDKCVecTempl_Signature *result; - uint8_t *err; -} LDKCResultPtr_CVecTempl_Signature_____u8; -typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 { - union LDKCResultPtr_CVecTempl_Signature_____u8 contents; - bool result_ok; -} LDKCResultTempl_CVecTempl_Signature_____u8; -typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ; +/** + * An error message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKErrorMessage { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeErrorMessage *inner; + bool is_owned; +} LDKErrorMessage; /** - * When on-chain outputs are created by rust-lightning (which our counterparty is not able to - * claim at any point in the future) an event is generated which you must track and be able to - * spend on-chain. The information needed to do this is provided in this enum, including the - * outpoint describing which txid and output index is available, the full output which exists at - * that txid/index, and any keys or other information required to sign. + * Used to put an error message in a LightningError */ -typedef enum LDKSpendableOutputDescriptor_Tag { +typedef enum LDKErrorAction_Tag { /** - * An output to a script which was provided via KeysInterface, thus you should already know - * how to spend it. No keys are provided as rust-lightning was never given any keys - only the - * script_pubkey as it appears in the output. - * These may include outputs from a transaction punishing our counterparty or claiming an HTLC - * on-chain using the payment preimage or after it has timed out. + * The peer took some action which made us think they were useless. Disconnect them. */ - LDKSpendableOutputDescriptor_StaticOutput, + LDKErrorAction_DisconnectPeer, /** - * An output to a P2WSH script which can be spent with a single signature after a CSV delay. - * - * The witness in the spending input should be: - * (MINIMALIF standard rule) - * - * Note that the nSequence field in the spending input must be set to to_self_delay - * (which means the transaction is not broadcastable until at least to_self_delay - * blocks after the outpoint confirms). - * - * These are generally the result of a \"revocable\" output to us, spendable only by us unless - * it is an output from an old state which we broadcast (which should never happen). - * - * To derive the delayed_payment key which is used to sign for this input, you must pass the - * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in - * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to - * chan_utils::derive_private_key. The public key can be generated without the secret key - * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in - * ChannelKeys::pubkeys(). - * - * To derive the revocation_pubkey provided here (which is used in the witness - * script generation), you must pass the counterparty revocation_basepoint (which appears in the - * call to ChannelKeys::ready_channel) and the provided per_commitment point - * to chan_utils::derive_public_revocation_key. - * - * The witness script which is hashed and included in the output script_pubkey may be - * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey - * (derived as above), and the to_self_delay contained here to - * chan_utils::get_revokeable_redeemscript. + * The peer did something harmless that we weren't able to process, just log and ignore */ - LDKSpendableOutputDescriptor_DynamicOutputP2WSH, + LDKErrorAction_IgnoreError, /** - * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which - * corresponds to the public key in ChannelKeys::pubkeys().payment_point). - * The witness in the spending input, is, thus, simply: - * - * - * These are generally the result of our counterparty having broadcast the current state, - * allowing us to claim the non-HTLC-encumbered outputs immediately. + * The peer did something incorrect. Tell them. */ - LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment, + LDKErrorAction_SendErrorMessage, /** * Must be last for serialization purposes */ - LDKSpendableOutputDescriptor_Sentinel, -} LDKSpendableOutputDescriptor_Tag; - -typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { - struct LDKOutPoint outpoint; - struct LDKTxOut output; -} LDKSpendableOutputDescriptor_LDKStaticOutput_Body; + LDKErrorAction_Sentinel, +} LDKErrorAction_Tag; -typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body { - struct LDKOutPoint outpoint; - struct LDKPublicKey per_commitment_point; - uint16_t to_self_delay; - struct LDKTxOut output; - LDKC2Tuple_u64u64Z key_derivation_params; - struct LDKPublicKey revocation_pubkey; -} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body; +typedef struct LDKErrorAction_LDKDisconnectPeer_Body { + struct LDKErrorMessage msg; +} LDKErrorAction_LDKDisconnectPeer_Body; -typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body { - struct LDKOutPoint outpoint; - struct LDKTxOut output; - LDKC2Tuple_u64u64Z key_derivation_params; -} LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body; +typedef struct LDKErrorAction_LDKSendErrorMessage_Body { + struct LDKErrorMessage msg; +} LDKErrorAction_LDKSendErrorMessage_Body; -typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { - LDKSpendableOutputDescriptor_Tag tag; +typedef struct MUST_USE_STRUCT LDKErrorAction { + LDKErrorAction_Tag tag; union { - LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output; - LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh; - LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment; + LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; + LDKErrorAction_LDKSendErrorMessage_Body send_error_message; }; -} LDKSpendableOutputDescriptor; - -typedef struct LDKCVecTempl_SpendableOutputDescriptor { - struct LDKSpendableOutputDescriptor *data; - uintptr_t datalen; -} LDKCVecTempl_SpendableOutputDescriptor; - -typedef struct LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ; +} LDKErrorAction; /** - * An Event which you should probably take some action in response to. - * - * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use - * them directly as they don't round-trip exactly (for example FundingGenerationReady is never - * written as it makes no sense to respond to it after reconnecting to peers). + * The information we received from a peer along the route of a payment we originated. This is + * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into + * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map. */ -typedef enum LDKEvent_Tag { - /** - * Used to indicate that the client should generate a funding transaction with the given - * parameters and then call ChannelManager::funding_transaction_generated. - * Generated in ChannelManager message handling. - * Note that *all inputs* in the funding transaction must spend SegWit outputs or your - * counterparty can steal your funds! - */ - LDKEvent_FundingGenerationReady, - /** - * Used to indicate that the client may now broadcast the funding transaction it created for a - * channel. Broadcasting such a transaction prior to this event may lead to our counterparty - * trivially stealing all funds in the funding transaction! - */ - LDKEvent_FundingBroadcastSafe, - /** - * Indicates we've received money! Just gotta dig out that payment preimage and feed it to - * ChannelManager::claim_funds to get it.... - * Note that if the preimage is not known or the amount paid is incorrect, you should call - * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid - * network congestion. - * The amount paid should be considered 'incorrect' when it is less than or more than twice - * the amount expected. - * If you fail to call either ChannelManager::claim_funds or - * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be - * automatically failed. - */ - LDKEvent_PaymentReceived, - /** - * Indicates an outbound payment we made succeeded (ie it made it all the way to its target - * and we got back the payment preimage for it). - * Note that duplicative PaymentSent Events may be generated - it is your responsibility to - * deduplicate them by payment_preimage (which MUST be unique)! - */ - LDKEvent_PaymentSent, +typedef enum LDKHTLCFailChannelUpdate_Tag { /** - * Indicates an outbound payment we made failed. Probably some intermediary node dropped - * something. You may wish to retry with a different route. - * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to - * deduplicate them by payment_hash (which MUST be unique)! + * We received an error which included a full ChannelUpdate message. */ - LDKEvent_PaymentFailed, + LDKHTLCFailChannelUpdate_ChannelUpdateMessage, /** - * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a - * time in the future. + * We received an error which indicated only that a channel has been closed */ - LDKEvent_PendingHTLCsForwardable, + LDKHTLCFailChannelUpdate_ChannelClosed, /** - * Used to indicate that an output was generated on-chain which you should know how to spend. - * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your - * counterparty spending them due to some kind of timeout. Thus, you need to store them - * somewhere and spend them when you create on-chain transactions. + * We received an error which indicated only that a node has failed */ - LDKEvent_SpendableOutputs, + LDKHTLCFailChannelUpdate_NodeFailure, /** * Must be last for serialization purposes */ - LDKEvent_Sentinel, -} LDKEvent_Tag; - -typedef struct LDKEvent_LDKFundingGenerationReady_Body { - struct LDKThirtyTwoBytes temporary_channel_id; - uint64_t channel_value_satoshis; - LDKCVec_u8Z output_script; - uint64_t user_channel_id; -} LDKEvent_LDKFundingGenerationReady_Body; - -typedef struct LDKEvent_LDKFundingBroadcastSafe_Body { - struct LDKOutPoint funding_txo; - uint64_t user_channel_id; -} LDKEvent_LDKFundingBroadcastSafe_Body; - -typedef struct LDKEvent_LDKPaymentReceived_Body { - struct LDKThirtyTwoBytes payment_hash; - struct LDKThirtyTwoBytes payment_secret; - uint64_t amt; -} LDKEvent_LDKPaymentReceived_Body; - -typedef struct LDKEvent_LDKPaymentSent_Body { - struct LDKThirtyTwoBytes payment_preimage; -} LDKEvent_LDKPaymentSent_Body; + LDKHTLCFailChannelUpdate_Sentinel, +} LDKHTLCFailChannelUpdate_Tag; -typedef struct LDKEvent_LDKPaymentFailed_Body { - struct LDKThirtyTwoBytes payment_hash; - bool rejected_by_dest; -} LDKEvent_LDKPaymentFailed_Body; +typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body { + struct LDKChannelUpdate msg; +} LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body; -typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { - uint64_t time_forwardable; -} LDKEvent_LDKPendingHTLCsForwardable_Body; +typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body { + uint64_t short_channel_id; + bool is_permanent; +} LDKHTLCFailChannelUpdate_LDKChannelClosed_Body; -typedef struct LDKEvent_LDKSpendableOutputs_Body { - LDKCVec_SpendableOutputDescriptorZ outputs; -} LDKEvent_LDKSpendableOutputs_Body; +typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body { + struct LDKPublicKey node_id; + bool is_permanent; +} LDKHTLCFailChannelUpdate_LDKNodeFailure_Body; -typedef struct MUST_USE_STRUCT LDKEvent { - LDKEvent_Tag tag; +typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate { + LDKHTLCFailChannelUpdate_Tag tag; union { - LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; - LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe; - LDKEvent_LDKPaymentReceived_Body payment_received; - LDKEvent_LDKPaymentSent_Body payment_sent; - LDKEvent_LDKPaymentFailed_Body payment_failed; - LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; - LDKEvent_LDKSpendableOutputs_Body spendable_outputs; + LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message; + LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed; + LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure; }; -} LDKEvent; +} LDKHTLCFailChannelUpdate; /** - * An accept_channel message to be sent or received from a peer + * A query_channel_range message is used to query a peer for channel + * UTXOs in a range of blocks. The recipient of a query makes a best + * effort to reply to the query using one or more reply_channel_range + * messages. */ -typedef struct MUST_USE_STRUCT LDKAcceptChannel { +typedef struct MUST_USE_STRUCT LDKQueryChannelRange { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeAcceptChannel *inner; + LDKnativeQueryChannelRange *inner; bool is_owned; -} LDKAcceptChannel; +} LDKQueryChannelRange; /** - * An open_channel message to be sent or received from a peer + * A query_short_channel_ids message is used to query a peer for + * routing gossip messages related to one or more short_channel_ids. + * The query recipient will reply with the latest, if available, + * channel_announcement, channel_update and node_announcement messages + * it maintains for the requested short_channel_ids followed by a + * reply_short_channel_ids_end message. The short_channel_ids sent in + * this query are encoded. We only support encoding_type=0 uncompressed + * serialization and do not support encoding_type=1 zlib serialization. */ -typedef struct MUST_USE_STRUCT LDKOpenChannel { +typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeOpenChannel *inner; + LDKnativeQueryShortChannelIds *inner; bool is_owned; -} LDKOpenChannel; - - +} LDKQueryShortChannelIds; /** - * A funding_created message to be sent or received from a peer + * An event generated by ChannelManager which indicates a message should be sent to a peer (or + * broadcast to most peers). + * These events are handled by PeerManager::process_events if you are using a PeerManager. */ -typedef struct MUST_USE_STRUCT LDKFundingCreated { +typedef enum LDKMessageSendEvent_Tag { /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that we've accepted a channel open and should send the accept_channel + * message provided to the given peer. */ - LDKnativeFundingCreated *inner; - bool is_owned; -} LDKFundingCreated; - - - -/** - * A funding_signed message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKFundingSigned { + LDKMessageSendEvent_SendAcceptChannel, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that we've initiated a channel open and should send the open_channel + * message provided to the given peer. */ - LDKnativeFundingSigned *inner; - bool is_owned; -} LDKFundingSigned; - - - -/** - * A funding_locked message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKFundingLocked { + LDKMessageSendEvent_SendOpenChannel, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a funding_created message should be sent to the peer with the given node_id. */ - LDKnativeFundingLocked *inner; - bool is_owned; -} LDKFundingLocked; - - - -/** - * An announcement_signatures message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { + LDKMessageSendEvent_SendFundingCreated, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. */ - LDKnativeAnnouncementSignatures *inner; - bool is_owned; -} LDKAnnouncementSignatures; - - - -/** - * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment - * transaction updates if they were pending. - */ -typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { + LDKMessageSendEvent_SendFundingSigned, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a funding_locked message should be sent to the peer with the given node_id. */ - LDKnativeCommitmentUpdate *inner; - bool is_owned; -} LDKCommitmentUpdate; - - - -/** - * A revoke_and_ack message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKRevokeAndACK { + LDKMessageSendEvent_SendFundingLocked, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. */ - LDKnativeRevokeAndACK *inner; - bool is_owned; -} LDKRevokeAndACK; - - - -/** - * A closing_signed message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKClosingSigned { + LDKMessageSendEvent_SendAnnouncementSignatures, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a series of HTLC update messages, as well as a commitment_signed + * message should be sent to the peer with the given node_id. */ - LDKnativeClosingSigned *inner; - bool is_owned; -} LDKClosingSigned; - - - -/** - * A shutdown message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKShutdown { + LDKMessageSendEvent_UpdateHTLCs, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. */ - LDKnativeShutdown *inner; - bool is_owned; -} LDKShutdown; - - - -/** - * A channel_reestablish message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKChannelReestablish { + LDKMessageSendEvent_SendRevokeAndACK, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. */ - LDKnativeChannelReestablish *inner; - bool is_owned; -} LDKChannelReestablish; - - - -/** - * A node_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { + LDKMessageSendEvent_SendClosingSigned, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a shutdown message should be sent to the peer with the given node_id. */ - LDKnativeNodeAnnouncement *inner; - bool is_owned; -} LDKNodeAnnouncement; - - - -/** - * An error message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKErrorMessage { + LDKMessageSendEvent_SendShutdown, /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. */ - LDKnativeErrorMessage *inner; - bool is_owned; -} LDKErrorMessage; - -/** - * Used to put an error message in a LightningError - */ -typedef enum LDKErrorAction_Tag { + LDKMessageSendEvent_SendChannelReestablish, /** - * The peer took some action which made us think they were useless. Disconnect them. + * Used to indicate that a channel_announcement and channel_update should be broadcast to all + * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). + * + * Note that after doing so, you very likely (unless you did so very recently) want to call + * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. + * This ensures that any nodes which see our channel_announcement also have a relevant + * node_announcement, including relevant feature flags which may be important for routing + * through or to us. */ - LDKErrorAction_DisconnectPeer, + LDKMessageSendEvent_BroadcastChannelAnnouncement, /** - * The peer did something harmless that we weren't able to process, just log and ignore + * Used to indicate that a node_announcement should be broadcast to all peers. */ - LDKErrorAction_IgnoreError, + LDKMessageSendEvent_BroadcastNodeAnnouncement, /** - * The peer did something incorrect. Tell them. + * Used to indicate that a channel_update should be broadcast to all peers. */ - LDKErrorAction_SendErrorMessage, + LDKMessageSendEvent_BroadcastChannelUpdate, /** - * Must be last for serialization purposes + * Broadcast an error downstream to be handled */ - LDKErrorAction_Sentinel, -} LDKErrorAction_Tag; - -typedef struct LDKErrorAction_LDKDisconnectPeer_Body { - struct LDKErrorMessage msg; -} LDKErrorAction_LDKDisconnectPeer_Body; - -typedef struct LDKErrorAction_LDKSendErrorMessage_Body { - struct LDKErrorMessage msg; -} LDKErrorAction_LDKSendErrorMessage_Body; - -typedef struct MUST_USE_STRUCT LDKErrorAction { - LDKErrorAction_Tag tag; - union { - LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; - LDKErrorAction_LDKSendErrorMessage_Body send_error_message; - }; -} LDKErrorAction; - -/** - * The information we received from a peer along the route of a payment we originated. This is - * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into - * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map. - */ -typedef enum LDKHTLCFailChannelUpdate_Tag { + LDKMessageSendEvent_HandleError, /** - * We received an error which included a full ChannelUpdate message. + * When a payment fails we may receive updates back from the hop where it failed. In such + * cases this event is generated so that we can inform the network graph of this information. */ - LDKHTLCFailChannelUpdate_ChannelUpdateMessage, + LDKMessageSendEvent_PaymentFailureNetworkUpdate, /** - * We received an error which indicated only that a channel has been closed + * Query a peer for channels with funding transaction UTXOs in a block range. */ - LDKHTLCFailChannelUpdate_ChannelClosed, + LDKMessageSendEvent_SendChannelRangeQuery, /** - * We received an error which indicated only that a node has failed + * Request routing gossip messages from a peer for a list of channels identified by + * their short_channel_ids. */ - LDKHTLCFailChannelUpdate_NodeFailure, + LDKMessageSendEvent_SendShortIdsQuery, /** * Must be last for serialization purposes */ - LDKHTLCFailChannelUpdate_Sentinel, -} LDKHTLCFailChannelUpdate_Tag; + LDKMessageSendEvent_Sentinel, +} LDKMessageSendEvent_Tag; -typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body { +typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { + struct LDKPublicKey node_id; + struct LDKAcceptChannel msg; +} LDKMessageSendEvent_LDKSendAcceptChannel_Body; + +typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { + struct LDKPublicKey node_id; + struct LDKOpenChannel msg; +} LDKMessageSendEvent_LDKSendOpenChannel_Body; + +typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { + struct LDKPublicKey node_id; + struct LDKFundingCreated msg; +} LDKMessageSendEvent_LDKSendFundingCreated_Body; + +typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { + struct LDKPublicKey node_id; + struct LDKFundingSigned msg; +} LDKMessageSendEvent_LDKSendFundingSigned_Body; + +typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { + struct LDKPublicKey node_id; + struct LDKFundingLocked msg; +} LDKMessageSendEvent_LDKSendFundingLocked_Body; + +typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { + struct LDKPublicKey node_id; + struct LDKAnnouncementSignatures msg; +} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; + +typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body { + struct LDKPublicKey node_id; + struct LDKCommitmentUpdate updates; +} LDKMessageSendEvent_LDKUpdateHTLCs_Body; + +typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body { + struct LDKPublicKey node_id; + struct LDKRevokeAndACK msg; +} LDKMessageSendEvent_LDKSendRevokeAndACK_Body; + +typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { + struct LDKPublicKey node_id; + struct LDKClosingSigned msg; +} LDKMessageSendEvent_LDKSendClosingSigned_Body; + +typedef struct LDKMessageSendEvent_LDKSendShutdown_Body { + struct LDKPublicKey node_id; + struct LDKShutdown msg; +} LDKMessageSendEvent_LDKSendShutdown_Body; + +typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body { + struct LDKPublicKey node_id; + struct LDKChannelReestablish msg; +} LDKMessageSendEvent_LDKSendChannelReestablish_Body; + +typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { + struct LDKChannelAnnouncement msg; + struct LDKChannelUpdate update_msg; +} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; + +typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body { + struct LDKNodeAnnouncement msg; +} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body; + +typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { struct LDKChannelUpdate msg; -} LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body; +} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body; -typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body { - uint64_t short_channel_id; - bool is_permanent; -} LDKHTLCFailChannelUpdate_LDKChannelClosed_Body; +typedef struct LDKMessageSendEvent_LDKHandleError_Body { + struct LDKPublicKey node_id; + struct LDKErrorAction action; +} LDKMessageSendEvent_LDKHandleError_Body; -typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body { +typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body { + struct LDKHTLCFailChannelUpdate update; +} LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body; + +typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { struct LDKPublicKey node_id; - bool is_permanent; -} LDKHTLCFailChannelUpdate_LDKNodeFailure_Body; + struct LDKQueryChannelRange msg; +} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; -typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate { - LDKHTLCFailChannelUpdate_Tag tag; +typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body { + struct LDKPublicKey node_id; + struct LDKQueryShortChannelIds msg; +} LDKMessageSendEvent_LDKSendShortIdsQuery_Body; + +typedef struct MUST_USE_STRUCT LDKMessageSendEvent { + LDKMessageSendEvent_Tag tag; union { - LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message; - LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed; - LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure; + LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel; + LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel; + LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created; + LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed; + LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked; + LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures; + LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs; + LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack; + LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed; + LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown; + LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish; + LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement; + LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement; + LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update; + LDKMessageSendEvent_LDKHandleError_Body handle_error; + LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update; + LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query; + LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query; }; -} LDKHTLCFailChannelUpdate; +} LDKMessageSendEvent; + +typedef struct LDKCVec_MessageSendEventZ { + struct LDKMessageSendEvent *data; + uintptr_t datalen; +} LDKCVec_MessageSendEventZ; /** - * A query_channel_range message is used to query a peer for channel - * UTXOs in a range of blocks. The recipient of a query makes a best - * effort to reply to the query using one or more reply_channel_range - * messages. + * Details about one direction of a channel. Received + * within a channel update. */ -typedef struct MUST_USE_STRUCT LDKQueryChannelRange { +typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeQueryChannelRange *inner; + LDKnativeDirectionalChannelInfo *inner; bool is_owned; -} LDKQueryChannelRange; +} LDKDirectionalChannelInfo; + +typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr { + struct LDKDirectionalChannelInfo *result; + struct LDKDecodeError *err; +} LDKCResult_DirectionalChannelInfoDecodeErrorZPtr; + +typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ { + union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_DirectionalChannelInfoDecodeErrorZ; /** - * A query_short_channel_ids message is used to query a peer for - * routing gossip messages related to one or more short_channel_ids. - * The query recipient will reply with the latest, if available, - * channel_announcement, channel_update and node_announcement messages - * it maintains for the requested short_channel_ids followed by a - * reply_short_channel_ids_end message. The short_channel_ids sent in - * this query are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * Details about a channel (both directions). + * Received within a channel announcement. */ -typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { +typedef struct MUST_USE_STRUCT LDKChannelInfo { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeQueryShortChannelIds *inner; + LDKnativeChannelInfo *inner; bool is_owned; -} LDKQueryShortChannelIds; +} LDKChannelInfo; + +typedef union LDKCResult_ChannelInfoDecodeErrorZPtr { + struct LDKChannelInfo *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelInfoDecodeErrorZPtr; + +typedef struct LDKCResult_ChannelInfoDecodeErrorZ { + union LDKCResult_ChannelInfoDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelInfoDecodeErrorZ; + + /** - * An event generated by ChannelManager which indicates a message should be sent to a peer (or - * broadcast to most peers). - * These events are handled by PeerManager::process_events if you are using a PeerManager. + * Fees for routing via a given channel or a node */ -typedef enum LDKMessageSendEvent_Tag { - /** - * Used to indicate that we've accepted a channel open and should send the accept_channel - * message provided to the given peer. - */ - LDKMessageSendEvent_SendAcceptChannel, - /** - * Used to indicate that we've initiated a channel open and should send the open_channel - * message provided to the given peer. - */ - LDKMessageSendEvent_SendOpenChannel, - /** - * Used to indicate that a funding_created message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendFundingCreated, - /** - * 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 funding_locked message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendFundingLocked, - /** - * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendAnnouncementSignatures, +typedef struct MUST_USE_STRUCT LDKRoutingFees { /** - * Used to indicate that a series of HTLC update messages, as well as a commitment_signed - * message should be sent to the peer with the given node_id. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_UpdateHTLCs, + LDKnativeRoutingFees *inner; + bool is_owned; +} LDKRoutingFees; + +typedef union LDKCResult_RoutingFeesDecodeErrorZPtr { + struct LDKRoutingFees *result; + struct LDKDecodeError *err; +} LDKCResult_RoutingFeesDecodeErrorZPtr; + +typedef struct LDKCResult_RoutingFeesDecodeErrorZ { + union LDKCResult_RoutingFeesDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_RoutingFeesDecodeErrorZ; + +typedef struct LDKFourBytes { + uint8_t data[4]; +} LDKFourBytes; + +typedef struct LDKSixteenBytes { + uint8_t data[16]; +} LDKSixteenBytes; + +typedef struct LDKTenBytes { + uint8_t data[10]; +} LDKTenBytes; + +/** + * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to + * look up the corresponding function in rust-lightning's docs. + */ +typedef struct LDKThirtyTwoBytes { + uint8_t data[32]; +} LDKThirtyTwoBytes; + +/** + * An address which can be used to connect to a remote peer + */ +typedef enum LDKNetAddress_Tag { /** - * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. + * An IPv4 address/port on which the peer is listening. */ - LDKMessageSendEvent_SendRevokeAndACK, + LDKNetAddress_IPv4, /** - * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. + * An IPv6 address/port on which the peer is listening. */ - LDKMessageSendEvent_SendClosingSigned, + LDKNetAddress_IPv6, /** - * Used to indicate that a shutdown message should be sent to the peer with the given node_id. + * An old-style Tor onion address/port on which the peer is listening. */ - LDKMessageSendEvent_SendShutdown, + LDKNetAddress_OnionV2, /** - * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. + * A new-style Tor onion address/port on which the peer is listening. + * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version, + * wrap as base32 and append \".onion\". */ - LDKMessageSendEvent_SendChannelReestablish, + LDKNetAddress_OnionV3, /** - * Used to indicate that a channel_announcement and channel_update should be broadcast to all - * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). - * - * Note that after doing so, you very likely (unless you did so very recently) want to call - * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. - * This ensures that any nodes which see our channel_announcement also have a relevant - * node_announcement, including relevant feature flags which may be important for routing - * through or to us. + * Must be last for serialization purposes */ - LDKMessageSendEvent_BroadcastChannelAnnouncement, + LDKNetAddress_Sentinel, +} LDKNetAddress_Tag; + +typedef struct LDKNetAddress_LDKIPv4_Body { + struct LDKFourBytes addr; + uint16_t port; +} LDKNetAddress_LDKIPv4_Body; + +typedef struct LDKNetAddress_LDKIPv6_Body { + struct LDKSixteenBytes addr; + uint16_t port; +} LDKNetAddress_LDKIPv6_Body; + +typedef struct LDKNetAddress_LDKOnionV2_Body { + struct LDKTenBytes addr; + uint16_t port; +} LDKNetAddress_LDKOnionV2_Body; + +typedef struct LDKNetAddress_LDKOnionV3_Body { + struct LDKThirtyTwoBytes ed25519_pubkey; + uint16_t checksum; + uint8_t version; + uint16_t port; +} LDKNetAddress_LDKOnionV3_Body; + +typedef struct MUST_USE_STRUCT LDKNetAddress { + LDKNetAddress_Tag tag; + union { + LDKNetAddress_LDKIPv4_Body i_pv4; + LDKNetAddress_LDKIPv6_Body i_pv6; + LDKNetAddress_LDKOnionV2_Body onion_v2; + LDKNetAddress_LDKOnionV3_Body onion_v3; + }; +} LDKNetAddress; + +typedef struct LDKCVec_NetAddressZ { + struct LDKNetAddress *data; + uintptr_t datalen; +} LDKCVec_NetAddressZ; + + + +/** + * Information received in the latest node_announcement from this node. + */ +typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { + /** + * Nearly everywhere, 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; + bool is_owned; +} LDKNodeAnnouncementInfo; + +typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr { + struct LDKNodeAnnouncementInfo *result; + struct LDKDecodeError *err; +} LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr; + +typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ { + union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_NodeAnnouncementInfoDecodeErrorZ; + +typedef struct LDKCVec_u64Z { + uint64_t *data; + uintptr_t datalen; +} LDKCVec_u64Z; + + + +/** + * Details about a node in the network, known from the network announcement. + */ +typedef struct MUST_USE_STRUCT LDKNodeInfo { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeNodeInfo *inner; + bool is_owned; +} LDKNodeInfo; + +typedef union LDKCResult_NodeInfoDecodeErrorZPtr { + struct LDKNodeInfo *result; + struct LDKDecodeError *err; +} LDKCResult_NodeInfoDecodeErrorZPtr; + +typedef struct LDKCResult_NodeInfoDecodeErrorZ { + union LDKCResult_NodeInfoDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_NodeInfoDecodeErrorZ; + + + +/** + * Represents the network as nodes and channels between them + */ +typedef struct MUST_USE_STRUCT LDKNetworkGraph { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeNetworkGraph *inner; + bool is_owned; +} LDKNetworkGraph; + +typedef union LDKCResult_NetworkGraphDecodeErrorZPtr { + struct LDKNetworkGraph *result; + struct LDKDecodeError *err; +} LDKCResult_NetworkGraphDecodeErrorZPtr; + +typedef struct LDKCResult_NetworkGraphDecodeErrorZ { + union LDKCResult_NetworkGraphDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_NetworkGraphDecodeErrorZ; + +typedef struct LDKC2Tuple_usizeTransactionZ { + uintptr_t a; + struct LDKTransaction b; +} LDKC2Tuple_usizeTransactionZ; + +typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { + struct LDKC2Tuple_usizeTransactionZ *data; + uintptr_t datalen; +} LDKCVec_C2Tuple_usizeTransactionZZ; + +typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + enum LDKChannelMonitorUpdateErr *err; +} LDKCResult_NoneChannelMonitorUpdateErrZPtr; + +typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ { + union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents; + bool result_ok; +} LDKCResult_NoneChannelMonitorUpdateErrZ; + + + +/** + * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on + * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the + * preimage claim backward will lead to loss of funds. + * + * [`chain::Watch`]: ../trait.Watch.html + */ +typedef struct MUST_USE_STRUCT LDKHTLCUpdate { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeHTLCUpdate *inner; + bool is_owned; +} LDKHTLCUpdate; + + + +/** + * A reference to a transaction output. + * + * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32 + * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way. + */ +typedef struct MUST_USE_STRUCT LDKOutPoint { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOutPoint *inner; + bool is_owned; +} LDKOutPoint; + +/** + * An event to be processed by the ChannelManager. + */ +typedef enum LDKMonitorEvent_Tag { + /** + * A monitor event containing an HTLCUpdate. + */ + LDKMonitorEvent_HTLCEvent, + /** + * A monitor event that the Channel's commitment transaction was broadcasted. + */ + LDKMonitorEvent_CommitmentTxBroadcasted, + /** + * Must be last for serialization purposes + */ + LDKMonitorEvent_Sentinel, +} LDKMonitorEvent_Tag; + +typedef struct MUST_USE_STRUCT LDKMonitorEvent { + LDKMonitorEvent_Tag tag; + union { + struct { + struct LDKHTLCUpdate htlc_event; + }; + struct { + struct LDKOutPoint commitment_tx_broadcasted; + }; + }; +} LDKMonitorEvent; + +typedef struct LDKCVec_MonitorEventZ { + struct LDKMonitorEvent *data; + uintptr_t datalen; +} LDKCVec_MonitorEventZ; + + + +/** + * Information about a spendable output to a P2WSH script. See + * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this. + */ +typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDelayedPaymentOutputDescriptor *inner; + bool is_owned; +} LDKDelayedPaymentOutputDescriptor; + + + +/** + * Information about a spendable output to our \"payment key\". See + * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this. + */ +typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeStaticPaymentOutputDescriptor *inner; + bool is_owned; +} LDKStaticPaymentOutputDescriptor; + +/** + * When on-chain outputs are created by rust-lightning (which our counterparty is not able to + * claim at any point in the future) an event is generated which you must track and be able to + * spend on-chain. The information needed to do this is provided in this enum, including the + * outpoint describing which txid and output index is available, the full output which exists at + * that txid/index, and any keys or other information required to sign. + */ +typedef enum LDKSpendableOutputDescriptor_Tag { + /** + * An output to a script which was provided via KeysInterface directly, either from + * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to + * spend it. No secret keys are provided as rust-lightning was never given any key. + * These may include outputs from a transaction punishing our counterparty or claiming an HTLC + * on-chain using the payment preimage or after it has timed out. + */ + LDKSpendableOutputDescriptor_StaticOutput, + /** + * An output to a P2WSH script which can be spent with a single signature after a CSV delay. + * + * The witness in the spending input should be: + * (MINIMALIF standard rule) + * + * Note that the nSequence field in the spending input must be set to to_self_delay + * (which means the transaction is not broadcastable until at least to_self_delay + * blocks after the outpoint confirms). + * + * These are generally the result of a \"revocable\" output to us, spendable only by us unless + * it is an output from an old state which we broadcast (which should never happen). + * + * To derive the delayed_payment key which is used to sign for this input, you must pass the + * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in + * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to + * chan_utils::derive_private_key. The public key can be generated without the secret key + * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in + * Sign::pubkeys(). + * + * To derive the revocation_pubkey provided here (which is used in the witness + * script generation), you must pass the counterparty revocation_basepoint (which appears in the + * call to Sign::ready_channel) and the provided per_commitment point + * to chan_utils::derive_public_revocation_key. + * + * The witness script which is hashed and included in the output script_pubkey may be + * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey + * (derived as above), and the to_self_delay contained here to + * chan_utils::get_revokeable_redeemscript. + */ + LDKSpendableOutputDescriptor_DelayedPaymentOutput, + /** + * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which + * corresponds to the public key in Sign::pubkeys().payment_point). + * The witness in the spending input, is, thus, simply: + * + * + * These are generally the result of our counterparty having broadcast the current state, + * allowing us to claim the non-HTLC-encumbered outputs immediately. + */ + LDKSpendableOutputDescriptor_StaticPaymentOutput, + /** + * Must be last for serialization purposes + */ + LDKSpendableOutputDescriptor_Sentinel, +} LDKSpendableOutputDescriptor_Tag; + +typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { + struct LDKOutPoint outpoint; + struct LDKTxOut output; +} LDKSpendableOutputDescriptor_LDKStaticOutput_Body; + +typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { + LDKSpendableOutputDescriptor_Tag tag; + union { + LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output; + struct { + struct LDKDelayedPaymentOutputDescriptor delayed_payment_output; + }; + struct { + struct LDKStaticPaymentOutputDescriptor static_payment_output; + }; + }; +} LDKSpendableOutputDescriptor; + +typedef struct LDKCVec_SpendableOutputDescriptorZ { + struct LDKSpendableOutputDescriptor *data; + uintptr_t datalen; +} LDKCVec_SpendableOutputDescriptorZ; + +/** + * An Event which you should probably take some action in response to. + * + * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use + * them directly as they don't round-trip exactly (for example FundingGenerationReady is never + * written as it makes no sense to respond to it after reconnecting to peers). + */ +typedef enum LDKEvent_Tag { + /** + * Used to indicate that the client should generate a funding transaction with the given + * parameters and then call ChannelManager::funding_transaction_generated. + * Generated in ChannelManager message handling. + * Note that *all inputs* in the funding transaction must spend SegWit outputs or your + * counterparty can steal your funds! + */ + LDKEvent_FundingGenerationReady, + /** + * Used to indicate that the client may now broadcast the funding transaction it created for a + * channel. Broadcasting such a transaction prior to this event may lead to our counterparty + * trivially stealing all funds in the funding transaction! + */ + LDKEvent_FundingBroadcastSafe, + /** + * Indicates we've received money! Just gotta dig out that payment preimage and feed it to + * ChannelManager::claim_funds to get it.... + * Note that if the preimage is not known or the amount paid is incorrect, you should call + * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid + * network congestion. + * The amount paid should be considered 'incorrect' when it is less than or more than twice + * the amount expected. + * If you fail to call either ChannelManager::claim_funds or + * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be + * automatically failed. + */ + LDKEvent_PaymentReceived, + /** + * Indicates an outbound payment we made succeeded (ie it made it all the way to its target + * and we got back the payment preimage for it). + * Note that duplicative PaymentSent Events may be generated - it is your responsibility to + * deduplicate them by payment_preimage (which MUST be unique)! + */ + LDKEvent_PaymentSent, + /** + * Indicates an outbound payment we made failed. Probably some intermediary node dropped + * something. You may wish to retry with a different route. + * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to + * deduplicate them by payment_hash (which MUST be unique)! + */ + LDKEvent_PaymentFailed, + /** + * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a + * time in the future. + */ + LDKEvent_PendingHTLCsForwardable, + /** + * Used to indicate that an output was generated on-chain which you should know how to spend. + * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your + * counterparty spending them due to some kind of timeout. Thus, you need to store them + * somewhere and spend them when you create on-chain transactions. + */ + LDKEvent_SpendableOutputs, + /** + * Must be last for serialization purposes + */ + LDKEvent_Sentinel, +} LDKEvent_Tag; + +typedef struct LDKEvent_LDKFundingGenerationReady_Body { + struct LDKThirtyTwoBytes temporary_channel_id; + uint64_t channel_value_satoshis; + struct LDKCVec_u8Z output_script; + uint64_t user_channel_id; +} LDKEvent_LDKFundingGenerationReady_Body; + +typedef struct LDKEvent_LDKFundingBroadcastSafe_Body { + struct LDKOutPoint funding_txo; + uint64_t user_channel_id; +} LDKEvent_LDKFundingBroadcastSafe_Body; + +typedef struct LDKEvent_LDKPaymentReceived_Body { + struct LDKThirtyTwoBytes payment_hash; + struct LDKThirtyTwoBytes payment_secret; + uint64_t amt; +} LDKEvent_LDKPaymentReceived_Body; + +typedef struct LDKEvent_LDKPaymentSent_Body { + struct LDKThirtyTwoBytes payment_preimage; +} LDKEvent_LDKPaymentSent_Body; + +typedef struct LDKEvent_LDKPaymentFailed_Body { + struct LDKThirtyTwoBytes payment_hash; + bool rejected_by_dest; +} LDKEvent_LDKPaymentFailed_Body; + +typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { + uint64_t time_forwardable; +} LDKEvent_LDKPendingHTLCsForwardable_Body; + +typedef struct LDKEvent_LDKSpendableOutputs_Body { + struct LDKCVec_SpendableOutputDescriptorZ outputs; +} LDKEvent_LDKSpendableOutputs_Body; + +typedef struct MUST_USE_STRUCT LDKEvent { + LDKEvent_Tag tag; + union { + LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; + LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe; + LDKEvent_LDKPaymentReceived_Body payment_received; + LDKEvent_LDKPaymentSent_Body payment_sent; + LDKEvent_LDKPaymentFailed_Body payment_failed; + LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; + LDKEvent_LDKSpendableOutputs_Body spendable_outputs; + }; +} LDKEvent; + +typedef struct LDKCVec_EventZ { + struct LDKEvent *data; + uintptr_t datalen; +} LDKCVec_EventZ; + +typedef union LDKCResult_OutPointDecodeErrorZPtr { + struct LDKOutPoint *result; + struct LDKDecodeError *err; +} LDKCResult_OutPointDecodeErrorZPtr; + +typedef struct LDKCResult_OutPointDecodeErrorZ { + union LDKCResult_OutPointDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_OutPointDecodeErrorZ; + + + +/** + * An update generated by the underlying Channel itself which contains some new information the + * ChannelMonitor should be made aware of. + */ +typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelMonitorUpdate *inner; + bool is_owned; +} LDKChannelMonitorUpdate; + +typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { + struct LDKChannelMonitorUpdate *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr; + +typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { + union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; + +typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { + struct LDKHTLCUpdate *result; + struct LDKDecodeError *err; +} LDKCResult_HTLCUpdateDecodeErrorZPtr; + +typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { + union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_HTLCUpdateDecodeErrorZ; + + + +/** + * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is + * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this + * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was + * corrupted. + * Contains a developer-readable error message. + */ +typedef struct MUST_USE_STRUCT LDKMonitorUpdateError { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMonitorUpdateError *inner; + bool is_owned; +} LDKMonitorUpdateError; + +typedef union LDKCResult_NoneMonitorUpdateErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + struct LDKMonitorUpdateError *err; +} LDKCResult_NoneMonitorUpdateErrorZPtr; + +typedef struct LDKCResult_NoneMonitorUpdateErrorZ { + union LDKCResult_NoneMonitorUpdateErrorZPtr contents; + bool result_ok; +} LDKCResult_NoneMonitorUpdateErrorZ; + +typedef struct LDKC2Tuple_OutPointScriptZ { + struct LDKOutPoint a; + struct LDKCVec_u8Z b; +} LDKC2Tuple_OutPointScriptZ; + +typedef struct LDKCVec_TransactionZ { + struct LDKTransaction *data; + uintptr_t datalen; +} LDKCVec_TransactionZ; + +typedef struct LDKC2Tuple_u32TxOutZ { + uint32_t a; + struct LDKTxOut b; +} LDKC2Tuple_u32TxOutZ; + +typedef struct LDKCVec_C2Tuple_u32TxOutZZ { + struct LDKC2Tuple_u32TxOutZ *data; + uintptr_t datalen; +} LDKCVec_C2Tuple_u32TxOutZZ; + +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { + struct LDKThirtyTwoBytes a; + struct LDKCVec_C2Tuple_u32TxOutZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; + +typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ { + struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data; + uintptr_t datalen; +} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ; + +typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ { + struct LDKSignature a; + struct LDKCVec_SignatureZ b; +} LDKC2Tuple_SignatureCVec_SignatureZZ; + +typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { + struct LDKC2Tuple_SignatureCVec_SignatureZZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr; + +typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { + union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents; + bool result_ok; +} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; + +typedef union LDKCResult_SignatureNoneZPtr { + struct LDKSignature *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_SignatureNoneZPtr; + +typedef struct LDKCResult_SignatureNoneZ { + union LDKCResult_SignatureNoneZPtr contents; + bool result_ok; +} LDKCResult_SignatureNoneZ; + + + +/** + * The unsigned part of a channel_announcement + */ +typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedChannelAnnouncement *inner; + bool is_owned; +} LDKUnsignedChannelAnnouncement; + +/** + * A trait to sign lightning channel transactions as described in BOLT 3. + * + * Signing services could be implemented on a hardware wallet. In this case, + * the current Sign would be a front-end on top of a communication + * channel connected to your secure device and lightning key material wouldn't + * reside on a hot server. Nevertheless, a this deployment would still need + * to trust the ChannelManager to avoid loss of funds as this latest component + * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys. + * + * A more secure iteration would be to use hashlock (or payment points) to pair + * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager + * at the price of more state and computation on the hardware wallet side. In the future, + * we are looking forward to design such interface. + * + * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted + * to act, as liveness and breach reply correctness are always going to be hard requirements + * of LN security model, orthogonal of key management issues. + */ +typedef struct LDKSign { + void *this_arg; + /** + * Gets the per-commitment point for a specific commitment number + * + * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + */ + struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); + /** + * Gets the commitment secret for a specific commitment number as part of the revocation process + * + * An external signer implementation should error here if the commitment was already signed + * and should refuse to sign it in the future. + * + * May be called more than once for the same index. + * + * 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); + /** + * Gets the holder's channel public keys and basepoints + */ + struct LDKChannelPublicKeys pubkeys; + /** + * Fill in the pubkeys field as a reference to it will be given to Rust after this returns + * Note that this takes a pointer to this object, not the this_ptr like other methods do + * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. + */ + void (*set_pubkeys)(const struct LDKSign*NONNULL_PTR ); + /** + * Gets an arbitrary identifier describing the set of keys which are provided back to you in + * some SpendableOutputDescriptor types. This should be sufficient to identify this + * Sign object uniquely and lookup or re-derive its keys. + */ + struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg); + /** + * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. + * + * Note that if signing fails or is rejected, the channel will be force-closed. + */ + struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx); + /** + * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. + * This will only ever be called with a non-revoked commitment_tx. This will be called with the + * latest commitment_tx when we initiate a force-close. + * This will be called with the previous latest, just to get claiming HTLC signatures, if we are + * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to + * the latest. + * This may be called multiple times for the same transaction. + * + * An external signer implementation should check that the commitment has not been revoked. + * + * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case. + */ + struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); + /** + * Create a signature for the given input in a transaction spending an HTLC or commitment + * transaction output when our counterparty broadcasts an old state. + * + * A justice transaction may claim multiples outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiples time for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * per_commitment_key is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder revocation_secret to do + * so). + * + * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus + * changing the format of the witness script (which is committed to in the BIP 143 + * signatures). + */ + struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(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); + /** + * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment + * transaction, either offered or received. + * + * Such a transaction may claim multiples offered outputs at same time if we know the + * preimage for each when we create it, but only the input at index `input` should be + * signed for here. It may be called multiple times for same output(s) if a fee-bump is + * needed with regards to an upcoming timelock expiration. + * + * Witness_script is either a offered or received script as defined in BOLT3 for HTLC + * outputs. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * Per_commitment_point is the dynamic point corresponding to the channel state + * 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. + */ + struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + /** + * Create a signature for a (proposed) closing transaction. + * + * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have + * chosen to forgo their output as dust. + */ + struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx); + /** + * Signs a channel announcement message with our funding key, proving it comes from one + * of the channel participants. + * + * Note that if this fails or is rejected, the channel will not be publicly announced and + * our counterparty may (though likely will not) close the channel on us for violating the + * protocol. + */ + struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + /** + * Set the counterparty static channel data, including basepoints, + * counterparty_selected/holder_selected_contest_delay and funding outpoint. + * This is done as soon as the funding outpoint is known. Since these are static channel data, + * they MUST NOT be allowed to change to different values once set. + * + * channel_parameters.is_populated() MUST be true. + * + * We bind holder_selected_contest_delay late here for API convenience. + * + * Will be called before any signatures are applied. + */ + void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); + void *(*clone)(const void *this_arg); + struct LDKCVec_u8Z (*write)(const void *this_arg); + void (*free)(void *this_arg); +} LDKSign; + + + +/** + * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates + * on-chain transactions to ensure no loss of funds occurs. + * + * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date + * information and are actively monitoring the chain. + * + * Pending Events or updated HTLCs which have not yet been read out by + * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and + * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events + * gotten are fully handled before re-serializing the new state. + * + * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which + * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along + * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the + * returned block hash and the the current chain and then reconnecting blocks to get to the + * best chain) upon deserializing the object! + */ +typedef struct MUST_USE_STRUCT LDKChannelMonitor { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelMonitor *inner; + bool is_owned; +} LDKChannelMonitor; + +typedef struct LDKC2Tuple_BlockHashChannelMonitorZ { + struct LDKThirtyTwoBytes a; + struct LDKChannelMonitor b; +} LDKC2Tuple_BlockHashChannelMonitorZ; + +typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { + struct LDKC2Tuple_BlockHashChannelMonitorZ *result; + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; + +typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { + union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; + +typedef union LDKCResult_TxOutAccessErrorZPtr { + struct LDKTxOut *result; + enum LDKAccessError *err; +} LDKCResult_TxOutAccessErrorZPtr; + +typedef struct LDKCResult_TxOutAccessErrorZ { + union LDKCResult_TxOutAccessErrorZPtr contents; + bool result_ok; +} LDKCResult_TxOutAccessErrorZ; + +/** + * A Rust str object, ie a reference to a UTF8-valid string. + * This is *not* null-terminated so cannot be used directly as a C string! + */ +typedef struct LDKStr { + const uint8_t *chars; + uintptr_t len; +} LDKStr; + +/** + * Indicates an error on the client's part (usually some variant of attempting to use too-low or + * too-high values) + */ +typedef enum LDKAPIError_Tag { + /** + * Indicates the API was wholly misused (see err for more). Cases where these can be returned + * are documented, but generally indicates some precondition of a function was violated. + */ + LDKAPIError_APIMisuseError, + /** + * Due to a high feerate, we were unable to complete the request. + * For example, this may be returned if the feerate implies we cannot open a channel at the + * requested value, but opening a larger channel would succeed. + */ + LDKAPIError_FeeRateTooHigh, + /** + * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, + * too-many-hops, etc). + */ + LDKAPIError_RouteError, + /** + * We were unable to complete the request as the Channel required to do so is unable to + * complete the request (or was not found). This can take many forms, including disconnected + * peer, channel at capacity, channel shutting down, etc. + */ + LDKAPIError_ChannelUnavailable, + /** + * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the + * attempted action to fail. + */ + LDKAPIError_MonitorUpdateFailed, + /** + * Must be last for serialization purposes + */ + LDKAPIError_Sentinel, +} LDKAPIError_Tag; + +typedef struct LDKAPIError_LDKAPIMisuseError_Body { + struct LDKCVec_u8Z err; +} LDKAPIError_LDKAPIMisuseError_Body; + +typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { + struct LDKCVec_u8Z err; + uint32_t feerate; +} LDKAPIError_LDKFeeRateTooHigh_Body; + +typedef struct LDKAPIError_LDKRouteError_Body { + struct LDKStr err; +} LDKAPIError_LDKRouteError_Body; + +typedef struct LDKAPIError_LDKChannelUnavailable_Body { + struct LDKCVec_u8Z err; +} LDKAPIError_LDKChannelUnavailable_Body; + +typedef struct MUST_USE_STRUCT LDKAPIError { + LDKAPIError_Tag tag; + union { + LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; + LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; + LDKAPIError_LDKRouteError_Body route_error; + LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; + }; +} LDKAPIError; + +typedef union LDKCResult_NoneAPIErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + struct LDKAPIError *err; +} LDKCResult_NoneAPIErrorZPtr; + +typedef struct LDKCResult_NoneAPIErrorZ { + union LDKCResult_NoneAPIErrorZPtr contents; + bool result_ok; +} LDKCResult_NoneAPIErrorZ; + +typedef struct LDKCVec_CResult_NoneAPIErrorZZ { + struct LDKCResult_NoneAPIErrorZ *data; + uintptr_t datalen; +} LDKCVec_CResult_NoneAPIErrorZZ; + +typedef struct LDKCVec_APIErrorZ { + struct LDKAPIError *data; + uintptr_t datalen; +} LDKCVec_APIErrorZ; + + + +/** + * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + */ +typedef struct MUST_USE_STRUCT LDKChannelDetails { /** - * Used to indicate that a node_announcement should be broadcast to all peers. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_BroadcastNodeAnnouncement, + LDKnativeChannelDetails *inner; + bool is_owned; +} LDKChannelDetails; + +typedef struct LDKCVec_ChannelDetailsZ { + struct LDKChannelDetails *data; + uintptr_t datalen; +} LDKCVec_ChannelDetailsZ; + +/** + * If a payment fails to send, it can be in one of several states. This enum is returned as the + * Err() type describing which state the payment is in, see the description of individual enum + * states for more. + */ +typedef enum LDKPaymentSendFailure_Tag { /** - * Used to indicate that a channel_update should be broadcast to all peers. + * A parameter which was passed to send_payment was invalid, preventing us from attempting to + * send the payment at all. No channel state has been changed or messages sent to peers, and + * once you've changed the parameter at error, you can freely retry the payment in full. */ - LDKMessageSendEvent_BroadcastChannelUpdate, + LDKPaymentSendFailure_ParameterError, /** - * Broadcast an error downstream to be handled + * A parameter in a single path which was passed to send_payment was invalid, preventing us + * from attempting to send the payment at all. No channel state has been changed or messages + * sent to peers, and once you've changed the parameter at error, you can freely retry the + * payment in full. + * + * The results here are ordered the same as the paths in the route object which was passed to + * send_payment. */ - LDKMessageSendEvent_HandleError, + LDKPaymentSendFailure_PathParameterError, /** - * When a payment fails we may receive updates back from the hop where it failed. In such - * cases this event is generated so that we can inform the network graph of this information. + * All paths which were attempted failed to send, with no channel state change taking place. + * You can freely retry the payment in full (though you probably want to do so over different + * paths than the ones selected). */ - LDKMessageSendEvent_PaymentFailureNetworkUpdate, + LDKPaymentSendFailure_AllFailedRetrySafe, + /** + * Some paths which were attempted failed to send, though possibly not all. At least some + * paths have irrevocably committed to the HTLC and retrying the payment in full would result + * in over-/re-payment. + * + * The results here are ordered the same as the paths in the route object which was passed to + * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely + * retried (though there is currently no API with which to do so). + * + * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried + * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the + * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel + * with the latest update_id. + */ + LDKPaymentSendFailure_PartialFailure, + /** + * Must be last for serialization purposes + */ + LDKPaymentSendFailure_Sentinel, +} LDKPaymentSendFailure_Tag; + +typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { + LDKPaymentSendFailure_Tag tag; + union { + struct { + struct LDKAPIError parameter_error; + }; + struct { + struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; + }; + struct { + struct LDKCVec_APIErrorZ all_failed_retry_safe; + }; + struct { + struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure; + }; + }; +} LDKPaymentSendFailure; + +typedef union LDKCResult_NonePaymentSendFailureZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + struct LDKPaymentSendFailure *err; +} LDKCResult_NonePaymentSendFailureZPtr; + +typedef struct LDKCResult_NonePaymentSendFailureZ { + union LDKCResult_NonePaymentSendFailureZPtr contents; + bool result_ok; +} LDKCResult_NonePaymentSendFailureZ; + +typedef struct LDKCVec_ChannelMonitorZ { + struct LDKChannelMonitor *data; + uintptr_t datalen; +} LDKCVec_ChannelMonitorZ; + +/** + * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as + * blocks are connected and disconnected. + * + * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are + * responsible for maintaining a set of monitors such that they can be updated accordingly as + * channel state changes and HTLCs are resolved. See method documentation for specific + * requirements. + * + * Implementations **must** ensure that updates are successfully applied and persisted upon method + * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down + * without taking any further action such as persisting the current state. + * + * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing + * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it + * could result in a revoked transaction being broadcast, allowing the counterparty to claim all + * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle + * multiple instances. + * + * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html + * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html + * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure + */ +typedef struct LDKWatch { + void *this_arg; + /** + * Watches a channel identified by `funding_txo` using `monitor`. + * + * Implementations are responsible for watching the chain for the funding transaction along + * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means + * calling [`block_connected`] and [`block_disconnected`] on the monitor. + * + * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch + * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected + * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected + */ + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + /** + * Updates a channel identified by `funding_txo` by applying `update` to its monitor. + * + * Implementations must call [`update_monitor`] with the given update. See + * [`ChannelMonitorUpdateErr`] for invariants around returning an error. + * + * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor + * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html + */ + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); + /** + * Returns any monitor events since the last call. Subsequent calls must only return new + * events. + */ + struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); + void (*free)(void *this_arg); +} LDKWatch; + +/** + * An interface to send a transaction to the Bitcoin network. + */ +typedef struct LDKBroadcasterInterface { + void *this_arg; + /** + * Sends a transaction out to (hopefully) be mined. + */ + void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); + void (*free)(void *this_arg); +} LDKBroadcasterInterface; + +typedef union LDKCResult_SignDecodeErrorZPtr { + struct LDKSign *result; + struct LDKDecodeError *err; +} LDKCResult_SignDecodeErrorZPtr; + +typedef struct LDKCResult_SignDecodeErrorZ { + union LDKCResult_SignDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_SignDecodeErrorZ; + +typedef struct LDKu8slice { + const uint8_t *data; + uintptr_t datalen; +} LDKu8slice; + +/** + * A trait to describe an object which can get user secrets and key material. + */ +typedef struct LDKKeysInterface { + void *this_arg; + /** + * Get node secret key (aka node_id or network_key). + * + * This method must return the same value each time it is called. + */ + struct LDKSecretKey (*get_node_secret)(const void *this_arg); + /** + * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. + */ + struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); + /** + * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing + * a channel. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. + */ + struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg); + /** + * Get a new set of Sign for per-channel secrets. These MUST be unique even if you + * restarted with some stale data! + * + * This method must return a different value each time it is called. + */ + struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); + /** + * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting + * onion packets and for temporary channel IDs. There is no requirement that these be + * persisted anywhere, though they must be unique across restarts. + * + * This method must return a different value each time it is called. + */ + struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); + /** + * Reads a `Signer` for this `KeysInterface` from the given input stream. + * This is only called during deserialization of other objects which contain + * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). + * The bytes are exactly those which `::write()` writes, and + * contain no versioning scheme. You may wish to include your own version prefix and ensure + * you've read all of the provided bytes to ensure no corruption occurred. + */ + struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + void (*free)(void *this_arg); +} LDKKeysInterface; + +/** + * A trait which should be implemented to provide feerate information on a number of time + * horizons. + * + * 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). + */ +typedef struct LDKFeeEstimator { + void *this_arg; + /** + * Gets estimated satoshis of fee required per 1000 Weight-Units. + * + * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs + * don't put us below 1 satoshi-per-byte). + * + * This translates to: + * * satoshis-per-byte * 250 + * * ceil(satoshis-per-kbyte / 4) + */ + uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); + void (*free)(void *this_arg); +} LDKFeeEstimator; + +/** + * A trait encapsulating the operations required of a logger + */ +typedef struct LDKLogger { + void *this_arg; + /** + * Logs the `Record` + */ + void (*log)(const void *this_arg, const char *record); + void (*free)(void *this_arg); +} LDKLogger; + + + +/** + * Manager which keeps track of a number of channels and sends messages to the appropriate + * channel, also tracking HTLC preimages and forwarding onion packets appropriately. + * + * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through + * to individual Channels. + * + * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for + * all peers during write/read (though does not modify this instance, only the instance being + * serialized). This will result in any channels which have not yet exchanged funding_created (ie + * called funding_transaction_generated for outbound channels). + * + * Note that you can be a bit lazier about writing out ChannelManager than you can be with + * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before + * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates + * happens out-of-band (and will prevent any other ChannelManager operations from occurring during + * the serialization process). If the deserialized version is out-of-date compared to the + * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the + * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). + * + * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which + * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along + * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call + * block_connected() to step towards your best block) upon deserialization before using the + * object! + * + * Note that 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_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect. + * + * 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. + */ +typedef struct MUST_USE_STRUCT LDKChannelManager { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelManager *inner; + bool is_owned; +} LDKChannelManager; + +typedef struct LDKC2Tuple_BlockHashChannelManagerZ { + struct LDKThirtyTwoBytes a; + struct LDKChannelManager b; +} LDKC2Tuple_BlockHashChannelManagerZ; + +typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { + struct LDKC2Tuple_BlockHashChannelManagerZ *result; + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr; + +typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { + union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; + +typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr { + struct LDKSpendableOutputDescriptor *result; + struct LDKDecodeError *err; +} LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr; + +typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ { + union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_SpendableOutputDescriptorDecodeErrorZ; + +typedef struct LDKCVec_CVec_u8ZZ { + struct LDKCVec_u8Z *data; + uintptr_t datalen; +} LDKCVec_CVec_u8ZZ; + +typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr { + struct LDKCVec_CVec_u8ZZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_CVec_u8ZZNoneZPtr; + +typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { + union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents; + bool result_ok; +} LDKCResult_CVec_CVec_u8ZZNoneZ; + + + +/** + * A simple implementation of Sign that just keeps the private keys in memory. + * + * This implementation performs no policy checks and is insufficient by itself as + * a secure external signer. + */ +typedef struct MUST_USE_STRUCT LDKInMemorySigner { /** - * Query a peer for channels with funding transaction UTXOs in a block range. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendChannelRangeQuery, + LDKnativeInMemorySigner *inner; + bool is_owned; +} LDKInMemorySigner; + +typedef union LDKCResult_InMemorySignerDecodeErrorZPtr { + struct LDKInMemorySigner *result; + struct LDKDecodeError *err; +} LDKCResult_InMemorySignerDecodeErrorZPtr; + +typedef struct LDKCResult_InMemorySignerDecodeErrorZ { + union LDKCResult_InMemorySignerDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_InMemorySignerDecodeErrorZ; + +typedef struct LDKCVec_TxOutZ { + struct LDKTxOut *data; + uintptr_t datalen; +} LDKCVec_TxOutZ; + +typedef union LDKCResult_TransactionNoneZPtr { + struct LDKTransaction *result; /** - * Request routing gossip messages from a peer for a list of channels identified by - * their short_channel_ids. + * Note that this value is always NULL, as there are no contents in the Err variant */ - LDKMessageSendEvent_SendShortIdsQuery, + void *err; +} LDKCResult_TransactionNoneZPtr; + +typedef struct LDKCResult_TransactionNoneZ { + union LDKCResult_TransactionNoneZPtr contents; + bool result_ok; +} LDKCResult_TransactionNoneZ; + + + +/** + * A hop in a route + */ +typedef struct MUST_USE_STRUCT LDKRouteHop { /** - * Must be last for serialization purposes + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_Sentinel, -} LDKMessageSendEvent_Tag; + LDKnativeRouteHop *inner; + bool is_owned; +} LDKRouteHop; -typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { - struct LDKPublicKey node_id; - struct LDKAcceptChannel msg; -} LDKMessageSendEvent_LDKSendAcceptChannel_Body; +typedef struct LDKCVec_RouteHopZ { + struct LDKRouteHop *data; + uintptr_t datalen; +} LDKCVec_RouteHopZ; -typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { - struct LDKPublicKey node_id; - struct LDKOpenChannel msg; -} LDKMessageSendEvent_LDKSendOpenChannel_Body; +typedef struct LDKCVec_CVec_RouteHopZZ { + struct LDKCVec_RouteHopZ *data; + uintptr_t datalen; +} LDKCVec_CVec_RouteHopZZ; -typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { - struct LDKPublicKey node_id; - struct LDKFundingCreated msg; -} LDKMessageSendEvent_LDKSendFundingCreated_Body; -typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { - struct LDKPublicKey node_id; - struct LDKFundingSigned msg; -} LDKMessageSendEvent_LDKSendFundingSigned_Body; -typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { - struct LDKPublicKey node_id; - struct LDKFundingLocked msg; -} LDKMessageSendEvent_LDKSendFundingLocked_Body; +/** + * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP, + * it can take multiple paths. Each path is composed of one or more hops through the network. + */ +typedef struct MUST_USE_STRUCT LDKRoute { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRoute *inner; + bool is_owned; +} LDKRoute; -typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { - struct LDKPublicKey node_id; - struct LDKAnnouncementSignatures msg; -} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; +typedef union LDKCResult_RouteDecodeErrorZPtr { + struct LDKRoute *result; + struct LDKDecodeError *err; +} LDKCResult_RouteDecodeErrorZPtr; -typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body { - struct LDKPublicKey node_id; - struct LDKCommitmentUpdate updates; -} LDKMessageSendEvent_LDKUpdateHTLCs_Body; +typedef struct LDKCResult_RouteDecodeErrorZ { + union LDKCResult_RouteDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_RouteDecodeErrorZ; -typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body { - struct LDKPublicKey node_id; - struct LDKRevokeAndACK msg; -} LDKMessageSendEvent_LDKSendRevokeAndACK_Body; -typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { - struct LDKPublicKey node_id; - struct LDKClosingSigned msg; -} LDKMessageSendEvent_LDKSendClosingSigned_Body; -typedef struct LDKMessageSendEvent_LDKSendShutdown_Body { - struct LDKPublicKey node_id; - struct LDKShutdown msg; -} LDKMessageSendEvent_LDKSendShutdown_Body; +/** + * A channel descriptor which provides a last-hop route to get_route + */ +typedef struct MUST_USE_STRUCT LDKRouteHint { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteHint *inner; + bool is_owned; +} LDKRouteHint; -typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body { - struct LDKPublicKey node_id; - struct LDKChannelReestablish msg; -} LDKMessageSendEvent_LDKSendChannelReestablish_Body; +typedef struct LDKCVec_RouteHintZ { + struct LDKRouteHint *data; + uintptr_t datalen; +} LDKCVec_RouteHintZ; -typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { - struct LDKChannelAnnouncement msg; - struct LDKChannelUpdate update_msg; -} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; +typedef union LDKCResult_RouteLightningErrorZPtr { + struct LDKRoute *result; + struct LDKLightningError *err; +} LDKCResult_RouteLightningErrorZPtr; -typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body { - struct LDKNodeAnnouncement msg; -} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body; +typedef struct LDKCResult_RouteLightningErrorZ { + union LDKCResult_RouteLightningErrorZPtr contents; + bool result_ok; +} LDKCResult_RouteLightningErrorZ; -typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { - struct LDKChannelUpdate msg; -} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body; +typedef union LDKCResult_NetAddressu8ZPtr { + struct LDKNetAddress *result; + uint8_t *err; +} LDKCResult_NetAddressu8ZPtr; -typedef struct LDKMessageSendEvent_LDKHandleError_Body { - struct LDKPublicKey node_id; - struct LDKErrorAction action; -} LDKMessageSendEvent_LDKHandleError_Body; +typedef struct LDKCResult_NetAddressu8Z { + union LDKCResult_NetAddressu8ZPtr contents; + bool result_ok; +} LDKCResult_NetAddressu8Z; -typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body { - struct LDKHTLCFailChannelUpdate update; -} LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body; +typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr { + struct LDKCResult_NetAddressu8Z *result; + struct LDKDecodeError *err; +} LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr; -typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { - struct LDKPublicKey node_id; - struct LDKQueryChannelRange msg; -} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; +typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ { + union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_CResult_NetAddressu8ZDecodeErrorZ; -typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body { - struct LDKPublicKey node_id; - struct LDKQueryShortChannelIds msg; -} LDKMessageSendEvent_LDKSendShortIdsQuery_Body; -typedef struct MUST_USE_STRUCT LDKMessageSendEvent { - LDKMessageSendEvent_Tag tag; - union { - LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel; - LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel; - LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created; - LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed; - LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked; - LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures; - LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs; - LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack; - LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed; - LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown; - LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish; - LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement; - LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement; - LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update; - LDKMessageSendEvent_LDKHandleError_Body handle_error; - LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update; - LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query; - LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query; - }; -} LDKMessageSendEvent; -typedef struct LDKCVecTempl_MessageSendEvent { - struct LDKMessageSendEvent *data; +/** + * An update_add_htlc message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUpdateAddHTLC *inner; + bool is_owned; +} LDKUpdateAddHTLC; + +typedef struct LDKCVec_UpdateAddHTLCZ { + struct LDKUpdateAddHTLC *data; uintptr_t datalen; -} LDKCVecTempl_MessageSendEvent; +} LDKCVec_UpdateAddHTLCZ; + -typedef struct LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ; /** - * A trait indicating an object may generate message send events + * An update_fulfill_htlc message to be sent or received from a peer */ -typedef struct LDKMessageSendEventsProvider { - void *this_arg; +typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC { /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); - void (*free)(void *this_arg); -} LDKMessageSendEventsProvider; + LDKnativeUpdateFulfillHTLC *inner; + bool is_owned; +} LDKUpdateFulfillHTLC; -typedef struct LDKCVecTempl_Event { - struct LDKEvent *data; +typedef struct LDKCVec_UpdateFulfillHTLCZ { + struct LDKUpdateFulfillHTLC *data; uintptr_t datalen; -} LDKCVecTempl_Event; +} LDKCVec_UpdateFulfillHTLCZ; + -typedef struct LDKCVecTempl_Event LDKCVec_EventZ; /** - * A trait indicating an object may generate events + * An update_fail_htlc message to be sent or received from a peer */ -typedef struct LDKEventsProvider { - void *this_arg; +typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC { /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg); - void (*free)(void *this_arg); -} LDKEventsProvider; + LDKnativeUpdateFailHTLC *inner; + bool is_owned; +} LDKUpdateFailHTLC; + +typedef struct LDKCVec_UpdateFailHTLCZ { + struct LDKUpdateFailHTLC *data; + uintptr_t datalen; +} LDKCVec_UpdateFailHTLCZ; /** - * Configuration we set when applicable. - * - * Default::default() provides sane defaults. + * An update_fail_malformed_htlc message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig { +typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelHandshakeConfig *inner; + LDKnativeUpdateFailMalformedHTLC *inner; bool is_owned; -} LDKChannelHandshakeConfig; +} LDKUpdateFailMalformedHTLC; +typedef struct LDKCVec_UpdateFailMalformedHTLCZ { + struct LDKUpdateFailMalformedHTLC *data; + uintptr_t datalen; +} LDKCVec_UpdateFailMalformedHTLCZ; +typedef union LDKCResult_AcceptChannelDecodeErrorZPtr { + struct LDKAcceptChannel *result; + struct LDKDecodeError *err; +} LDKCResult_AcceptChannelDecodeErrorZPtr; -/** - * Optional channel limits which are applied during channel creation. - * - * These limits are only applied to our counterparty's limits, not our own. - * - * Use 0/::max_value() as appropriate to skip checking. - * - * 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. +typedef struct LDKCResult_AcceptChannelDecodeErrorZ { + union LDKCResult_AcceptChannelDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_AcceptChannelDecodeErrorZ; + +typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr { + struct LDKAnnouncementSignatures *result; + struct LDKDecodeError *err; +} LDKCResult_AnnouncementSignaturesDecodeErrorZPtr; + +typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ { + union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_AnnouncementSignaturesDecodeErrorZ; + +typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr { + struct LDKChannelReestablish *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelReestablishDecodeErrorZPtr; + +typedef struct LDKCResult_ChannelReestablishDecodeErrorZ { + union LDKCResult_ChannelReestablishDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelReestablishDecodeErrorZ; + +typedef union LDKCResult_ClosingSignedDecodeErrorZPtr { + struct LDKClosingSigned *result; + struct LDKDecodeError *err; +} LDKCResult_ClosingSignedDecodeErrorZPtr; + +typedef struct LDKCResult_ClosingSignedDecodeErrorZ { + union LDKCResult_ClosingSignedDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ClosingSignedDecodeErrorZ; + + + +/** + * A commitment_signed message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits { +typedef struct MUST_USE_STRUCT LDKCommitmentSigned { /** * Nearly everywhere, 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; + LDKnativeCommitmentSigned *inner; bool is_owned; -} LDKChannelHandshakeLimits; +} LDKCommitmentSigned; + +typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr { + struct LDKCommitmentSigned *result; + struct LDKDecodeError *err; +} LDKCResult_CommitmentSignedDecodeErrorZPtr; + +typedef struct LDKCResult_CommitmentSignedDecodeErrorZ { + union LDKCResult_CommitmentSignedDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_CommitmentSignedDecodeErrorZ; + +typedef union LDKCResult_FundingCreatedDecodeErrorZPtr { + struct LDKFundingCreated *result; + struct LDKDecodeError *err; +} LDKCResult_FundingCreatedDecodeErrorZPtr; + +typedef struct LDKCResult_FundingCreatedDecodeErrorZ { + union LDKCResult_FundingCreatedDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_FundingCreatedDecodeErrorZ; + +typedef union LDKCResult_FundingSignedDecodeErrorZPtr { + struct LDKFundingSigned *result; + struct LDKDecodeError *err; +} LDKCResult_FundingSignedDecodeErrorZPtr; + +typedef struct LDKCResult_FundingSignedDecodeErrorZ { + union LDKCResult_FundingSignedDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_FundingSignedDecodeErrorZ; + +typedef union LDKCResult_FundingLockedDecodeErrorZPtr { + struct LDKFundingLocked *result; + struct LDKDecodeError *err; +} LDKCResult_FundingLockedDecodeErrorZPtr; + +typedef struct LDKCResult_FundingLockedDecodeErrorZ { + union LDKCResult_FundingLockedDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_FundingLockedDecodeErrorZ; /** - * Options which apply on a per-channel basis and may change at runtime or based on negotiation - * with our counterparty. + * An init message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChannelConfig { +typedef struct MUST_USE_STRUCT LDKInit { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelConfig *inner; + LDKnativeInit *inner; bool is_owned; -} LDKChannelConfig; +} LDKInit; + +typedef union LDKCResult_InitDecodeErrorZPtr { + struct LDKInit *result; + struct LDKDecodeError *err; +} LDKCResult_InitDecodeErrorZPtr; + +typedef struct LDKCResult_InitDecodeErrorZ { + union LDKCResult_InitDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_InitDecodeErrorZ; + +typedef union LDKCResult_OpenChannelDecodeErrorZPtr { + struct LDKOpenChannel *result; + struct LDKDecodeError *err; +} LDKCResult_OpenChannelDecodeErrorZPtr; + +typedef struct LDKCResult_OpenChannelDecodeErrorZ { + union LDKCResult_OpenChannelDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_OpenChannelDecodeErrorZ; + +typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr { + struct LDKRevokeAndACK *result; + struct LDKDecodeError *err; +} LDKCResult_RevokeAndACKDecodeErrorZPtr; + +typedef struct LDKCResult_RevokeAndACKDecodeErrorZ { + union LDKCResult_RevokeAndACKDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_RevokeAndACKDecodeErrorZ; + +typedef union LDKCResult_ShutdownDecodeErrorZPtr { + struct LDKShutdown *result; + struct LDKDecodeError *err; +} LDKCResult_ShutdownDecodeErrorZPtr; + +typedef struct LDKCResult_ShutdownDecodeErrorZ { + union LDKCResult_ShutdownDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ShutdownDecodeErrorZ; + +typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr { + struct LDKUpdateFailHTLC *result; + struct LDKDecodeError *err; +} LDKCResult_UpdateFailHTLCDecodeErrorZPtr; + +typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ { + union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UpdateFailHTLCDecodeErrorZ; + +typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr { + struct LDKUpdateFailMalformedHTLC *result; + struct LDKDecodeError *err; +} LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr; + +typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ { + union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ; /** - * Top-level config which holds ChannelHandshakeLimits and ChannelConfig. - * - * Default::default() provides sane defaults for most configurations - * (but currently with 0 relay fees!) + * An update_fee message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKUserConfig { +typedef struct MUST_USE_STRUCT LDKUpdateFee { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUserConfig *inner; + LDKnativeUpdateFee *inner; bool is_owned; -} LDKUserConfig; +} LDKUpdateFee; -typedef union LDKCResultPtr_TxOut__AccessError { - struct LDKTxOut *result; - enum LDKAccessError *err; -} LDKCResultPtr_TxOut__AccessError; +typedef union LDKCResult_UpdateFeeDecodeErrorZPtr { + struct LDKUpdateFee *result; + struct LDKDecodeError *err; +} LDKCResult_UpdateFeeDecodeErrorZPtr; -typedef struct LDKCResultTempl_TxOut__AccessError { - union LDKCResultPtr_TxOut__AccessError contents; +typedef struct LDKCResult_UpdateFeeDecodeErrorZ { + union LDKCResult_UpdateFeeDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_TxOut__AccessError; +} LDKCResult_UpdateFeeDecodeErrorZ; -typedef struct LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ; +typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr { + struct LDKUpdateFulfillHTLC *result; + struct LDKDecodeError *err; +} LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr; + +typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ { + union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UpdateFulfillHTLCDecodeErrorZ; + +typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr { + struct LDKUpdateAddHTLC *result; + struct LDKDecodeError *err; +} LDKCResult_UpdateAddHTLCDecodeErrorZPtr; + +typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ { + union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UpdateAddHTLCDecodeErrorZ; -/** - * The `Access` trait defines behavior for accessing chain data and state, such as blocks and - * UTXOs. - */ -typedef struct LDKAccess { - void *this_arg; - /** - * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. - * Returns an error if `genesis_hash` is for a different chain or if such a transaction output - * is unknown. - * - * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id - */ - LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); - void (*free)(void *this_arg); -} LDKAccess; -/** - * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to - * channels. - * - * This is useful in order to have a [`Watch`] implementation convey to a chain source which - * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in - * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If - * receiving full blocks from a chain source, any further filtering is unnecessary. - * - * After an output has been registered, subsequent block retrievals from the chain source must not - * exclude any transactions matching the new criteria nor any in-block descendants of such - * transactions. - * - * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter` - * should not block on I/O. Implementations should instead queue the newly monitored data to be - * processed later. Then, in order to block until the data has been processed, any `Watch` - * invocation that has called the `Filter` must return [`TemporaryFailure`]. - * - * [`Watch`]: trait.Watch.html - * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure - * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki - * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki - */ -typedef struct LDKFilter { - void *this_arg; - /** - * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as - * a spending condition. - */ - void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey); - /** - * Registers interest in spends of a transaction output identified by `outpoint` having - * `script_pubkey` as the spending condition. - */ - void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey); - void (*free)(void *this_arg); -} LDKFilter; /** - * `Persist` defines behavior for persisting channel monitors: this could mean - * writing once to disk, and/or uploading to one or more backup services. - * - * Note that for every new monitor, you **must** persist the new `ChannelMonitor` - * to disk/backups. And, on every update, you **must** persist either the - * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk - * of situations such as revoking a transaction, then crashing before this - * revocation can be persisted, then unintentionally broadcasting a revoked - * transaction and losing money. This is a risk because previous channel states - * are toxic, so it's important that whatever channel state is persisted is - * kept up-to-date. + * A ping message to be sent or received from a peer */ -typedef struct LDKPersist { - void *this_arg; - /** - * Persist a new channel's data. The data can be stored any way you want, but - * the identifier provided by Rust-Lightning is the channel's outpoint (and - * it is up to you to maintain a correct mapping between the outpoint and the - * stored channel data). Note that you **must** persist every new monitor to - * disk. See the `Persist` trait documentation for more details. - * - * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`, - * and [`ChannelMonitorUpdateErr`] for requirements when returning errors. - * - * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk - * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html - */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data); +typedef struct MUST_USE_STRUCT LDKPing { /** - * 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. - * - * 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)`. - * - * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`, - * [`ChannelMonitorUpdate::write`] for writing out an update, and - * [`ChannelMonitorUpdateErr`] for requirements when returning errors. - * - * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1 - * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk - * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write - * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data); - void (*free)(void *this_arg); -} LDKPersist; + LDKnativePing *inner; + bool is_owned; +} LDKPing; + +typedef union LDKCResult_PingDecodeErrorZPtr { + struct LDKPing *result; + struct LDKDecodeError *err; +} LDKCResult_PingDecodeErrorZPtr; + +typedef struct LDKCResult_PingDecodeErrorZ { + union LDKCResult_PingDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_PingDecodeErrorZ; /** - * 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. - * - * [`chain::Watch`]: ../trait.Watch.html - * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html - * [module-level documentation]: index.html + * A pong message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChainMonitor { +typedef struct MUST_USE_STRUCT LDKPong { /** * Nearly everywhere, 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; + LDKnativePong *inner; bool is_owned; -} LDKChainMonitor; +} LDKPong; -typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction { - struct LDKC2TupleTempl_usize__Transaction *data; - uintptr_t datalen; -} LDKCVecTempl_C2TupleTempl_usize__Transaction; +typedef union LDKCResult_PongDecodeErrorZPtr { + struct LDKPong *result; + struct LDKDecodeError *err; +} LDKCResult_PongDecodeErrorZPtr; -typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ; +typedef struct LDKCResult_PongDecodeErrorZ { + union LDKCResult_PongDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_PongDecodeErrorZ; -typedef union LDKCResultPtr_ChannelMonitorUpdate__DecodeError { - struct LDKChannelMonitorUpdate *result; +typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr { + struct LDKUnsignedChannelAnnouncement *result; struct LDKDecodeError *err; -} LDKCResultPtr_ChannelMonitorUpdate__DecodeError; +} LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr; -typedef struct LDKCResultTempl_ChannelMonitorUpdate__DecodeError { - union LDKCResultPtr_ChannelMonitorUpdate__DecodeError contents; +typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ { + union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_ChannelMonitorUpdate__DecodeError; +} LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ; + +typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr { + struct LDKChannelAnnouncement *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelAnnouncementDecodeErrorZPtr; -typedef struct LDKCResultTempl_ChannelMonitorUpdate__DecodeError LDKCResult_ChannelMonitorUpdateDecodeErrorZ; +typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ { + union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelAnnouncementDecodeErrorZ; /** - * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on - * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the - * preimage claim backward will lead to loss of funds. - * - * [`chain::Watch`]: ../trait.Watch.html + * The unsigned part of a channel_update */ -typedef struct MUST_USE_STRUCT LDKHTLCUpdate { +typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeHTLCUpdate *inner; + LDKnativeUnsignedChannelUpdate *inner; bool is_owned; -} LDKHTLCUpdate; - -typedef struct LDKCVecTempl_Transaction { - struct LDKTransaction *data; - uintptr_t datalen; -} LDKCVecTempl_Transaction; - -typedef struct LDKCVecTempl_Transaction LDKCVec_TransactionZ; +} LDKUnsignedChannelUpdate; -typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut { - struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut *data; - uintptr_t datalen; -} LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut; +typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr { + struct LDKUnsignedChannelUpdate *result; + struct LDKDecodeError *err; +} LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr; -typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ; +typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ { + union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UnsignedChannelUpdateDecodeErrorZ; -typedef union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError { - struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor *result; +typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr { + struct LDKChannelUpdate *result; struct LDKDecodeError *err; -} LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError; +} LDKCResult_ChannelUpdateDecodeErrorZPtr; -typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError { - union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError contents; +typedef struct LDKCResult_ChannelUpdateDecodeErrorZ { + union LDKCResult_ChannelUpdateDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError; +} LDKCResult_ChannelUpdateDecodeErrorZ; -typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; - -typedef union LDKCResultPtr_SpendableOutputDescriptor__DecodeError { - struct LDKSpendableOutputDescriptor *result; +typedef union LDKCResult_ErrorMessageDecodeErrorZPtr { + struct LDKErrorMessage *result; struct LDKDecodeError *err; -} LDKCResultPtr_SpendableOutputDescriptor__DecodeError; +} LDKCResult_ErrorMessageDecodeErrorZPtr; -typedef struct LDKCResultTempl_SpendableOutputDescriptor__DecodeError { - union LDKCResultPtr_SpendableOutputDescriptor__DecodeError contents; +typedef struct LDKCResult_ErrorMessageDecodeErrorZ { + union LDKCResult_ErrorMessageDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_SpendableOutputDescriptor__DecodeError; - -typedef struct LDKCResultTempl_SpendableOutputDescriptor__DecodeError LDKCResult_SpendableOutputDescriptorDecodeErrorZ; +} LDKCResult_ErrorMessageDecodeErrorZ; /** - * A simple implementation of ChannelKeys that just keeps the private keys in memory. - * - * This implementation performs no policy checks and is insufficient by itself as - * a secure external signer. + * The unsigned part of a node_announcement */ -typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys { +typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInMemoryChannelKeys *inner; + LDKnativeUnsignedNodeAnnouncement *inner; bool is_owned; -} LDKInMemoryChannelKeys; +} LDKUnsignedNodeAnnouncement; -typedef union LDKCResultPtr_InMemoryChannelKeys__DecodeError { - struct LDKInMemoryChannelKeys *result; +typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr { + struct LDKUnsignedNodeAnnouncement *result; struct LDKDecodeError *err; -} LDKCResultPtr_InMemoryChannelKeys__DecodeError; +} LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr; -typedef struct LDKCResultTempl_InMemoryChannelKeys__DecodeError { - union LDKCResultPtr_InMemoryChannelKeys__DecodeError contents; +typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ { + union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_InMemoryChannelKeys__DecodeError; +} LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ; -typedef struct LDKCResultTempl_InMemoryChannelKeys__DecodeError LDKCResult_InMemoryChannelKeysDecodeErrorZ; +typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr { + struct LDKNodeAnnouncement *result; + struct LDKDecodeError *err; +} LDKCResult_NodeAnnouncementDecodeErrorZPtr; +typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ { + union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_NodeAnnouncementDecodeErrorZ; +typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr { + struct LDKQueryShortChannelIds *result; + struct LDKDecodeError *err; +} LDKCResult_QueryShortChannelIdsDecodeErrorZPtr; -/** - * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key - * and derives keys from that. - * - * Your node_id is seed/0' - * ChannelMonitor closes may use seed/1' - * Cooperative closes may use seed/2' - * The two close keys may be needed to claim on-chain funds! - */ -typedef struct MUST_USE_STRUCT LDKKeysManager { - /** - * Nearly everywhere, 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; - bool is_owned; -} LDKKeysManager; +typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ { + union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_QueryShortChannelIdsDecodeErrorZ; /** - * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + * A reply_short_channel_ids_end message is sent as a reply to a + * query_short_channel_ids message. The query recipient makes a best + * effort to respond based on their local network view which may not be + * a perfect view of the network. */ -typedef struct MUST_USE_STRUCT LDKChannelDetails { +typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelDetails *inner; + LDKnativeReplyShortChannelIdsEnd *inner; bool is_owned; -} LDKChannelDetails; +} LDKReplyShortChannelIdsEnd; + +typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr { + struct LDKReplyShortChannelIdsEnd *result; + struct LDKDecodeError *err; +} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr; + +typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ { + union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ; + +typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr { + struct LDKQueryChannelRange *result; + struct LDKDecodeError *err; +} LDKCResult_QueryChannelRangeDecodeErrorZPtr; + +typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ { + union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_QueryChannelRangeDecodeErrorZ; /** - * Features used within an `init` message. + * A reply_channel_range message is a reply to a query_channel_range + * message. Multiple reply_channel_range messages can be sent in reply + * to a single query_channel_range message. The query recipient makes a + * best effort to respond based on their local network view which may + * not be a perfect view of the network. The short_channel_ids in the + * reply are encoded. We only support encoding_type=0 uncompressed + * serialization and do not support encoding_type=1 zlib serialization. */ -typedef struct MUST_USE_STRUCT LDKInitFeatures { +typedef struct MUST_USE_STRUCT LDKReplyChannelRange { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInitFeatures *inner; + LDKnativeReplyChannelRange *inner; bool is_owned; -} LDKInitFeatures; +} LDKReplyChannelRange; -typedef struct LDKCVecTempl_ChannelDetails { - struct LDKChannelDetails *data; - uintptr_t datalen; -} LDKCVecTempl_ChannelDetails; +typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr { + struct LDKReplyChannelRange *result; + struct LDKDecodeError *err; +} LDKCResult_ReplyChannelRangeDecodeErrorZPtr; -typedef struct LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ; +typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ { + union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ReplyChannelRangeDecodeErrorZ; /** - * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP, - * it can take multiple paths. Each path is composed of one or more hops through the network. + * A gossip_timestamp_filter message is used by a node to request + * gossip relay for messages in the requested time range when the + * gossip_queries feature has been negotiated. */ -typedef struct MUST_USE_STRUCT LDKRoute { +typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeRoute *inner; + LDKnativeGossipTimestampFilter *inner; bool is_owned; -} LDKRoute; - -typedef struct LDKThreeBytes { - uint8_t data[3]; -} LDKThreeBytes; - -typedef struct LDKFourBytes { - uint8_t data[4]; -} LDKFourBytes; +} LDKGossipTimestampFilter; -typedef struct LDKSixteenBytes { - uint8_t data[16]; -} LDKSixteenBytes; +typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr { + struct LDKGossipTimestampFilter *result; + struct LDKDecodeError *err; +} LDKCResult_GossipTimestampFilterDecodeErrorZPtr; -typedef struct LDKTenBytes { - uint8_t data[10]; -} LDKTenBytes; +typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ { + union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_GossipTimestampFilterDecodeErrorZ; /** - * An address which can be used to connect to a remote peer + * A trait indicating an object may generate message send events */ -typedef enum LDKNetAddress_Tag { - /** - * An IPv4 address/port on which the peer is listening. - */ - LDKNetAddress_IPv4, - /** - * An IPv6 address/port on which the peer is listening. - */ - LDKNetAddress_IPv6, - /** - * An old-style Tor onion address/port on which the peer is listening. - */ - LDKNetAddress_OnionV2, +typedef struct LDKMessageSendEventsProvider { + void *this_arg; /** - * A new-style Tor onion address/port on which the peer is listening. - * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version, - * wrap as base32 and append \".onion\". + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. */ - LDKNetAddress_OnionV3, + struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); + void (*free)(void *this_arg); +} LDKMessageSendEventsProvider; + +/** + * A trait indicating an object may generate events + */ +typedef struct LDKEventsProvider { + void *this_arg; /** - * Must be last for serialization purposes + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. */ - LDKNetAddress_Sentinel, -} LDKNetAddress_Tag; - -typedef struct LDKNetAddress_LDKIPv4_Body { - struct LDKFourBytes addr; - uint16_t port; -} LDKNetAddress_LDKIPv4_Body; - -typedef struct LDKNetAddress_LDKIPv6_Body { - struct LDKSixteenBytes addr; - uint16_t port; -} LDKNetAddress_LDKIPv6_Body; - -typedef struct LDKNetAddress_LDKOnionV2_Body { - struct LDKTenBytes addr; - uint16_t port; -} LDKNetAddress_LDKOnionV2_Body; - -typedef struct LDKNetAddress_LDKOnionV3_Body { - struct LDKThirtyTwoBytes ed25519_pubkey; - uint16_t checksum; - uint8_t version; - uint16_t port; -} LDKNetAddress_LDKOnionV3_Body; - -typedef struct MUST_USE_STRUCT LDKNetAddress { - LDKNetAddress_Tag tag; - union { - LDKNetAddress_LDKIPv4_Body i_pv4; - LDKNetAddress_LDKIPv6_Body i_pv6; - LDKNetAddress_LDKOnionV2_Body onion_v2; - LDKNetAddress_LDKOnionV3_Body onion_v3; - }; -} LDKNetAddress; - -typedef struct LDKCVecTempl_NetAddress { - struct LDKNetAddress *data; - uintptr_t datalen; -} LDKCVecTempl_NetAddress; - -typedef struct LDKCVecTempl_NetAddress LDKCVec_NetAddressZ; + struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg); + void (*free)(void *this_arg); +} LDKEventsProvider; /** - * An update_add_htlc message to be sent or received from a peer + * Configuration we set when applicable. + * + * Default::default() provides sane defaults. */ -typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC { +typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUpdateAddHTLC *inner; + LDKnativeChannelHandshakeConfig *inner; bool is_owned; -} LDKUpdateAddHTLC; +} LDKChannelHandshakeConfig; /** - * An update_fulfill_htlc message to be sent or received from a peer + * Optional channel limits which are applied during channel creation. + * + * These limits are only applied to our counterparty's limits, not our own. + * + * Use 0/::max_value() as appropriate to skip checking. + * + * 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. */ -typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC { +typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUpdateFulfillHTLC *inner; + LDKnativeChannelHandshakeLimits *inner; bool is_owned; -} LDKUpdateFulfillHTLC; +} LDKChannelHandshakeLimits; /** - * An update_fail_htlc message to be sent or received from a peer + * Top-level config which holds ChannelHandshakeLimits and ChannelConfig. + * + * Default::default() provides sane defaults for most configurations + * (but currently with 0 relay fees!) */ -typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC { +typedef struct MUST_USE_STRUCT LDKUserConfig { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUpdateFailHTLC *inner; + LDKnativeUserConfig *inner; bool is_owned; -} LDKUpdateFailHTLC; +} LDKUserConfig; +/** + * The `Access` trait defines behavior for accessing chain data and state, such as blocks and + * UTXOs. + */ +typedef struct LDKAccess { + void *this_arg; + /** + * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. + * Returns an error if `genesis_hash` is for a different chain or if such a transaction output + * is unknown. + * + * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id + */ + struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); + void (*free)(void *this_arg); +} LDKAccess; +/** + * The `Listen` trait is used to be notified of 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. + */ +typedef struct LDKListen { + void *this_arg; + /** + * Notifies the listener that a block was added at the given height. + */ + void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height); + /** + * Notifies the listener that a block was removed at the given height. + */ + void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); + void (*free)(void *this_arg); +} LDKListen; /** - * An update_fail_malformed_htlc message to be sent or received from a peer + * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to + * channels. + * + * This is useful in order to have a [`Watch`] implementation convey to a chain source which + * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in + * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If + * receiving full blocks from a chain source, any further filtering is unnecessary. + * + * After an output has been registered, subsequent block retrievals from the chain source must not + * exclude any transactions matching the new criteria nor any in-block descendants of such + * transactions. + * + * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter` + * should not block on I/O. Implementations should instead queue the newly monitored data to be + * processed later. Then, in order to block until the data has been processed, any `Watch` + * invocation that has called the `Filter` must return [`TemporaryFailure`]. + * + * [`Watch`]: trait.Watch.html + * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure + * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki + * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki */ -typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC { +typedef struct LDKFilter { + void *this_arg; /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as + * a spending condition. */ - LDKnativeUpdateFailMalformedHTLC *inner; - bool is_owned; -} LDKUpdateFailMalformedHTLC; - - + void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey); + /** + * Registers interest in spends of a transaction output identified by `outpoint` having + * `script_pubkey` as the spending condition. + */ + void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey); + void (*free)(void *this_arg); +} LDKFilter; /** - * A commitment_signed message to be sent or received from a peer + * `Persist` defines behavior for persisting channel monitors: this could mean + * writing once to disk, and/or uploading to one or more backup services. + * + * Note that for every new monitor, you **must** persist the new `ChannelMonitor` + * to disk/backups. And, on every update, you **must** persist either the + * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk + * of situations such as revoking a transaction, then crashing before this + * revocation can be persisted, then unintentionally broadcasting a revoked + * transaction and losing money. This is a risk because previous channel states + * are toxic, so it's important that whatever channel state is persisted is + * kept up-to-date. */ -typedef struct MUST_USE_STRUCT LDKCommitmentSigned { +typedef struct LDKPersist { + void *this_arg; /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Persist a new channel's data. The data can be stored any way you want, but + * the identifier provided by Rust-Lightning is the channel's outpoint (and + * it is up to you to maintain a correct mapping between the outpoint and the + * stored channel data). Note that you **must** persist every new monitor to + * disk. See the `Persist` trait documentation for more details. + * + * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`, + * and [`ChannelMonitorUpdateErr`] for requirements when returning errors. + * + * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk + * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html */ - LDKnativeCommitmentSigned *inner; - bool is_owned; -} LDKCommitmentSigned; + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data); + /** + * 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. + * + * 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)`. + * + * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`, + * [`ChannelMonitorUpdate::write`] for writing out an update, and + * [`ChannelMonitorUpdateErr`] for requirements when returning errors. + * + * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1 + * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk + * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write + * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html + */ + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data); + void (*free)(void *this_arg); +} LDKPersist; /** - * An update_fee message to be sent or received from a peer + * 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. + * + * [`chain::Watch`]: ../trait.Watch.html + * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html + * [module-level documentation]: index.html */ -typedef struct MUST_USE_STRUCT LDKUpdateFee { +typedef struct MUST_USE_STRUCT LDKChainMonitor { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUpdateFee *inner; + LDKnativeChainMonitor *inner; bool is_owned; -} LDKUpdateFee; +} LDKChainMonitor; /** - * An init message to be sent or received from a peer + * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key + * and derives keys from that. + * + * Your node_id is seed/0' + * ChannelMonitor closes may use seed/1' + * Cooperative closes may use seed/2' + * The two close keys may be needed to claim on-chain funds! */ -typedef struct MUST_USE_STRUCT LDKInit { +typedef struct MUST_USE_STRUCT LDKKeysManager { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInit *inner; + LDKnativeKeysManager *inner; bool is_owned; -} LDKInit; +} LDKKeysManager; + +typedef struct LDKThreeBytes { + uint8_t data[3]; +} LDKThreeBytes; /** * A trait to describe an object which can receive channel messages. @@ -2558,7 +3648,7 @@ typedef struct LDKChannelMessageHandler { /** * 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); + void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg); /** * Handle an incoming closing_signed message from the given peer. */ @@ -2592,314 +3682,75 @@ typedef struct LDKChannelMessageHandler { */ void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg); /** - * Handle an incoming announcement_signatures message from the given peer. - */ - void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg); - /** - * Indicates a connection to the peer failed/an existing connection was lost. If no connection - * is believed to be possible in the future (eg they're sending us messages we don't - * understand or indicate they require unknown feature bits), no_connection_possible is set - * and any outstanding channels should be failed. - */ - void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible); - /** - * Handle a peer reconnecting, possibly generating channel_reestablish message(s). - */ - void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg); - /** - * 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 error message from the given peer. - */ - void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); - struct LDKMessageSendEventsProvider MessageSendEventsProvider; - void (*free)(void *this_arg); -} LDKChannelMessageHandler; - - - -/** - * Arguments for the creation of a ChannelManager that are not deserialized. - * - * At a high-level, the process for deserializing a ChannelManager and resuming normal operation - * is: - * 1) Deserialize all stored ChannelMonitors. - * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash, - * 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) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using - * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo(). - * 4) Reconnect blocks on your ChannelMonitors. - * 5) Move the ChannelMonitors into your local chain::Watch. - * 6) Disconnect/connect blocks on the ChannelManager. - */ -typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { - /** - * Nearly everywhere, 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; - bool is_owned; -} LDKChannelManagerReadArgs; - -typedef struct LDKCVecTempl_ChannelMonitor { - struct LDKChannelMonitor *data; - uintptr_t datalen; -} LDKCVecTempl_ChannelMonitor; - -typedef struct LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ; - -typedef union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError { - struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager *result; - struct LDKDecodeError *err; -} LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError; - -typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError { - union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError contents; - bool result_ok; -} LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError; - -typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; - - - -/** - * A ping message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKPing { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativePing *inner; - bool is_owned; -} LDKPing; - - - -/** - * A pong message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKPong { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativePong *inner; - bool is_owned; -} LDKPong; - - - -/** - * Proof that the sender knows the per-commitment secret of the previous commitment transaction. - * This is used to convince the recipient that the channel is at a certain commitment - * number even if they lost that data due to a local failure. Of course, the peer may lie - * and even later commitments may have been revoked. - */ -typedef struct MUST_USE_STRUCT LDKDataLossProtect { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeDataLossProtect *inner; - bool is_owned; -} LDKDataLossProtect; - -typedef union LDKCResultPtr_NetAddress__u8 { - struct LDKNetAddress *result; - uint8_t *err; -} LDKCResultPtr_NetAddress__u8; - -typedef struct LDKCResultTempl_NetAddress__u8 { - union LDKCResultPtr_NetAddress__u8 contents; - bool result_ok; -} LDKCResultTempl_NetAddress__u8; - -typedef union LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError { - struct LDKCResultTempl_NetAddress__u8 *result; - struct LDKDecodeError *err; -} LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError; - -typedef struct LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError { - union LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError contents; - bool result_ok; -} LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError; - -typedef struct LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError LDKCResult_CResult_NetAddressu8ZDecodeErrorZ; - - - -/** - * The unsigned part of a node_announcement - */ -typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUnsignedNodeAnnouncement *inner; - bool is_owned; -} LDKUnsignedNodeAnnouncement; - - - -/** - * Features used within a `node_announcement` message. - */ -typedef struct MUST_USE_STRUCT LDKNodeFeatures { - /** - * Nearly everywhere, 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 announcement_signatures message from the given peer. */ - LDKnativeNodeFeatures *inner; - bool is_owned; -} LDKNodeFeatures; - - - -/** - * Features used within a `channel_announcement` message. - */ -typedef struct MUST_USE_STRUCT LDKChannelFeatures { + void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg); /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Indicates a connection to the peer failed/an existing connection was lost. If no connection + * is believed to be possible in the future (eg they're sending us messages we don't + * understand or indicate they require unknown feature bits), no_connection_possible is set + * and any outstanding channels should be failed. */ - LDKnativeChannelFeatures *inner; - bool is_owned; -} LDKChannelFeatures; - - - -/** - * The unsigned part of a channel_update - */ -typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate { + void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible); /** - * Nearly everywhere, 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 peer reconnecting, possibly generating channel_reestablish message(s). */ - LDKnativeUnsignedChannelUpdate *inner; - bool is_owned; -} LDKUnsignedChannelUpdate; - - - -/** - * A reply_channel_range message is a reply to a query_channel_range - * message. Multiple reply_channel_range messages can be sent in reply - * to a single query_channel_range message. The query recipient makes a - * best effort to respond based on their local network view which may - * not be a perfect view of the network. The short_channel_ids in the - * reply are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. - */ -typedef struct MUST_USE_STRUCT LDKReplyChannelRange { + void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg); /** - * Nearly everywhere, 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 channel_reestablish message from the given peer. */ - LDKnativeReplyChannelRange *inner; - bool is_owned; -} LDKReplyChannelRange; - -typedef struct LDKCVecTempl_u64 { - uint64_t *data; - uintptr_t datalen; -} LDKCVecTempl_u64; - -typedef struct LDKCVecTempl_u64 LDKCVec_u64Z; + void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *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); + struct LDKMessageSendEventsProvider MessageSendEventsProvider; + void (*free)(void *this_arg); +} LDKChannelMessageHandler; /** - * A reply_short_channel_ids_end message is sent as a reply to a - * query_short_channel_ids message. The query recipient makes a best - * effort to respond based on their local network view which may not be - * a perfect view of the network. + * Arguments for the creation of a ChannelManager that are not deserialized. + * + * At a high-level, the process for deserializing a ChannelManager and resuming normal operation + * is: + * 1) Deserialize all stored ChannelMonitors. + * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash, + * 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) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using + * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo(). + * 4) Reconnect blocks on your ChannelMonitors. + * 5) Move the ChannelMonitors into your local chain::Watch. + * 6) Disconnect/connect blocks on the ChannelManager. */ -typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd { +typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeReplyShortChannelIdsEnd *inner; + LDKnativeChannelManagerReadArgs *inner; bool is_owned; -} LDKReplyShortChannelIdsEnd; +} LDKChannelManagerReadArgs; /** - * A gossip_timestamp_filter message is used by a node to request - * gossip relay for messages in the requested time range when the - * gossip_queries feature has been negotiated. + * Proof that the sender knows the per-commitment secret of the previous commitment transaction. + * This is used to convince the recipient that the channel is at a certain commitment + * number even if they lost that data due to a local failure. Of course, the peer may lie + * and even later commitments may have been revoked. */ -typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter { +typedef struct MUST_USE_STRUCT LDKDataLossProtect { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeGossipTimestampFilter *inner; + LDKnativeDataLossProtect *inner; bool is_owned; -} LDKGossipTimestampFilter; - -typedef struct LDKCVecTempl_UpdateAddHTLC { - struct LDKUpdateAddHTLC *data; - uintptr_t datalen; -} LDKCVecTempl_UpdateAddHTLC; - -typedef struct LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ; - -typedef struct LDKCVecTempl_UpdateFulfillHTLC { - struct LDKUpdateFulfillHTLC *data; - uintptr_t datalen; -} LDKCVecTempl_UpdateFulfillHTLC; - -typedef struct LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ; - -typedef struct LDKCVecTempl_UpdateFailHTLC { - struct LDKUpdateFailHTLC *data; - uintptr_t datalen; -} LDKCVecTempl_UpdateFailHTLC; - -typedef struct LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ; - -typedef struct LDKCVecTempl_UpdateFailMalformedHTLC { - struct LDKUpdateFailMalformedHTLC *data; - uintptr_t datalen; -} LDKCVecTempl_UpdateFailMalformedHTLC; - -typedef struct LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ; - -typedef union LDKCResultPtr_bool__LightningError { - bool *result; - struct LDKLightningError *err; -} LDKCResultPtr_bool__LightningError; - -typedef struct LDKCResultTempl_bool__LightningError { - union LDKCResultPtr_bool__LightningError contents; - bool result_ok; -} LDKCResultTempl_bool__LightningError; - -typedef struct LDKCResultTempl_bool__LightningError LDKCResult_boolLightningErrorZ; - -typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate { - struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data; - uintptr_t datalen; -} LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate; - -typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; - -typedef struct LDKCVecTempl_NodeAnnouncement { - struct LDKNodeAnnouncement *data; - uintptr_t datalen; -} LDKCVecTempl_NodeAnnouncement; - -typedef struct LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ; +} LDKDataLossProtect; /** * A trait to describe an object which can receive routing messages. @@ -2916,222 +3767,66 @@ typedef struct LDKRoutingMessageHandler { * Handle an incoming node_announcement message, returning true if it should be forwarded on, * false or returning an Err otherwise. */ - LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); + 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. */ - LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); + 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. */ - LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); - /** - * Handle some updates to the route graph that we learned due to an outbound failed payment. - */ - void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update); - /** - * Gets a subset of the channel announcements and updates required to dump our routing table - * to a remote node, starting at the short_channel_id indicated by starting_point and - * including the batch_amount entries immediately higher in numerical value than starting_point. - */ - LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount); - /** - * Gets a subset of the node announcements required to dump our routing table to a remote node, - * starting at the node *after* the provided publickey and including batch_amount entries - * immediately higher (as defined by ::cmp) than starting_point. - * If None is provided for starting_point, we start at the first node. - */ - LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount); - /** - * 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. - */ - void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init); - /** - * 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. - */ - 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. - */ - LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg); - /** - * Handles when a peer asks us to send a list of short_channel_ids - * for the requested range of blocks. - */ - LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg); - /** - * Handles when a peer asks us to send routing gossip messages for a - * list of short_channel_ids. - */ - LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg); - struct LDKMessageSendEventsProvider MessageSendEventsProvider; - void (*free)(void *this_arg); -} LDKRoutingMessageHandler; - -typedef union LDKCResultPtr_ChannelReestablish__DecodeError { - struct LDKChannelReestablish *result; - struct LDKDecodeError *err; -} LDKCResultPtr_ChannelReestablish__DecodeError; - -typedef struct LDKCResultTempl_ChannelReestablish__DecodeError { - union LDKCResultPtr_ChannelReestablish__DecodeError contents; - bool result_ok; -} LDKCResultTempl_ChannelReestablish__DecodeError; - -typedef struct LDKCResultTempl_ChannelReestablish__DecodeError LDKCResult_ChannelReestablishDecodeErrorZ; - -typedef union LDKCResultPtr_Init__DecodeError { - struct LDKInit *result; - struct LDKDecodeError *err; -} LDKCResultPtr_Init__DecodeError; - -typedef struct LDKCResultTempl_Init__DecodeError { - union LDKCResultPtr_Init__DecodeError contents; - bool result_ok; -} LDKCResultTempl_Init__DecodeError; - -typedef struct LDKCResultTempl_Init__DecodeError LDKCResult_InitDecodeErrorZ; - -typedef union LDKCResultPtr_Ping__DecodeError { - struct LDKPing *result; - struct LDKDecodeError *err; -} LDKCResultPtr_Ping__DecodeError; - -typedef struct LDKCResultTempl_Ping__DecodeError { - union LDKCResultPtr_Ping__DecodeError contents; - bool result_ok; -} LDKCResultTempl_Ping__DecodeError; - -typedef struct LDKCResultTempl_Ping__DecodeError LDKCResult_PingDecodeErrorZ; - -typedef union LDKCResultPtr_Pong__DecodeError { - struct LDKPong *result; - struct LDKDecodeError *err; -} LDKCResultPtr_Pong__DecodeError; - -typedef struct LDKCResultTempl_Pong__DecodeError { - union LDKCResultPtr_Pong__DecodeError contents; - bool result_ok; -} LDKCResultTempl_Pong__DecodeError; - -typedef struct LDKCResultTempl_Pong__DecodeError LDKCResult_PongDecodeErrorZ; - -typedef union LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError { - struct LDKUnsignedChannelAnnouncement *result; - struct LDKDecodeError *err; -} LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError; - -typedef struct LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError { - union LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError contents; - bool result_ok; -} LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError; - -typedef struct LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ; - -typedef union LDKCResultPtr_UnsignedChannelUpdate__DecodeError { - struct LDKUnsignedChannelUpdate *result; - struct LDKDecodeError *err; -} LDKCResultPtr_UnsignedChannelUpdate__DecodeError; - -typedef struct LDKCResultTempl_UnsignedChannelUpdate__DecodeError { - union LDKCResultPtr_UnsignedChannelUpdate__DecodeError contents; - bool result_ok; -} LDKCResultTempl_UnsignedChannelUpdate__DecodeError; - -typedef struct LDKCResultTempl_UnsignedChannelUpdate__DecodeError LDKCResult_UnsignedChannelUpdateDecodeErrorZ; - -typedef union LDKCResultPtr_ErrorMessage__DecodeError { - struct LDKErrorMessage *result; - struct LDKDecodeError *err; -} LDKCResultPtr_ErrorMessage__DecodeError; - -typedef struct LDKCResultTempl_ErrorMessage__DecodeError { - union LDKCResultPtr_ErrorMessage__DecodeError contents; - bool result_ok; -} LDKCResultTempl_ErrorMessage__DecodeError; - -typedef struct LDKCResultTempl_ErrorMessage__DecodeError LDKCResult_ErrorMessageDecodeErrorZ; - -typedef union LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError { - struct LDKUnsignedNodeAnnouncement *result; - struct LDKDecodeError *err; -} LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError; - -typedef struct LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError { - union LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError contents; - bool result_ok; -} LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError; - -typedef struct LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ; - -typedef union LDKCResultPtr_QueryShortChannelIds__DecodeError { - struct LDKQueryShortChannelIds *result; - struct LDKDecodeError *err; -} LDKCResultPtr_QueryShortChannelIds__DecodeError; - -typedef struct LDKCResultTempl_QueryShortChannelIds__DecodeError { - union LDKCResultPtr_QueryShortChannelIds__DecodeError contents; - bool result_ok; -} LDKCResultTempl_QueryShortChannelIds__DecodeError; - -typedef struct LDKCResultTempl_QueryShortChannelIds__DecodeError LDKCResult_QueryShortChannelIdsDecodeErrorZ; - -typedef union LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError { - struct LDKReplyShortChannelIdsEnd *result; - struct LDKDecodeError *err; -} LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError; - -typedef struct LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError { - union LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError contents; - bool result_ok; -} LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError; - -typedef struct LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ; - -typedef union LDKCResultPtr_QueryChannelRange__DecodeError { - struct LDKQueryChannelRange *result; - struct LDKDecodeError *err; -} LDKCResultPtr_QueryChannelRange__DecodeError; - -typedef struct LDKCResultTempl_QueryChannelRange__DecodeError { - union LDKCResultPtr_QueryChannelRange__DecodeError contents; - bool result_ok; -} LDKCResultTempl_QueryChannelRange__DecodeError; - -typedef struct LDKCResultTempl_QueryChannelRange__DecodeError LDKCResult_QueryChannelRangeDecodeErrorZ; - -typedef union LDKCResultPtr_ReplyChannelRange__DecodeError { - struct LDKReplyChannelRange *result; - struct LDKDecodeError *err; -} LDKCResultPtr_ReplyChannelRange__DecodeError; - -typedef struct LDKCResultTempl_ReplyChannelRange__DecodeError { - union LDKCResultPtr_ReplyChannelRange__DecodeError contents; - bool result_ok; -} LDKCResultTempl_ReplyChannelRange__DecodeError; - -typedef struct LDKCResultTempl_ReplyChannelRange__DecodeError LDKCResult_ReplyChannelRangeDecodeErrorZ; - -typedef union LDKCResultPtr_GossipTimestampFilter__DecodeError { - struct LDKGossipTimestampFilter *result; - struct LDKDecodeError *err; -} LDKCResultPtr_GossipTimestampFilter__DecodeError; - -typedef struct LDKCResultTempl_GossipTimestampFilter__DecodeError { - union LDKCResultPtr_GossipTimestampFilter__DecodeError contents; - bool result_ok; -} LDKCResultTempl_GossipTimestampFilter__DecodeError; - -typedef struct LDKCResultTempl_GossipTimestampFilter__DecodeError LDKCResult_GossipTimestampFilterDecodeErrorZ; + struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); + /** + * Handle some updates to the route graph that we learned due to an outbound failed payment. + */ + void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update); + /** + * Gets a subset of the channel announcements and updates required to dump our routing table + * to a remote node, starting at the short_channel_id indicated by starting_point and + * including the batch_amount entries immediately higher in numerical value than starting_point. + */ + struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount); + /** + * Gets a subset of the node announcements required to dump our routing table to a remote node, + * starting at the node *after* the provided publickey and including batch_amount entries + * immediately higher (as defined by ::cmp) than starting_point. + * If None is provided for starting_point, we start at the first node. + */ + struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount); + /** + * 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. + */ + void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init); + /** + * 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_ids + * for the requested range of blocks. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg); + /** + * Handles when a peer asks us to send routing gossip messages for a + * list of short_channel_ids. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg); + struct LDKMessageSendEventsProvider MessageSendEventsProvider; + void (*free)(void *this_arg); +} LDKRoutingMessageHandler; @@ -3214,749 +3909,793 @@ typedef struct MUST_USE_STRUCT LDKPeerManager { bool is_owned; } LDKPeerManager; -typedef struct LDKCVecTempl_PublicKey { - struct LDKPublicKey *data; - uintptr_t datalen; -} LDKCVecTempl_PublicKey; - -typedef struct LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ; - -typedef union LDKCResultPtr_CVecTempl_u8_____PeerHandleError { - struct LDKCVecTempl_u8 *result; - struct LDKPeerHandleError *err; -} LDKCResultPtr_CVecTempl_u8_____PeerHandleError; - -typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError { - union LDKCResultPtr_CVecTempl_u8_____PeerHandleError contents; - bool result_ok; -} LDKCResultTempl_CVecTempl_u8_____PeerHandleError; - -typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError LDKCResult_CVec_u8ZPeerHandleErrorZ; - -typedef union LDKCResultPtr_bool__PeerHandleError { - bool *result; - struct LDKPeerHandleError *err; -} LDKCResultPtr_bool__PeerHandleError; - -typedef struct LDKCResultTempl_bool__PeerHandleError { - union LDKCResultPtr_bool__PeerHandleError contents; - bool result_ok; -} LDKCResultTempl_bool__PeerHandleError; - -typedef struct LDKCResultTempl_bool__PeerHandleError LDKCResult_boolPeerHandleErrorZ; - -typedef union LDKCResultPtr_SecretKey__Secp256k1Error { - struct LDKSecretKey *result; - enum LDKSecp256k1Error *err; -} LDKCResultPtr_SecretKey__Secp256k1Error; - -typedef struct LDKCResultTempl_SecretKey__Secp256k1Error { - union LDKCResultPtr_SecretKey__Secp256k1Error contents; - bool result_ok; -} LDKCResultTempl_SecretKey__Secp256k1Error; - -typedef struct LDKCResultTempl_SecretKey__Secp256k1Error LDKCResult_SecretKeySecpErrorZ; - -typedef union LDKCResultPtr_PublicKey__Secp256k1Error { - struct LDKPublicKey *result; - enum LDKSecp256k1Error *err; -} LDKCResultPtr_PublicKey__Secp256k1Error; - -typedef struct LDKCResultTempl_PublicKey__Secp256k1Error { - union LDKCResultPtr_PublicKey__Secp256k1Error contents; - bool result_ok; -} LDKCResultTempl_PublicKey__Secp256k1Error; - -typedef struct LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ; - /** - * The set of public keys which are used in the creation of one commitment transaction. - * These are derived from the channel base keys and per-commitment data. - * - * A broadcaster key is provided from potential broadcaster of the computed transaction. - * A countersignatory key is coming from a protocol participant unable to broadcast the - * transaction. + * Static channel fields used to build transactions given per-commitment fields, organized by + * broadcaster/countersignatory. * - * These keys are assumed to be good, either because the code derived them from - * channel basepoints via the new function, or they were obtained via - * CommitmentTransaction.trust().keys() because we trusted the source of the - * pre-calculated keys. + * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the + * as_holder_broadcastable and as_counterparty_broadcastable functions. */ -typedef struct MUST_USE_STRUCT LDKTxCreationKeys { +typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeTxCreationKeys *inner; + LDKnativeDirectedChannelTransactionParameters *inner; bool is_owned; -} LDKTxCreationKeys; - -typedef union LDKCResultPtr_TxCreationKeys__Secp256k1Error { - struct LDKTxCreationKeys *result; - enum LDKSecp256k1Error *err; -} LDKCResultPtr_TxCreationKeys__Secp256k1Error; - -typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error { - union LDKCResultPtr_TxCreationKeys__Secp256k1Error contents; - bool result_ok; -} LDKCResultTempl_TxCreationKeys__Secp256k1Error; - -typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ; +} LDKDirectedChannelTransactionParameters; /** - * Late-bound per-channel counterparty data used to build transactions. + * A simple newtype for RwLockReadGuard<'a, NetworkGraph>. + * This exists only to make accessing a RwLock possible from + * the C bindings, as it can be done directly in Rust code. */ -typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters { +typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph { /** * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeCounterpartyChannelTransactionParameters *inner; + LDKnativeLockedNetworkGraph *inner; bool is_owned; -} LDKCounterpartyChannelTransactionParameters; +} LDKLockedNetworkGraph; /** - * 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. + * 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. */ -typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { +typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler { /** * Nearly everywhere, 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; + LDKnativeNetGraphMsgHandler *inner; bool is_owned; -} LDKDirectedChannelTransactionParameters; +} LDKNetGraphMsgHandler; +extern const uintptr_t MAX_BUF_SIZE; +extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; -/** - * A pre-built Bitcoin commitment transaction and its txid. - */ -typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeBuiltCommitmentTransaction *inner; - bool is_owned; -} LDKBuiltCommitmentTransaction; +extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; + +extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; + +void Transaction_free(struct LDKTransaction _res); + +void TxOut_free(struct LDKTxOut _res); + +struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); + +struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o); + +struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); + +void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res); + +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); + +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); + +void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); + +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); + +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); + +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); + +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); + +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o); + +struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); + +void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res); + +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); + +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); + +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); + +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); + +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); + +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); + +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); + +void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); + +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); + +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); + +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); + +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); + +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); + +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); + +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); + +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); + +void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); + +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); + +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); + +void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); + +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); + +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); + +void CVec_u8Z_free(struct LDKCVec_u8Z _res); + +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); + +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); + +void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); + +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); + +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); + +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); + +void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); + +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); + +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); + +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); + +void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); + +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); + +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); + +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); + +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); + +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); + +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); + +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); + +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); + +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); + +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); + +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); + +void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); + +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); + +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); + +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); + +void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); + +void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); + +void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res); + +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); + +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); + +void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); + +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); + +void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); + +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o); + +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res); + +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); + +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); + +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); + +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); + +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); + +void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); + +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); + +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); + +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); + +void CVec_u64Z_free(struct LDKCVec_u64Z _res); + +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); + +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); + +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); + +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig); -/** - * A hop in a route - */ -typedef struct MUST_USE_STRUCT LDKRouteHop { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRouteHop *inner; - bool is_owned; -} LDKRouteHop; +struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); -typedef struct LDKCVecTempl_RouteHop { - struct LDKRouteHop *data; - uintptr_t datalen; -} LDKCVecTempl_RouteHop; +void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); -typedef struct LDKCVecTempl_CVecTempl_RouteHop { - struct LDKCVecTempl_RouteHop *data; - uintptr_t datalen; -} LDKCVecTempl_CVecTempl_RouteHop; +void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); -typedef struct LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ; +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void); -typedef union LDKCResultPtr_Route__DecodeError { - struct LDKRoute *result; - struct LDKDecodeError *err; -} LDKCResultPtr_Route__DecodeError; +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e); -typedef struct LDKCResultTempl_Route__DecodeError { - union LDKCResultPtr_Route__DecodeError contents; - bool result_ok; -} LDKCResultTempl_Route__DecodeError; +void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res); -typedef struct LDKCResultTempl_Route__DecodeError LDKCResult_RouteDecodeErrorZ; +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig); +void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); +void CVec_EventZ_free(struct LDKCVec_EventZ _res); -/** - * A channel descriptor which provides a last-hop route to get_route - */ -typedef struct MUST_USE_STRUCT LDKRouteHint { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRouteHint *inner; - bool is_owned; -} LDKRouteHint; +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); -/** - * Fees for routing via a given channel or a node - */ -typedef struct MUST_USE_STRUCT LDKRoutingFees { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRoutingFees *inner; - bool is_owned; -} LDKRoutingFees; +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); -typedef union LDKCResultPtr_Route__LightningError { - struct LDKRoute *result; - struct LDKLightningError *err; -} LDKCResultPtr_Route__LightningError; +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); -typedef struct LDKCResultTempl_Route__LightningError { - union LDKCResultPtr_Route__LightningError contents; - bool result_ok; -} LDKCResultTempl_Route__LightningError; +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); -typedef struct LDKCResultTempl_Route__LightningError LDKCResult_RouteLightningErrorZ; +void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); -/** - * Represents the network as nodes and channels between them - */ -typedef struct MUST_USE_STRUCT LDKNetworkGraph { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeNetworkGraph *inner; - bool is_owned; -} LDKNetworkGraph; +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); -typedef struct LDKCVecTempl_RouteHint { - struct LDKRouteHint *data; - uintptr_t datalen; -} LDKCVecTempl_RouteHint; +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); -typedef struct LDKCVecTempl_RouteHint LDKCVec_RouteHintZ; +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void); +struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e); -/** - * A simple newtype for RwLockReadGuard<'a, NetworkGraph>. - * This exists only to make accessing a RwLock possible from - * the C bindings, as it can be done directly in Rust code. - */ -typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeLockedNetworkGraph *inner; - bool is_owned; -} LDKLockedNetworkGraph; +void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res); +struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); -/** - * 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. - */ -typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeNetGraphMsgHandler *inner; - bool is_owned; -} LDKNetGraphMsgHandler; +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); +void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); -/** - * Details about one direction of a channel. Received - * within a channel update. - */ -typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeDirectionalChannelInfo *inner; - bool is_owned; -} LDKDirectionalChannelInfo; +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); +void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); -/** - * Details about a channel (both directions). - * Received within a channel announcement. - */ -typedef struct MUST_USE_STRUCT LDKChannelInfo { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeChannelInfo *inner; - bool is_owned; -} LDKChannelInfo; +void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); -typedef union LDKCResultPtr_RoutingFees__DecodeError { - struct LDKRoutingFees *result; - struct LDKDecodeError *err; -} LDKCResultPtr_RoutingFees__DecodeError; +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); -typedef struct LDKCResultTempl_RoutingFees__DecodeError { - union LDKCResultPtr_RoutingFees__DecodeError contents; - bool result_ok; -} LDKCResultTempl_RoutingFees__DecodeError; +void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); -typedef struct LDKCResultTempl_RoutingFees__DecodeError LDKCResult_RoutingFeesDecodeErrorZ; +void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res); +struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); +void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); -/** - * Information received in the latest node_announcement from this node. - */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { - /** - * Nearly everywhere, 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; - bool is_owned; -} LDKNodeAnnouncementInfo; +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); -typedef union LDKCResultPtr_NodeAnnouncementInfo__DecodeError { - struct LDKNodeAnnouncementInfo *result; - struct LDKDecodeError *err; -} LDKCResultPtr_NodeAnnouncementInfo__DecodeError; +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); -typedef struct LDKCResultTempl_NodeAnnouncementInfo__DecodeError { - union LDKCResultPtr_NodeAnnouncementInfo__DecodeError contents; - bool result_ok; -} LDKCResultTempl_NodeAnnouncementInfo__DecodeError; +void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); -typedef struct LDKCResultTempl_NodeAnnouncementInfo__DecodeError LDKCResult_NodeAnnouncementInfoDecodeErrorZ; +void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o); +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); -/** - * Details about a node in the network, known from the network announcement. - */ -typedef struct MUST_USE_STRUCT LDKNodeInfo { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeNodeInfo *inner; - bool is_owned; -} LDKNodeInfo; +void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); -typedef union LDKCResultPtr_NodeInfo__DecodeError { - struct LDKNodeInfo *result; - struct LDKDecodeError *err; -} LDKCResultPtr_NodeInfo__DecodeError; +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); -typedef struct LDKCResultTempl_NodeInfo__DecodeError { - union LDKCResultPtr_NodeInfo__DecodeError contents; - bool result_ok; -} LDKCResultTempl_NodeInfo__DecodeError; +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); -typedef struct LDKCResultTempl_NodeInfo__DecodeError LDKCResult_NodeInfoDecodeErrorZ; +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); -typedef union LDKCResultPtr_NetworkGraph__DecodeError { - struct LDKNetworkGraph *result; - struct LDKDecodeError *err; -} LDKCResultPtr_NetworkGraph__DecodeError; +void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); -typedef struct LDKCResultTempl_NetworkGraph__DecodeError { - union LDKCResultPtr_NetworkGraph__DecodeError contents; - bool result_ok; -} LDKCResultTempl_NetworkGraph__DecodeError; +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); -typedef struct LDKCResultTempl_NetworkGraph__DecodeError LDKCResult_NetworkGraphDecodeErrorZ; +void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); -typedef struct LDKCResultTempl_NetAddress__u8 LDKCResult_NetAddressu8Z; +void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); -typedef struct LDKCVecTempl_RouteHop LDKCVec_RouteHopZ; +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); -extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); -extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); -extern const void (*CVec_EventZ_free)(LDKCVec_EventZ); +void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); -extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); -extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ); +void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); -extern const void (*CResult_NoneChannelMonitorUpdateErrZ_free)(LDKCResult_NoneChannelMonitorUpdateErrZ); +struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); -extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonitorUpdateErrZ_err)(enum LDKChannelMonitorUpdateErr); +void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); -extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); -extern const void (*CResult_ChannelMonitorUpdateDecodeErrorZ_free)(LDKCResult_ChannelMonitorUpdateDecodeErrorZ); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_ChannelMonitorUpdateDecodeErrorZ (*CResult_ChannelMonitorUpdateDecodeErrorZ_ok)(struct LDKChannelMonitorUpdate); +void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); -extern const LDKCResult_ChannelMonitorUpdateDecodeErrorZ (*CResult_ChannelMonitorUpdateDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); -extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(struct LDKMonitorUpdateError); +void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); -extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ); +struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); -extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ); +struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b); -extern const void (*CVec_C2Tuple_u32TxOutZZ_free)(LDKCVec_C2Tuple_u32TxOutZZ); +void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res); -extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o); -extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); -extern const void (*C2Tuple_BlockHashChannelMonitorZ_free)(LDKC2Tuple_BlockHashChannelMonitorZ); +void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res); -extern const void (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free)(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig); -extern const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok)(LDKC2Tuple_BlockHashChannelMonitorZ); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o); -extern const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); -extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z); +void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); -extern const void (*CResult_SpendableOutputDescriptorDecodeErrorZ_free)(LDKCResult_SpendableOutputDescriptorDecodeErrorZ); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); -extern const LDKCResult_SpendableOutputDescriptorDecodeErrorZ (*CResult_SpendableOutputDescriptorDecodeErrorZ_ok)(struct LDKSpendableOutputDescriptor); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); -extern const LDKCResult_SpendableOutputDescriptorDecodeErrorZ (*CResult_SpendableOutputDescriptorDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ); +void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); -extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ); +void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); -extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); -extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); -extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(struct LDKSignature); +void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); -extern const void (*CResult_ChanKeySignerDecodeErrorZ_free)(LDKCResult_ChanKeySignerDecodeErrorZ); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); -extern const LDKCResult_ChanKeySignerDecodeErrorZ (*CResult_ChanKeySignerDecodeErrorZ_ok)(struct LDKChannelKeys); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); -extern const LDKCResult_ChanKeySignerDecodeErrorZ (*CResult_ChanKeySignerDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_InMemoryChannelKeysDecodeErrorZ_free)(LDKCResult_InMemoryChannelKeysDecodeErrorZ); +void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); -extern const LDKCResult_InMemoryChannelKeysDecodeErrorZ (*CResult_InMemoryChannelKeysDecodeErrorZ_ok)(struct LDKInMemoryChannelKeys); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_InMemoryChannelKeysDecodeErrorZ (*CResult_InMemoryChannelKeysDecodeErrorZ_err)(struct LDKDecodeError); +void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); -extern const void (*CResult_TxOutAccessErrorZ_free)(LDKCResult_TxOutAccessErrorZ); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); -extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_ok)(struct LDKTxOut); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); -extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_err)(enum LDKAccessError); +void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); -extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ); +void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); -extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(struct LDKAPIError); +void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res); -extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ); +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); -extern const void (*CResult_NonePaymentSendFailureZ_free)(LDKCResult_NonePaymentSendFailureZ); +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_NonePaymentSendFailureZ (*CResult_NonePaymentSendFailureZ_err)(struct LDKPaymentSendFailure); +void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); -extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ); +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ); +void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); -extern const void (*C2Tuple_BlockHashChannelManagerZ_free)(LDKC2Tuple_BlockHashChannelManagerZ); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); -extern const void (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free)(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); -extern const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok)(LDKC2Tuple_BlockHashChannelManagerZ); +void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); -extern const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); -extern const void (*CResult_NetAddressu8Z_free)(LDKCResult_NetAddressu8Z); +struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o); -extern const LDKCResult_NetAddressu8Z (*CResult_NetAddressu8Z_ok)(struct LDKNetAddress); +struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e); -extern const LDKCResult_NetAddressu8Z (*CResult_NetAddressu8Z_err)(uint8_t); +void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res); -extern const void (*CResult_CResult_NetAddressu8ZDecodeErrorZ_free)(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ); +struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig); -extern const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ (*CResult_CResult_NetAddressu8ZDecodeErrorZ_ok)(LDKCResult_NetAddressu8Z); +struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o); -extern const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ (*CResult_CResult_NetAddressu8ZDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_u64Z_free)(LDKCVec_u64Z); +void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res); -extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ); +struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ); +void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); -extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ); +void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); -extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ); +void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); -extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ); +void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); -extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_ok)(bool); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); -extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(struct LDKLightningError); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ); +void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); -extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); -extern const void (*CResult_NoneLightningErrorZ_free)(LDKCResult_NoneLightningErrorZ); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_NoneLightningErrorZ (*CResult_NoneLightningErrorZ_err)(struct LDKLightningError); +void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); -extern const void (*CResult_ChannelReestablishDecodeErrorZ_free)(LDKCResult_ChannelReestablishDecodeErrorZ); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_ChannelReestablishDecodeErrorZ (*CResult_ChannelReestablishDecodeErrorZ_ok)(struct LDKChannelReestablish); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); -extern const LDKCResult_ChannelReestablishDecodeErrorZ (*CResult_ChannelReestablishDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_InitDecodeErrorZ_free)(LDKCResult_InitDecodeErrorZ); +void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); -extern const LDKCResult_InitDecodeErrorZ (*CResult_InitDecodeErrorZ_ok)(struct LDKInit); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_InitDecodeErrorZ (*CResult_InitDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); -extern const void (*CResult_PingDecodeErrorZ_free)(LDKCResult_PingDecodeErrorZ); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_PingDecodeErrorZ (*CResult_PingDecodeErrorZ_ok)(struct LDKPing); +void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); -extern const LDKCResult_PingDecodeErrorZ (*CResult_PingDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_PongDecodeErrorZ_free)(LDKCResult_PongDecodeErrorZ); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); -extern const LDKCResult_PongDecodeErrorZ (*CResult_PongDecodeErrorZ_ok)(struct LDKPong); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_PongDecodeErrorZ (*CResult_PongDecodeErrorZ_err)(struct LDKDecodeError); +void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); -extern const void (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_free)(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok)(struct LDKUnsignedChannelAnnouncement); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); -extern const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_UnsignedChannelUpdateDecodeErrorZ_free)(LDKCResult_UnsignedChannelUpdateDecodeErrorZ); +void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); -extern const LDKCResult_UnsignedChannelUpdateDecodeErrorZ (*CResult_UnsignedChannelUpdateDecodeErrorZ_ok)(struct LDKUnsignedChannelUpdate); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_UnsignedChannelUpdateDecodeErrorZ (*CResult_UnsignedChannelUpdateDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); -extern const void (*CResult_ErrorMessageDecodeErrorZ_free)(LDKCResult_ErrorMessageDecodeErrorZ); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_ErrorMessageDecodeErrorZ (*CResult_ErrorMessageDecodeErrorZ_ok)(struct LDKErrorMessage); +void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); -extern const LDKCResult_ErrorMessageDecodeErrorZ (*CResult_ErrorMessageDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_free)(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o); -extern const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok)(struct LDKUnsignedNodeAnnouncement); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_err)(struct LDKDecodeError); +void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res); -extern const void (*CResult_QueryShortChannelIdsDecodeErrorZ_free)(LDKCResult_QueryShortChannelIdsDecodeErrorZ); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_QueryShortChannelIdsDecodeErrorZ (*CResult_QueryShortChannelIdsDecodeErrorZ_ok)(struct LDKQueryShortChannelIds); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); -extern const LDKCResult_QueryShortChannelIdsDecodeErrorZ (*CResult_QueryShortChannelIdsDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_free)(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ); +void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); -extern const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok)(struct LDKReplyShortChannelIdsEnd); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); -extern const void (*CResult_QueryChannelRangeDecodeErrorZ_free)(LDKCResult_QueryChannelRangeDecodeErrorZ); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_QueryChannelRangeDecodeErrorZ (*CResult_QueryChannelRangeDecodeErrorZ_ok)(struct LDKQueryChannelRange); +void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); -extern const LDKCResult_QueryChannelRangeDecodeErrorZ (*CResult_QueryChannelRangeDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_ReplyChannelRangeDecodeErrorZ_free)(LDKCResult_ReplyChannelRangeDecodeErrorZ); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); -extern const LDKCResult_ReplyChannelRangeDecodeErrorZ (*CResult_ReplyChannelRangeDecodeErrorZ_ok)(struct LDKReplyChannelRange); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_ReplyChannelRangeDecodeErrorZ (*CResult_ReplyChannelRangeDecodeErrorZ_err)(struct LDKDecodeError); +void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); -extern const void (*CResult_GossipTimestampFilterDecodeErrorZ_free)(LDKCResult_GossipTimestampFilterDecodeErrorZ); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_GossipTimestampFilterDecodeErrorZ (*CResult_GossipTimestampFilterDecodeErrorZ_ok)(struct LDKGossipTimestampFilter); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); -extern const LDKCResult_GossipTimestampFilterDecodeErrorZ (*CResult_GossipTimestampFilterDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ); +void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); -extern const void (*CVec_u8Z_free)(LDKCVec_u8Z); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); -extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_err)(struct LDKPeerHandleError); +void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); -extern const void (*CResult_NonePeerHandleErrorZ_free)(LDKCResult_NonePeerHandleErrorZ); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_NonePeerHandleErrorZ (*CResult_NonePeerHandleErrorZ_err)(struct LDKPeerHandleError); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); -extern const void (*CResult_boolPeerHandleErrorZ_free)(LDKCResult_boolPeerHandleErrorZ); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(bool); +void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); -extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_err)(struct LDKPeerHandleError); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); -extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(struct LDKSecretKey); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_err)(enum LDKSecp256k1Error); +void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); -extern const void (*CResult_PublicKeySecpErrorZ_free)(LDKCResult_PublicKeySecpErrorZ); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_ok)(struct LDKPublicKey); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); -extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_err)(enum LDKSecp256k1Error); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ); +void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); -extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(struct LDKTxCreationKeys); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(enum LDKSecp256k1Error); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); -extern const void (*CResult_TrustedCommitmentTransactionNoneZ_free)(LDKCResult_TrustedCommitmentTransactionNoneZ); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_TrustedCommitmentTransactionNoneZ (*CResult_TrustedCommitmentTransactionNoneZ_ok)(struct LDKTrustedCommitmentTransaction); +void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); -extern const void (*CResult_CVec_SignatureZNoneZ_free)(LDKCResult_CVec_SignatureZNoneZ); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_CVec_SignatureZNoneZ (*CResult_CVec_SignatureZNoneZ_ok)(LDKCVec_SignatureZ); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); -extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ); +void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); -extern const void (*CResult_RouteDecodeErrorZ_free)(LDKCResult_RouteDecodeErrorZ); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_RouteDecodeErrorZ (*CResult_RouteDecodeErrorZ_ok)(struct LDKRoute); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); -extern const LDKCResult_RouteDecodeErrorZ (*CResult_RouteDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ); +void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); -extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)(struct LDKRoute); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); -extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(struct LDKLightningError); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_RoutingFeesDecodeErrorZ_free)(LDKCResult_RoutingFeesDecodeErrorZ); +void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); -extern const LDKCResult_RoutingFeesDecodeErrorZ (*CResult_RoutingFeesDecodeErrorZ_ok)(struct LDKRoutingFees); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_RoutingFeesDecodeErrorZ (*CResult_RoutingFeesDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); -extern const void (*CResult_NodeAnnouncementInfoDecodeErrorZ_free)(LDKCResult_NodeAnnouncementInfoDecodeErrorZ); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_NodeAnnouncementInfoDecodeErrorZ (*CResult_NodeAnnouncementInfoDecodeErrorZ_ok)(struct LDKNodeAnnouncementInfo); +void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); -extern const LDKCResult_NodeAnnouncementInfoDecodeErrorZ (*CResult_NodeAnnouncementInfoDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_NodeInfoDecodeErrorZ_free)(LDKCResult_NodeInfoDecodeErrorZ); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); -extern const LDKCResult_NodeInfoDecodeErrorZ (*CResult_NodeInfoDecodeErrorZ_ok)(struct LDKNodeInfo); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_NodeInfoDecodeErrorZ (*CResult_NodeInfoDecodeErrorZ_err)(struct LDKDecodeError); +void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); -extern const void (*CResult_NetworkGraphDecodeErrorZ_free)(LDKCResult_NetworkGraphDecodeErrorZ); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_NetworkGraphDecodeErrorZ (*CResult_NetworkGraphDecodeErrorZ_ok)(struct LDKNetworkGraph); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); -extern const LDKCResult_NetworkGraphDecodeErrorZ (*CResult_NetworkGraphDecodeErrorZ_err)(struct LDKDecodeError); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); -extern const uintptr_t MAX_BUF_SIZE; +void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); -extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); -extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); -void Transaction_free(struct LDKTransaction _res); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); -void TxOut_free(struct LDKTxOut _res); +void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); + +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); + +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); + +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); -LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); -LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void); +void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); -LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void); +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); -LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, LDKCVec_u8Z b); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); -LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); -LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b); +void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); -LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); -LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); -LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, LDKCVec_SignatureZ b); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); +void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); -LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); -LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); -LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); -LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); +void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); -LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); -LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); -LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); -LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); -LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); + +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); + +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); void Event_free(struct LDKEvent this_ptr); struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); -LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); +struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); @@ -3990,8 +4729,6 @@ void Logger_free(struct LDKLogger this_ptr); void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr); -struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); - /** * Confirmations we will wait for before considering the channel locked in. * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the @@ -4066,12 +4803,12 @@ void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshake 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); +struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); + MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr); -struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); - /** * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so * only applies to inbound channels. @@ -4260,12 +4997,12 @@ void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLi MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); +struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); + MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); void ChannelConfig_free(struct LDKChannelConfig this_ptr); -struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); - /** * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi. * This may be allowed to change at runtime in a later update, however doing so must result in @@ -4346,16 +5083,16 @@ void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *N MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); +struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); + MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); -LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); -struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser); +struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); void UserConfig_free(struct LDKUserConfig this_ptr); -struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); - /** * Channel config that we propose to our counterparty. */ @@ -4388,6 +5125,8 @@ void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg); +struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); + MUST_USE_RES struct LDKUserConfig UserConfig_default(void); enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig); @@ -4397,6 +5136,11 @@ enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR ori */ void Access_free(struct LDKAccess this_ptr); +/** + * Calls the free function if one is set + */ +void Listen_free(struct LDKListen this_ptr); + /** * Calls the free function if one is set */ @@ -4436,7 +5180,7 @@ void ChainMonitor_free(struct LDKChainMonitor this_ptr); * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events * [`chain::Filter`]: ../trait.Filter.html */ -void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); +void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** * Dispatches to per-channel monitors, which are responsible for updating their on-chain view @@ -4466,8 +5210,6 @@ struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMon void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr); -struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); - /** * 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 @@ -4502,14 +5244,18 @@ uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate */ void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); -LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); +struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); + +struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); -LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr); +struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig); + void MonitorEvent_free(struct LDKMonitorEvent this_ptr); struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); @@ -4518,13 +5264,13 @@ void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr); struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); -LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); +struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); -struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser); +struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser); void ChannelMonitor_free(struct LDKChannelMonitor this_ptr); -LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); /** * Updates a ChannelMonitor on the basis of some new information provided by the Channel @@ -4532,7 +5278,7 @@ LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj * * panics if the given update is not the next update by update_id. */ -MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(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); +MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this @@ -4543,7 +5289,7 @@ MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChanne /** * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. */ -MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Get the list of HTLCs who's status has been updated on chain. This should be called by @@ -4551,7 +5297,7 @@ MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const str * * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events */ -MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Gets the list of pending events which were generated by previous actions, clearing the list @@ -4561,7 +5307,7 @@ MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_ * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do * no internal locking in ChannelMonitors. */ -MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of @@ -4574,7 +5320,7 @@ MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct L * out-of-band the other node operator to coordinate with him if option is available to you. * In any-case, choice is up to the user. */ -MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); +MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); /** * Processes transactions in a newly connected block, which may result in any of the following: @@ -4589,7 +5335,7 @@ MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_tx * * [`get_outputs_to_watch`]: #method.get_outputs_to_watch */ -MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** * Determines if the disconnected block contained any transactions of interest and updates @@ -4602,12 +5348,10 @@ void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *NONNULL_PTR thi */ void Persist_free(struct LDKPersist this_ptr); -LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); void OutPoint_free(struct LDKOutPoint this_ptr); -struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); - /** * The referenced transaction's txid. */ @@ -4619,120 +5363,246 @@ const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The index of the referenced output in its transaction's vout. + * The index of the referenced output in its transaction's vout. + */ +uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); + +/** + * The index of the referenced output in its transaction's vout. + */ +void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); + +MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); + +struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); + +/** + * Convert an `OutPoint` to a lightning channel id. + */ +MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg); + +struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); + +struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); + +void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_ptr); + +/** + * The outpoint which is spendable + */ +struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The outpoint which is spendable + */ +void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + +/** + * Per commitment point to derive delayed_payment_key by key holder + */ +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * Per commitment point to derive delayed_payment_key by key holder + */ +void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * the witness_script. + */ +uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * the witness_script. + */ +void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); + +/** + * The output which is referenced by the given outpoint + */ +void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + +/** + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. + */ +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. + */ +void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The value of the channel which this output originated from, possibly indirectly. + */ +uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The value of the channel which this output originated from, possibly indirectly. + */ +void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + +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); + +struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); + +void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_ptr); + +/** + * The outpoint which is spendable + */ +struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The outpoint which is spendable + */ +void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + +/** + * The output which is referenced by the given outpoint + */ +void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. */ -uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); +const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * The index of the referenced output in its transaction's vout. + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. */ -void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); +void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); -MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); +/** + * The value of the channel which this transactions spends. + */ +uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Convert an `OutPoint` to a lightning channel id. + * The value of the channel which this transactions spends. */ -MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg); +void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); -LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); +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 LDKOutPoint OutPoint_read(struct LDKu8slice ser); +struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); -LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); +struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); -LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); -struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig); +struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void ChannelKeys_free(struct LDKChannelKeys this_ptr); +void Sign_free(struct LDKSign this_ptr); /** * Calls the free function if one is set */ void KeysInterface_free(struct LDKKeysInterface this_ptr); -void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr); - -struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig); +void InMemorySigner_free(struct LDKInMemorySigner this_ptr); /** * Private key of anchor tx */ -const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Private key of anchor tx */ -void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key for blinded revocation pubkey */ -const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Holder secret key for blinded revocation pubkey */ -void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key used for our balance in counterparty-broadcasted commitment transactions */ -const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Holder secret key used for our balance in counterparty-broadcasted commitment transactions */ -void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key used in HTLC tx */ -const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Holder secret key used in HTLC tx */ -void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder htlc secret key used in commitment tx htlc outputs */ -const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Holder htlc secret key used in commitment tx htlc outputs */ -void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Commitment seed */ -const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Commitment seed */ -void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); /** - * Create a new InMemoryChannelKeys + * Create a new InMemorySigner */ -MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_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, LDKC2Tuple_u64u64Z key_derivation_params); +MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); /** * Counterparty pubkeys. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * The contest_delay value specified by our counterparty and applied on holder-broadcastable @@ -4740,7 +5610,7 @@ MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkey * broadcast a transaction. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * The contest_delay value specified by us and applied on transactions broadcastable @@ -4748,19 +5618,19 @@ MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(co * if they broadcast a transaction. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Whether the holder is the initiator * Will panic if ready_channel wasn't called. */ -MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Funding outpoint * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or @@ -4768,13 +5638,32 @@ MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struc * * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + +/** + * Sign the single input of spend_tx at index `input_idx` which spends the output + * described by descriptor, returning the witness stack for the input. + * + * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, + * or is not spending the outpoint described by `descriptor.outpoint`. + */ +MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); + +/** + * Sign the single input of spend_tx at index `input_idx` which spends the output + * described by descriptor, returning the witness stack for the input. + * + * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, + * is not spending the outpoint described by `descriptor.outpoint`, or does not have a + * sequence set to `descriptor.to_self_delay`. + */ +MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); -struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); -LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj); +struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); -LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser); +struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser); void KeysManager_free(struct LDKKeysManager this_ptr); @@ -4799,16 +5688,31 @@ void KeysManager_free(struct LDKKeysManager this_ptr); * versions. Once the library is more fully supported, the docs will be updated to include a * detailed description of the guarantee. */ -MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos); +MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); /** - * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation - * parameters. + * Derive an old Sign containing per-channel secrets based on a key derivation parameters. + * * Key derivation parameters are accessible through a per-channel secrets - * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of + * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of * onchain output detection for which a corresponding delayed_payment_key must be derived. */ -MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2); +MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); + +/** + * Creates a Transaction which spends the given descriptors to the given outputs, plus an + * output to the given change destination (if sufficient change value remains). The + * transaction will have a feerate, at least, of the given value. + * + * Returns `Err(())` if the output value is greater than the input value minus required fee or + * if a descriptor was duplicated. + * + * We do not enforce that outputs meet the dust limit or that any output scripts are standard. + * + * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used + * this KeysManager or one of the `InMemorySigner` created by this KeysManager. + */ +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 LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); @@ -4816,8 +5720,6 @@ void ChannelManager_free(struct LDKChannelManager this_ptr); void ChannelDetails_free(struct LDKChannelDetails this_ptr); -struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); - /** * 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). @@ -4924,8 +5826,12 @@ bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this */ void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); + void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); +struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); + /** * Constructs a new ChannelManager to hold several channels and route between them. * @@ -4958,13 +5864,13 @@ MUST_USE_RES struct LDKChannelManager ChannelManager_new(enum LDKNetwork network * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000. */ -MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config); /** * Gets the list of open channels, in random order. See ChannelDetail field documentation for * more information. */ -MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Gets the list of usable channels, in random order. Useful as an argument to @@ -4973,7 +5879,7 @@ MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct L * These are guaranteed to have their is_live value set to true, see the documentation for * ChannelDetails::is_live for more info on exactly what the criteria are. */ -MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs @@ -4982,13 +5888,13 @@ MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const s * * May generate a SendShutdown message event on success, which should be relayed. */ -MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); /** * Force closes a channel, immediately broadcasting the latest local commitment transaction to * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager. */ -MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); /** * Force close all channels, immediately broadcasting the latest local commitment transaction @@ -5037,7 +5943,7 @@ void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NON * bit set (either as required or as available). If multiple paths are present in the Route, * we assume the invoice had the basic_mpp feature set. */ -MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** * Call this upon creation of a funding transaction for the given channel. @@ -5067,7 +5973,7 @@ void ChannelManager_funding_transaction_generated(const struct LDKChannelManager * * Panics if addresses is absurdly large (more than 500). */ -void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses); +void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); /** * Processes HTLCs which are pending waiting on random forward delay. @@ -5147,10 +6053,12 @@ struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider( struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); + /** * Updates channel state based on transactions seen in a connected block. */ -void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); +void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** * Updates channel state based on a disconnected block. @@ -5160,9 +6068,15 @@ void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR */ void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]); +/** + * Blocks until ChannelManager needs to be persisted. Only one listener on `wait` is + * guaranteed to be woken up. + */ +void ChannelManager_wait(const struct LDKChannelManager *NONNULL_PTR this_arg); + struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); -LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr); @@ -5255,20 +6169,32 @@ void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs * HashMap for you. This is primarily useful for C bindings where it is not practical to * populate a HashMap directly from C. */ -MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, LDKCVec_ChannelMonitorZ channel_monitors); +MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); -LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); void DecodeError_free(struct LDKDecodeError this_ptr); +struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); + void Init_free(struct LDKInit this_ptr); +/** + * The relevant features which the sender supports + */ +struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); + +/** + * The relevant features which the sender supports + */ +void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); + +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg); + struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); void ErrorMessage_free(struct LDKErrorMessage this_ptr); -struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); - /** * The channel ID involved in the error */ @@ -5293,13 +6219,13 @@ struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR th * or printed to stdout). Otherwise, a well crafted error message may trigger a security * vulnerability in the terminal emulator or the logging subsystem. */ -void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, LDKCVec_u8Z val); +void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); -MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg); +MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg); -void Ping_free(struct LDKPing this_ptr); +struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); -struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); +void Ping_free(struct LDKPing this_ptr); /** * The desired response length @@ -5325,9 +6251,9 @@ void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); -void Pong_free(struct LDKPong this_ptr); +struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); -struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); +void Pong_free(struct LDKPong this_ptr); /** * The pong packet size. @@ -5343,9 +6269,9 @@ void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); -void OpenChannel_free(struct LDKOpenChannel this_ptr); +struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); -struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); +void OpenChannel_free(struct LDKOpenChannel this_ptr); /** * The genesis hash of the blockchain where the channel is to be opened @@ -5527,9 +6453,9 @@ uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR t */ void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); -void AcceptChannel_free(struct LDKAcceptChannel this_ptr); +struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); -struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); +void AcceptChannel_free(struct LDKAcceptChannel this_ptr); /** * A temporary channel ID, until the funding outpoint is announced @@ -5671,9 +6597,9 @@ struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LD */ void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); -void FundingCreated_free(struct LDKFundingCreated this_ptr); +struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); -struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); +void FundingCreated_free(struct LDKFundingCreated this_ptr); /** * A temporary channel ID, until the funding is established @@ -5717,9 +6643,9 @@ void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg); -void FundingSigned_free(struct LDKFundingSigned this_ptr); +struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); -struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); +void FundingSigned_free(struct LDKFundingSigned this_ptr); /** * The channel ID @@ -5743,9 +6669,9 @@ void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); -void FundingLocked_free(struct LDKFundingLocked this_ptr); +struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); -struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); +void FundingLocked_free(struct LDKFundingLocked this_ptr); /** * The channel ID @@ -5769,9 +6695,9 @@ void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNUL MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg); -void Shutdown_free(struct LDKShutdown this_ptr); +struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); -struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); +void Shutdown_free(struct LDKShutdown this_ptr); /** * The channel ID @@ -5793,13 +6719,13 @@ struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PT * The destination of this peer's funds on closing. * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. */ -void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, LDKCVec_u8Z val); +void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); -MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg); +MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); -void ClosingSigned_free(struct LDKClosingSigned this_ptr); +struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); -struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); +void ClosingSigned_free(struct LDKClosingSigned this_ptr); /** * The channel ID @@ -5833,9 +6759,9 @@ void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg); -void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr); +struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); -struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); +void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr); /** * The channel ID @@ -5887,9 +6813,9 @@ uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PT */ void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); -void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr); +struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); -struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); +void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr); /** * The channel ID @@ -5923,9 +6849,9 @@ void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); -void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr); +struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); -struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); +void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr); /** * The channel ID @@ -5947,9 +6873,9 @@ uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR */ void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); -void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr); +struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); -struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); +void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr); /** * The channel ID @@ -5981,9 +6907,9 @@ uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalf */ void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); -void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr); +struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); -struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); +void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr); /** * The channel ID @@ -6008,13 +6934,13 @@ void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this /** * Signatures on the HTLC transactions */ -void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); -MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg); +MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg); -void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr); +struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); -struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); +void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr); /** * The channel ID @@ -6048,9 +6974,9 @@ void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_ 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); -void UpdateFee_free(struct LDKUpdateFee this_ptr); +struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); -struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); +void UpdateFee_free(struct LDKUpdateFee this_ptr); /** * The channel ID @@ -6074,9 +7000,9 @@ void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uin MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); -void DataLossProtect_free(struct LDKDataLossProtect this_ptr); +struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); -struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig); +void DataLossProtect_free(struct LDKDataLossProtect this_ptr); /** * Proof that the sender knows the per-commitment secret of a specific commitment transaction @@ -6102,9 +7028,9 @@ void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProte MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg); -void ChannelReestablish_free(struct LDKChannelReestablish this_ptr); +struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig); -struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); +void ChannelReestablish_free(struct LDKChannelReestablish this_ptr); /** * The channel ID @@ -6136,9 +7062,9 @@ uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKCh */ void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); -void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr); +struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); -struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); +void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr); /** * The channel ID @@ -6182,18 +7108,18 @@ void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatur MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg); +struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); + void NetAddress_free(struct LDKNetAddress this_ptr); struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); -LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); +struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); -LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser); +struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser); void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr); -struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); - /** * The advertised features */ @@ -6251,11 +7177,11 @@ void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONN /** * List of addresses on which this node is reachable */ -void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); -void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr); +struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); -struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); +void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr); /** * The signature by the node key @@ -6279,9 +7205,9 @@ void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); -void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr); +struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); -struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); +void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr); /** * The advertised channel features @@ -6353,9 +7279,9 @@ struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct L */ void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); -void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr); +struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); -struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); +void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr); /** * Authentication of the announcement by the first public node @@ -6409,9 +7335,9 @@ void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); -void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr); +struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); -struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); +void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr); /** * The genesis hash of the blockchain where the channel is to be opened @@ -6493,9 +7419,9 @@ uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKU */ void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); -void ChannelUpdate_free(struct LDKChannelUpdate this_ptr); +struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); -struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); +void ChannelUpdate_free(struct LDKChannelUpdate this_ptr); /** * A signature of the channel update @@ -6519,9 +7445,9 @@ void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, s MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); -void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr); +struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); -struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); +void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr); /** * The genesis hash of the blockchain being queried @@ -6555,9 +7481,9 @@ void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); -void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr); +struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); -struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); +void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr); /** * The genesis hash of the blockchain being queried @@ -6590,27 +7516,25 @@ uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRang void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * True when this is the final reply for a query */ -bool ReplyChannelRange_get_full_information(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * True when this is the final reply for a query */ -void ReplyChannelRange_set_full_information(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); +void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); /** * The short_channel_ids in the channel range */ -void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, LDKCVec_u64Z val); +void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); -MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, LDKCVec_u64Z short_channel_ids_arg); +MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg); -void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr); +struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); -struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); +void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr); /** * The genesis hash of the blockchain being queried @@ -6625,13 +7549,13 @@ void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL /** * The short_channel_ids that are being queried */ -void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, LDKCVec_u64Z val); +void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); -MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg); +MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); -void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr); +struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); -struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); +void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr); /** * The genesis hash of the blockchain that was queried @@ -6657,9 +7581,9 @@ void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIds MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); -void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr); +struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); -struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); +void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr); /** * The genesis hash of the blockchain for channel and node information @@ -6693,6 +7617,8 @@ void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter * MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); +struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); + void ErrorAction_free(struct LDKErrorAction this_ptr); struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); @@ -6707,7 +7633,7 @@ struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR /** * A human-readable message describing the error */ -void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, LDKCVec_u8Z val); +void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** * The action which should be taken against the offending peer. @@ -6719,31 +7645,31 @@ struct LDKErrorAction LightningError_get_action(const struct LDKLightningError * */ void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); -MUST_USE_RES struct LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg); +MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg); -void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr); +struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); -struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); +void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr); /** * update_add_htlc messages which should be sent */ -void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateAddHTLCZ val); +void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); /** * update_fulfill_htlc messages which should be sent */ -void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFulfillHTLCZ val); +void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); /** * update_fail_htlc messages which should be sent */ -void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailHTLCZ val); +void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); /** * update_fail_malformed_htlc messages which should be sent */ -void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val); +void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); /** * An update_fee message which should be sent @@ -6765,7 +7691,9 @@ struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct L */ void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); -MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); +MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); + +struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr); @@ -6781,129 +7709,129 @@ void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); */ void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); -LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); +struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); -struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser); +struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); -LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); +struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); -struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); -LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); +struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); -LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); +struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); -struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser); +struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); +struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); -struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser); +struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); +struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); -struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser); +struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); +struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); -struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser); +struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj); +struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj); -struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser); +struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser); -LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); +struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); -LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); +struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); -LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); +struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); -struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser); +struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); -LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); +struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); -struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser); +struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); -LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); +struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); -struct LDKShutdown Shutdown_read(struct LDKu8slice ser); +struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); +struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); -struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); +struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); -struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); +struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); -struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser); +struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); +struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); -struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); +struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); -struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); +struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); -LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); +struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); -LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); +struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); -LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); +struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); +struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); -LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); -struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); +struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); -LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); -struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser); +struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); -LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); +struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); -LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); +struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); -LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); +struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); -struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser); +struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); -LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); -LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); +struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); -LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); -LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); +struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); -LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); +struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); -LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); +struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); -LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); -LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); +struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); -LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); -LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); +struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); void MessageHandler_free(struct LDKMessageHandler this_ptr); @@ -6956,6 +7884,8 @@ void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNU MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); +struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); + void PeerManager_free(struct LDKPeerManager this_ptr); /** @@ -6972,7 +7902,7 @@ MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler mess * new_outbound_connection, however entries will only appear once the initial handshake has * completed and we are sure the remote peer has the private key for the given node_id. */ -MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); /** * Indicates a new outbound connection has been established to a node with the given node_id. @@ -6984,7 +7914,7 @@ MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPe * Panics if descriptor is duplicative with some other descriptor which has not yet had a * socket_disconnected(). */ -MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor); +MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor); /** * Indicates a new inbound connection has been established. @@ -6997,7 +7927,7 @@ MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connec * Panics if descriptor is duplicative with some other descriptor which has not yet had * socket_disconnected called. */ -MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor); /** * Indicates that there is room to write data to the given socket descriptor. @@ -7011,7 +7941,7 @@ MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection( * here isn't sufficient! Panics if the descriptor was not previously registered in a * new_\\*_connection event. */ -MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** * Indicates that data was read from the given socket descriptor. @@ -7027,7 +7957,7 @@ MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avai * * Panics if the descriptor was not previously registered in a new_*_connection event. */ -MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); +MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); /** * Checks for any events generated by our handlers and processes them. Includes sending most @@ -7078,7 +8008,7 @@ struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed * Note that this is infallible iff we trust that at least one of the two input keys are randomly * generated (ie our own). */ -LDKCResult_SecretKeySecpErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); +struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); /** * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key) @@ -7088,7 +8018,7 @@ LDKCResult_SecretKeySecpErrorZ derive_private_key(struct LDKPublicKey per_commit * Note that this is infallible iff we trust that at least one of the two input keys are randomly * generated (ie our own). */ -LDKCResult_PublicKeySecpErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); +struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); /** * Derives a per-commitment-transaction revocation key from its constituent parts. @@ -7101,7 +8031,7 @@ LDKCResult_PublicKeySecpErrorZ derive_public_key(struct LDKPublicKey per_commitm * Note that this is infallible iff we trust that at least one of the two input keys are randomly * generated (ie our own). */ -LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); +struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); /** * Derives a per-commitment-transaction revocation public key from its constituent parts. This is @@ -7116,12 +8046,10 @@ LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per * Note that this is infallible iff we trust that at least one of the two input keys are randomly * generated (ie our own). */ -LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); +struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr); -struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); - /** * The broadcaster's per-commitment public key which was used to derive the other keys. */ @@ -7178,14 +8106,14 @@ void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys 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); -LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); +struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); + +struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); -struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser); +struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr); -struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); - /** * 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. @@ -7256,33 +8184,33 @@ void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_P 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); -LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); +struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); + +struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); -struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser); +struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); /** * Create per-state keys from channel base points and the per-commitment point. * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base); +MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base); /** * Generate per-state keys from channel static keys. * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); /** * 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. */ -LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); +struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr); -struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); - /** * 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 @@ -7331,21 +8259,23 @@ const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutp */ void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); -LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); +struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); + +struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); -struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser); +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); /** * 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. */ -LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys); +struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys); /** * Gets the redeemscript for a funding output from the two funding public keys. * Note that the order of funding public keys does not matter. */ -LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); +struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); /** * panics if htlc.transaction_output_index.is_none()! @@ -7354,8 +8284,6 @@ struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uin void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr); -struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); - /** * Holder public keys */ @@ -7412,9 +8340,9 @@ void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransact MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg); -void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr); +struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); -struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); +void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr); /** * Counter-party public keys @@ -7438,6 +8366,8 @@ void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); +struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); + /** * Whether the late bound parameters are populated. */ @@ -7459,13 +8389,13 @@ MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionPa */ MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); -LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); +struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); -struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); -struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser); +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_ptr); @@ -7500,8 +8430,6 @@ MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_out void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr); -struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); - /** * Our counterparty's signature for the transaction */ @@ -7515,22 +8443,22 @@ void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitment /** * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val); +void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); + +struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); -LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); +struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); -struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); /** * Create a new holder transaction with the given counterparty signatures. * The funding keys are used to figure out which signature should go first when building the transaction for broadcast. */ -MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); +MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr); -struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); - /** * The commitment transaction */ @@ -7559,9 +8487,11 @@ void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *N MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); -LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); +struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); + +struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); -struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); /** * Get the SIGHASH_ALL sighash value of the transaction. @@ -7580,9 +8510,9 @@ void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr); struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); -LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); +struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); -struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); /** * The backwards-counting commitment number @@ -7622,7 +8552,7 @@ MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust( * An external validating signer must call this method before signing * or using the built transaction. */ -MUST_USE_RES 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); +MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_ptr); @@ -7647,22 +8577,74 @@ MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const st * * The returned Vec has one entry for each HTLC, and in the same order. */ -MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); +MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); /** * Get the transaction number obscure factor */ uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); +struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); + +struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); + +struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); + void InitFeatures_free(struct LDKInitFeatures this_ptr); void NodeFeatures_free(struct LDKNodeFeatures this_ptr); void ChannelFeatures_free(struct LDKChannelFeatures this_ptr); -void RouteHop_free(struct LDKRouteHop this_ptr); +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); -struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); +/** + * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`]. + * + * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS + */ +MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void); + +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); + +/** + * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`]. + * + * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS + */ +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void); + +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); + +/** + * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`]. + * + * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS + */ +MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void); + +struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); + +struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); + +struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); + +struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); + +struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); + +struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); + +void RouteHop_free(struct LDKRouteHop this_ptr); /** * The node_id of the node at this hop. @@ -7732,9 +8714,9 @@ void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, ui 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); -void Route_free(struct LDKRoute this_ptr); +struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); -struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); +void Route_free(struct LDKRoute this_ptr); /** * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the @@ -7744,17 +8726,17 @@ struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); * given path is variable, keeping the length of any path to less than 20 should currently * ensure it is viable. */ -void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, LDKCVec_CVec_RouteHopZZ val); +void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); -MUST_USE_RES struct LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg); +MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg); -LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); +struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); -LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); +struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); -void RouteHint_free(struct LDKRouteHint this_ptr); +struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); -struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); +void RouteHint_free(struct LDKRouteHint this_ptr); /** * The node_id of the non-target end of the route @@ -7808,6 +8790,8 @@ void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg); +struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); + /** * Gets a route from us to the given target node. * @@ -7826,10 +8810,12 @@ MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_a * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat * *is* checked as they may change based on the receiving node. */ -LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, LDKCVec_ChannelDetailsZ *first_hops, LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger); +struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger); void NetworkGraph_free(struct LDKNetworkGraph this_ptr); +struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); + void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr); void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr); @@ -7936,9 +8922,11 @@ struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const str */ void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); -LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); +struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig); -struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser); +struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); + +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser); void ChannelInfo_free(struct LDKChannelInfo this_ptr); @@ -8008,13 +8996,13 @@ struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct */ void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); -LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); +struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); -struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser); +struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); -void RoutingFees_free(struct LDKRoutingFees this_ptr); +struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); -struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); +void RoutingFees_free(struct LDKRoutingFees this_ptr); /** * Flat routing fee in satoshis @@ -8040,9 +9028,11 @@ void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); -LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); +struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); + +struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); -LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); +struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr); @@ -8095,7 +9085,7 @@ void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR /** * Internet-level addresses via which one can connect to the node */ -void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val); +void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); /** * An initial announcement of the node @@ -8113,18 +9103,20 @@ struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const s */ void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); -MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); +MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); -LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); -LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); +struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); + +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); void NodeInfo_free(struct LDKNodeInfo this_ptr); /** * All valid channels a node has announced */ -void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, LDKCVec_u64Z val); +void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** * Lowest fees enabling routing via any of the enabled, known channels to a node. @@ -8154,15 +9146,17 @@ struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNo */ void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); -MUST_USE_RES struct LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); +MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); + +struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); -LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); +struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); -LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); +struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); -LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); +struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); -LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); +struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); /** * Creates a new, empty, network graph. @@ -8177,7 +9171,7 @@ MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes ge * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** * For an already known node (from channel announcements), update its stored properties from a @@ -8185,7 +9179,7 @@ MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announ * given the associated signatures here we cannot relay the node announcement to any of our * peers. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); /** * Store or update channel info from a channel announcement. @@ -8197,7 +9191,7 @@ MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsign * If a `chain::Access` object is provided via `chain_access`, it will be called to verify * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access); /** * Store or update channel info from a channel announcement without verifying the associated @@ -8207,7 +9201,7 @@ MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_ann * If a `chain::Access` object is provided via `chain_access`, it will be called to verify * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access); /** * Close a channel if a corresponding HTLC fail was sent. @@ -8225,13 +9219,13 @@ void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** * 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. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); /* Text to put at the end of the generated file */