X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=a1b2258b9ca94ee31e67a720b22e3cdf29a4892d;hb=6291176e0e4acfa50a2c61d8704e139f601cb5d3;hp=45e4fa3ab6b72a601f0313dd0a9ced1816b233a0;hpb=52673d480e615b8b5113435e588da24267316c2e;p=rust-lightning diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 45e4fa3a..a1b2258b 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -1,6 +1,6 @@ /* Text to put at the beginning of the generated file. Probably a license. */ -/* Generated with cbindgen:0.14.4 */ +/* Generated with cbindgen:0.16.0 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -206,298 +206,441 @@ 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 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; - 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 LDKCResult_SecretKeyErrorZ { + union LDKCResult_SecretKeyErrorZPtr contents; + bool result_ok; +} LDKCResult_SecretKeyErrorZ; -typedef LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ; +typedef struct LDKPublicKey { + uint8_t compressed_form[33]; +} LDKPublicKey; -typedef union LDKCResultPtr_u8__ChannelMonitorUpdateErr { - uint8_t *result; - LDKChannelMonitorUpdateErr *err; -} LDKCResultPtr_u8__ChannelMonitorUpdateErr; +typedef union LDKCResult_PublicKeyErrorZPtr { + struct LDKPublicKey *result; + enum LDKSecp256k1Error *err; +} LDKCResult_PublicKeyErrorZPtr; -typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr { - LDKCResultPtr_u8__ChannelMonitorUpdateErr contents; +typedef struct LDKCResult_PublicKeyErrorZ { + union LDKCResult_PublicKeyErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__ChannelMonitorUpdateErr; +} LDKCResult_PublicKeyErrorZ; + + + +/** + * 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; + + + +/** + * An error in decoding a message or struct. + */ +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. + */ + LDKnativeDecodeError *inner; + bool is_owned; +} LDKDecodeError; -typedef LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ; +typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr { + struct LDKTxCreationKeys *result; + struct LDKDecodeError *err; +} LDKCResult_TxCreationKeysDecodeErrorZPtr; + +typedef struct LDKCResult_TxCreationKeysDecodeErrorZ { + union LDKCResult_TxCreationKeysDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_TxCreationKeysDecodeErrorZ; /** - * 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. + * One counterparty's public keys which do not change over the life of a channel. */ -typedef struct MUST_USE_STRUCT LDKMonitorUpdateError { +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. */ - LDKnativeMonitorUpdateError *inner; + LDKnativeChannelPublicKeys *inner; bool is_owned; -} LDKMonitorUpdateError; +} LDKChannelPublicKeys; -typedef union LDKCResultPtr_u8__MonitorUpdateError { - uint8_t *result; - LDKMonitorUpdateError *err; -} LDKCResultPtr_u8__MonitorUpdateError; +typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr { + struct LDKChannelPublicKeys *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelPublicKeysDecodeErrorZPtr; -typedef struct LDKCResultTempl_u8__MonitorUpdateError { - LDKCResultPtr_u8__MonitorUpdateError contents; +typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ { + union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__MonitorUpdateError; +} LDKCResult_ChannelPublicKeysDecodeErrorZ; -typedef LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ; +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; /** - * 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. + * Information about an HTLC as it appears in a commitment transaction */ -typedef struct MUST_USE_STRUCT LDKOutPoint { +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. */ - LDKnativeOutPoint *inner; + LDKnativeHTLCOutputInCommitment *inner; bool is_owned; -} LDKOutPoint; +} LDKHTLCOutputInCommitment; -typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z { - LDKOutPoint a; - LDKCVec_u8Z b; -} LDKC2TupleTempl_OutPoint__CVec_u8Z; +typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr { + struct LDKHTLCOutputInCommitment *result; + struct LDKDecodeError *err; +} LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr; -typedef LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ; +typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ { + union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_HTLCOutputInCommitmentDecodeErrorZ; -typedef struct LDKC2TupleTempl_u32__TxOut { - uint32_t a; - LDKTxOut b; -} LDKC2TupleTempl_u32__TxOut; -typedef 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. + * Late-bound per-channel counterparty data used to build transactions. */ -typedef struct LDKThirtyTwoBytes { - uint8_t data[32]; -} LDKThirtyTwoBytes; +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 struct LDKCVecTempl_C2TupleTempl_u32__TxOut { - LDKC2TupleTempl_u32__TxOut *data; - uintptr_t datalen; -} LDKCVecTempl_C2TupleTempl_u32__TxOut; +typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { + struct LDKCounterpartyChannelTransactionParameters *result; + struct LDKDecodeError *err; +} LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr; -typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut { - LDKThirtyTwoBytes a; - LDKCVecTempl_C2TupleTempl_u32__TxOut b; -} LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut; +typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ; -typedef LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; -typedef LDKCVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_u32TxOutZZ; -typedef struct LDKC2TupleTempl_u64__u64 { - uint64_t a; - uint64_t b; -} LDKC2TupleTempl_u64__u64; +/** + * 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 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. + */ + LDKnativeChannelTransactionParameters *inner; + bool is_owned; +} LDKChannelTransactionParameters; + +typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr { + struct LDKChannelTransactionParameters *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelTransactionParametersDecodeErrorZPtr; -typedef 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 { - LDKSignature *data; +typedef struct LDKCVec_SignatureZ { + struct LDKSignature *data; uintptr_t datalen; -} LDKCVecTempl_Signature; +} LDKCVec_SignatureZ; -typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature { - LDKSignature a; - LDKCVecTempl_Signature b; -} LDKC2TupleTempl_Signature__CVecTempl_Signature; -typedef LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ; -typedef LDKCVecTempl_Signature LDKCVec_SignatureZ; +/** + * 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 LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 { - LDKC2TupleTempl_Signature__CVecTempl_Signature *result; - uint8_t *err; -} LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8; +typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr { + struct LDKHolderCommitmentTransaction *result; + struct LDKDecodeError *err; +} LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr; -typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 { - LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 contents; +typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ { + union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8; - -typedef LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; +} LDKCResult_HolderCommitmentTransactionDecodeErrorZ; -typedef union LDKCResultPtr_Signature__u8 { - LDKSignature *result; - uint8_t *err; -} LDKCResultPtr_Signature__u8; -typedef struct LDKCResultTempl_Signature__u8 { - LDKCResultPtr_Signature__u8 contents; - bool result_ok; -} LDKCResultTempl_Signature__u8; -typedef LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ; +/** + * 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 union LDKCResultPtr_CVecTempl_Signature_____u8 { - LDKCVecTempl_Signature *result; - uint8_t *err; -} LDKCResultPtr_CVecTempl_Signature_____u8; +typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr { + struct LDKBuiltCommitmentTransaction *result; + struct LDKDecodeError *err; +} LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr; -typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 { - LDKCResultPtr_CVecTempl_Signature_____u8 contents; +typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ { + union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_CVecTempl_Signature_____u8; +} LDKCResult_BuiltCommitmentTransactionDecodeErrorZ; -typedef LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ; -/** - * 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) + * This class tracks the per-transaction information needed to build a commitment transaction and to + * actually build it and sign. It is used for holder transactions that we sign only when needed + * and for transactions we sign for the counterparty. + * + * This class can be used inside a signer implementation to generate a signature given the relevant + * secret key. */ -typedef enum LDKAPIError_Tag { +typedef struct MUST_USE_STRUCT LDKCommitmentTransaction { /** - * 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. + * Nearly everywhere, 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_APIMisuseError, + LDKnativeCommitmentTransaction *inner; + 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; + + + +/** + * 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. + */ +typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction { /** - * 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. + * Nearly everywhere, 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_FeeRateTooHigh, + LDKnativeTrustedCommitmentTransaction *inner; + bool is_owned; +} LDKTrustedCommitmentTransaction; + +typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr { + struct LDKTrustedCommitmentTransaction *result; /** - * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, - * too-many-hops, etc). + * Note that this value is always NULL, as there are no contents in the Err variant */ - LDKAPIError_RouteError, + 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; /** - * 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. + * Note that this value is always NULL, as there are no contents in the Err variant */ - LDKAPIError_ChannelUnavailable, + void *err; +} LDKCResult_CVec_SignatureZNoneZPtr; + +typedef struct LDKCResult_CVec_SignatureZNoneZ { + union LDKCResult_CVec_SignatureZNoneZPtr contents; + bool result_ok; +} LDKCResult_CVec_SignatureZNoneZ; + +typedef struct LDKCVec_PublicKeyZ { + struct LDKPublicKey *data; + uintptr_t datalen; +} LDKCVec_PublicKeyZ; + + + +/** + * 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 LDKPeerHandleError { /** - * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the - * attempted action to fail. + * Nearly everywhere, 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_MonitorUpdateFailed, + LDKnativePeerHandleError *inner; + bool is_owned; +} 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 { /** - * Must be last for serialization purposes + * Note that this value is always NULL, as there are no contents in the OK variant */ - LDKAPIError_Sentinel, -} LDKAPIError_Tag; + void *result; + struct LDKPeerHandleError *err; +} LDKCResult_NonePeerHandleErrorZPtr; -typedef struct LDKAPIError_LDKAPIMisuseError_Body { - LDKCVec_u8Z err; -} LDKAPIError_LDKAPIMisuseError_Body; +typedef struct LDKCResult_NonePeerHandleErrorZ { + union LDKCResult_NonePeerHandleErrorZPtr contents; + bool result_ok; +} LDKCResult_NonePeerHandleErrorZ; -typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { - LDKCVec_u8Z err; - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; +typedef union LDKCResult_boolPeerHandleErrorZPtr { + bool *result; + struct LDKPeerHandleError *err; +} LDKCResult_boolPeerHandleErrorZPtr; -typedef struct LDKAPIError_LDKRouteError_Body { - LDKStr err; -} LDKAPIError_LDKRouteError_Body; +typedef struct LDKCResult_boolPeerHandleErrorZ { + union LDKCResult_boolPeerHandleErrorZPtr contents; + bool result_ok; +} LDKCResult_boolPeerHandleErrorZ; -typedef struct LDKAPIError_LDKChannelUnavailable_Body { - LDKCVec_u8Z err; -} LDKAPIError_LDKChannelUnavailable_Body; -typedef 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 LDKCResultPtr_u8__APIError { - uint8_t *result; - LDKAPIError *err; -} LDKCResultPtr_u8__APIError; +/** + * Options which apply on a per-channel basis and may change at runtime or based on negotiation + * with our counterparty. + */ +typedef struct MUST_USE_STRUCT LDKChannelConfig { + /** + * Nearly everywhere, 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; + bool is_owned; +} LDKChannelConfig; + +typedef union LDKCResult_ChannelConfigDecodeErrorZPtr { + struct LDKChannelConfig *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelConfigDecodeErrorZPtr; -typedef struct LDKCResultTempl_u8__APIError { - LDKCResultPtr_u8__APIError contents; +typedef struct LDKCResult_ChannelConfigDecodeErrorZ { + union LDKCResult_ChannelConfigDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__APIError; - -typedef 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; - LDKPaymentSendFailure *err; -} LDKCResultPtr_u8__PaymentSendFailure; +typedef union LDKCResult_boolLightningErrorZPtr { + bool *result; + struct LDKLightningError *err; +} LDKCResult_boolLightningErrorZPtr; -typedef struct LDKCResultTempl_u8__PaymentSendFailure { - LDKCResultPtr_u8__PaymentSendFailure contents; +typedef struct LDKCResult_boolLightningErrorZ { + union LDKCResult_boolLightningErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__PaymentSendFailure; - -typedef LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ; +} LDKCResult_boolLightningErrorZ; @@ -527,282 +670,48 @@ typedef struct MUST_USE_STRUCT LDKChannelUpdate { bool is_owned; } LDKChannelUpdate; -typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate { - LDKChannelAnnouncement a; - LDKChannelUpdate b; - LDKChannelUpdate c; -} LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate; +typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + struct LDKChannelAnnouncement a; + struct LDKChannelUpdate b; + struct LDKChannelUpdate c; +} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; -typedef LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; +typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data; + uintptr_t datalen; +} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; /** - * 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 node_announcement message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKPeerHandleError { +typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { /** * Nearly everywhere, 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; + LDKnativeNodeAnnouncement *inner; bool is_owned; -} LDKPeerHandleError; +} LDKNodeAnnouncement; + +typedef struct LDKCVec_NodeAnnouncementZ { + struct LDKNodeAnnouncement *data; + uintptr_t datalen; +} LDKCVec_NodeAnnouncementZ; -typedef union LDKCResultPtr_u8__PeerHandleError { - uint8_t *result; - LDKPeerHandleError *err; -} LDKCResultPtr_u8__PeerHandleError; +typedef union LDKCResult_NoneLightningErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + struct LDKLightningError *err; +} LDKCResult_NoneLightningErrorZPtr; -typedef struct LDKCResultTempl_u8__PeerHandleError { - LDKCResultPtr_u8__PeerHandleError contents; +typedef struct LDKCResult_NoneLightningErrorZ { + union LDKCResult_NoneLightningErrorZPtr contents; bool result_ok; -} LDKCResultTempl_u8__PeerHandleError; - -typedef LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ; - - - -/** - * Information about an HTLC as it appears in a commitment transaction - */ -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 LDKC2TupleTempl_HTLCOutputInCommitment__Signature { - LDKHTLCOutputInCommitment a; - LDKSignature b; -} LDKC2TupleTempl_HTLCOutputInCommitment__Signature; - -typedef LDKC2TupleTempl_HTLCOutputInCommitment__Signature LDKC2Tuple_HTLCOutputInCommitmentSignatureZ; - -typedef struct LDKPublicKey { - uint8_t compressed_form[33]; -} LDKPublicKey; - -/** - * 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, 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. - */ - 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 - * 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::on_accept) 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_DynamicOutputP2WSH, - /** - * 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. - */ - LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment, - /** - * Must be last for serialization purposes - */ - LDKSpendableOutputDescriptor_Sentinel, -} LDKSpendableOutputDescriptor_Tag; - -typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { - LDKOutPoint outpoint; - LDKTxOut output; -} LDKSpendableOutputDescriptor_LDKStaticOutput_Body; - -typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body { - LDKOutPoint outpoint; - LDKPublicKey per_commitment_point; - uint16_t to_self_delay; - LDKTxOut output; - LDKC2Tuple_u64u64Z key_derivation_params; - LDKPublicKey revocation_pubkey; -} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body; - -typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body { - LDKOutPoint outpoint; - LDKTxOut output; - LDKC2Tuple_u64u64Z key_derivation_params; -} LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body; - -typedef struct LDKSpendableOutputDescriptor { - LDKSpendableOutputDescriptor_Tag tag; - union { - LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output; - LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh; - LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment; - }; -} LDKSpendableOutputDescriptor; - -typedef struct LDKCVecTempl_SpendableOutputDescriptor { - LDKSpendableOutputDescriptor *data; - uintptr_t datalen; -} LDKCVecTempl_SpendableOutputDescriptor; - -typedef LDKCVecTempl_SpendableOutputDescriptor 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 { - 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 { - LDKOutPoint funding_txo; - uint64_t user_channel_id; -} LDKEvent_LDKFundingBroadcastSafe_Body; - -typedef struct LDKEvent_LDKPaymentReceived_Body { - LDKThirtyTwoBytes payment_hash; - LDKThirtyTwoBytes payment_secret; - uint64_t amt; -} LDKEvent_LDKPaymentReceived_Body; - -typedef struct LDKEvent_LDKPaymentSent_Body { - LDKThirtyTwoBytes payment_preimage; -} LDKEvent_LDKPaymentSent_Body; - -typedef struct LDKEvent_LDKPaymentFailed_Body { - 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 { - LDKCVec_SpendableOutputDescriptorZ outputs; -} LDKEvent_LDKSpendableOutputs_Body; - -typedef 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; +} LDKCResult_NoneLightningErrorZ; @@ -961,20 +870,6 @@ typedef struct MUST_USE_STRUCT LDKChannelReestablish { -/** - * A node_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeNodeAnnouncement *inner; - bool is_owned; -} LDKNodeAnnouncement; - - - /** * An error message to be sent or received from a peer */ @@ -1010,14 +905,14 @@ typedef enum LDKErrorAction_Tag { } LDKErrorAction_Tag; typedef struct LDKErrorAction_LDKDisconnectPeer_Body { - LDKErrorMessage msg; + struct LDKErrorMessage msg; } LDKErrorAction_LDKDisconnectPeer_Body; typedef struct LDKErrorAction_LDKSendErrorMessage_Body { - LDKErrorMessage msg; + struct LDKErrorMessage msg; } LDKErrorAction_LDKSendErrorMessage_Body; -typedef struct LDKErrorAction { +typedef struct MUST_USE_STRUCT LDKErrorAction { LDKErrorAction_Tag tag; union { LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; @@ -1050,7 +945,7 @@ typedef enum LDKHTLCFailChannelUpdate_Tag { } LDKHTLCFailChannelUpdate_Tag; typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body { - LDKChannelUpdate msg; + struct LDKChannelUpdate msg; } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body; typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body { @@ -1059,11 +954,11 @@ typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body { } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body; typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body { - LDKPublicKey node_id; + struct LDKPublicKey node_id; bool is_permanent; } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body; -typedef struct LDKHTLCFailChannelUpdate { +typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate { LDKHTLCFailChannelUpdate_Tag tag; union { LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message; @@ -1072,17 +967,55 @@ typedef struct LDKHTLCFailChannelUpdate { }; } LDKHTLCFailChannelUpdate; + + /** - * 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. + * 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 enum LDKMessageSendEvent_Tag { +typedef struct MUST_USE_STRUCT LDKQueryChannelRange { /** - * Used to indicate that we've accepted a channel open and should send the accept_channel - * message provided to the given peer. + * Nearly everywhere, 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_SendAcceptChannel, + LDKnativeQueryChannelRange *inner; + bool is_owned; +} LDKQueryChannelRange; + + + +/** + * A query_short_channel_ids message is used to query a peer for + * routing gossip messages related to one or more short_channel_ids. + * The query recipient will reply with the latest, if available, + * channel_announcement, channel_update and node_announcement messages + * it maintains for the requested short_channel_ids followed by a + * reply_short_channel_ids_end message. The short_channel_ids sent in + * this query are encoded. We only support encoding_type=0 uncompressed + * serialization and do not support encoding_type=1 zlib serialization. + */ +typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { + /** + * Nearly everywhere, 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; + bool is_owned; +} LDKQueryShortChannelIds; + +/** + * An event generated by ChannelManager which indicates a message should be sent to a peer (or + * broadcast to most peers). + * These events are handled by PeerManager::process_events if you are using a PeerManager. + */ +typedef enum LDKMessageSendEvent_Tag { + /** + * 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. @@ -1153,6 +1086,15 @@ typedef enum LDKMessageSendEvent_Tag { * cases this event is generated so that we can inform the network graph of this information. */ LDKMessageSendEvent_PaymentFailureNetworkUpdate, + /** + * Query a peer for channels with funding transaction UTXOs in a block range. + */ + LDKMessageSendEvent_SendChannelRangeQuery, + /** + * Request routing gossip messages from a peer for a list of channels identified by + * their short_channel_ids. + */ + LDKMessageSendEvent_SendShortIdsQuery, /** * Must be last for serialization purposes */ @@ -1160,83 +1102,93 @@ typedef enum LDKMessageSendEvent_Tag { } LDKMessageSendEvent_Tag; typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { - LDKPublicKey node_id; - LDKAcceptChannel msg; + struct LDKPublicKey node_id; + struct LDKAcceptChannel msg; } LDKMessageSendEvent_LDKSendAcceptChannel_Body; typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { - LDKPublicKey node_id; - LDKOpenChannel msg; + struct LDKPublicKey node_id; + struct LDKOpenChannel msg; } LDKMessageSendEvent_LDKSendOpenChannel_Body; typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { - LDKPublicKey node_id; - LDKFundingCreated msg; + struct LDKPublicKey node_id; + struct LDKFundingCreated msg; } LDKMessageSendEvent_LDKSendFundingCreated_Body; typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { - LDKPublicKey node_id; - LDKFundingSigned msg; + struct LDKPublicKey node_id; + struct LDKFundingSigned msg; } LDKMessageSendEvent_LDKSendFundingSigned_Body; typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { - LDKPublicKey node_id; - LDKFundingLocked msg; + struct LDKPublicKey node_id; + struct LDKFundingLocked msg; } LDKMessageSendEvent_LDKSendFundingLocked_Body; typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { - LDKPublicKey node_id; - LDKAnnouncementSignatures msg; + struct LDKPublicKey node_id; + struct LDKAnnouncementSignatures msg; } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body { - LDKPublicKey node_id; - LDKCommitmentUpdate updates; + struct LDKPublicKey node_id; + struct LDKCommitmentUpdate updates; } LDKMessageSendEvent_LDKUpdateHTLCs_Body; typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body { - LDKPublicKey node_id; - LDKRevokeAndACK msg; + struct LDKPublicKey node_id; + struct LDKRevokeAndACK msg; } LDKMessageSendEvent_LDKSendRevokeAndACK_Body; typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { - LDKPublicKey node_id; - LDKClosingSigned msg; + struct LDKPublicKey node_id; + struct LDKClosingSigned msg; } LDKMessageSendEvent_LDKSendClosingSigned_Body; typedef struct LDKMessageSendEvent_LDKSendShutdown_Body { - LDKPublicKey node_id; - LDKShutdown msg; + struct LDKPublicKey node_id; + struct LDKShutdown msg; } LDKMessageSendEvent_LDKSendShutdown_Body; typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body { - LDKPublicKey node_id; - LDKChannelReestablish msg; + struct LDKPublicKey node_id; + struct LDKChannelReestablish msg; } LDKMessageSendEvent_LDKSendChannelReestablish_Body; typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { - LDKChannelAnnouncement msg; - LDKChannelUpdate update_msg; + struct LDKChannelAnnouncement msg; + struct LDKChannelUpdate update_msg; } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body { - LDKNodeAnnouncement msg; + struct LDKNodeAnnouncement msg; } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body; typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { - LDKChannelUpdate msg; + struct LDKChannelUpdate msg; } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body; typedef struct LDKMessageSendEvent_LDKHandleError_Body { - LDKPublicKey node_id; - LDKErrorAction action; + struct LDKPublicKey node_id; + struct LDKErrorAction action; } LDKMessageSendEvent_LDKHandleError_Body; typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body { - LDKHTLCFailChannelUpdate update; + struct LDKHTLCFailChannelUpdate update; } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body; -typedef struct LDKMessageSendEvent { +typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { + struct LDKPublicKey node_id; + struct LDKQueryChannelRange msg; +} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; + +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; @@ -1255,237 +1207,704 @@ typedef struct LDKMessageSendEvent { 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 { - LDKMessageSendEvent *data; +typedef struct LDKCVec_MessageSendEventZ { + struct LDKMessageSendEvent *data; uintptr_t datalen; -} LDKCVecTempl_MessageSendEvent; - -typedef LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ; - -/** - * A trait indicating an object may generate message send events - */ -typedef struct LDKMessageSendEventsProvider { - void *this_arg; - /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. - */ - LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); - void (*free)(void *this_arg); -} LDKMessageSendEventsProvider; +} LDKCVec_MessageSendEventZ; -typedef struct LDKCVecTempl_Event { - LDKEvent *data; - uintptr_t datalen; -} LDKCVecTempl_Event; -typedef LDKCVecTempl_Event LDKCVec_EventZ; /** - * A trait indicating an object may generate events + * Details about one direction of a channel. Received + * within a channel update. */ -typedef struct LDKEventsProvider { - void *this_arg; +typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo { /** - * 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; + LDKnativeDirectionalChannelInfo *inner; + bool is_owned; +} LDKDirectionalChannelInfo; -/** - * 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; +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; /** - * Configuration we set when applicable. - * - * Default::default() provides sane defaults. + * Details about a channel (both directions). + * Received within a channel announcement. */ -typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig { +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. */ - LDKnativeChannelHandshakeConfig *inner; + LDKnativeChannelInfo *inner; bool is_owned; -} LDKChannelHandshakeConfig; +} 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; /** - * 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. + * Fees for routing via a given channel or a node */ -typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits { +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. */ - LDKnativeChannelHandshakeLimits *inner; + LDKnativeRoutingFees *inner; bool is_owned; -} LDKChannelHandshakeLimits; +} 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; /** - * Options which apply on a per-channel basis and may change at runtime or based on negotiation - * with our counterparty. + * An address which can be used to connect to a remote peer */ -typedef struct MUST_USE_STRUCT LDKChannelConfig { +typedef enum LDKNetAddress_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. + * An IPv4 address/port on which the peer is listening. */ - LDKnativeChannelConfig *inner; - bool is_owned; -} LDKChannelConfig; + 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, + /** + * 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\". + */ + LDKNetAddress_OnionV3, + /** + * Must be last for serialization purposes + */ + LDKNetAddress_Sentinel, +} LDKNetAddress_Tag; -typedef struct LDKu8slice { - const uint8_t *data; +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; -} LDKu8slice; +} LDKCVec_NetAddressZ; /** - * Top-level config which holds ChannelHandshakeLimits and ChannelConfig. - * - * Default::default() provides sane defaults for most configurations - * (but currently with 0 relay fees!) + * Information received in the latest node_announcement from this node. */ -typedef struct MUST_USE_STRUCT LDKUserConfig { +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. */ - LDKnativeUserConfig *inner; + LDKnativeNodeAnnouncementInfo *inner; bool is_owned; -} LDKUserConfig; +} LDKNodeAnnouncementInfo; -typedef union LDKCResultPtr_TxOut__AccessError { - LDKTxOut *result; - LDKAccessError *err; -} LDKCResultPtr_TxOut__AccessError; +typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr { + struct LDKNodeAnnouncementInfo *result; + struct LDKDecodeError *err; +} LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr; -typedef struct LDKCResultTempl_TxOut__AccessError { - LDKCResultPtr_TxOut__AccessError contents; +typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ { + union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents; bool result_ok; -} LDKCResultTempl_TxOut__AccessError; +} LDKCResult_NodeAnnouncementInfoDecodeErrorZ; -typedef LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ; - -/** - * 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; +typedef struct LDKCVec_u64Z { + uint64_t *data; + uintptr_t datalen; +} LDKCVec_u64Z; /** - * One counterparty's public keys which do not change over the life of a channel. + * Details about a node in the network, known from the network announcement. */ -typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { +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. */ - LDKnativeChannelPublicKeys *inner; + LDKnativeNodeInfo *inner; bool is_owned; -} LDKChannelPublicKeys; +} 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; /** - * The per-commitment point and a set of pre-calculated public keys used for transaction creation - * in the signer. - * The pre-calculated keys are an optimization, because ChannelKeys has enough - * information to re-derive them. + * Represents the network as nodes and channels between them */ -typedef struct MUST_USE_STRUCT LDKPreCalculatedTxCreationKeys { +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. */ - LDKnativePreCalculatedTxCreationKeys *inner; + LDKnativeNetworkGraph *inner; bool is_owned; -} LDKPreCalculatedTxCreationKeys; +} 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 LDKCVecTempl_HTLCOutputInCommitment { - LDKHTLCOutputInCommitment *data; +typedef struct LDKC2Tuple_usizeTransactionZ { + uintptr_t a; + struct LDKTransaction b; +} LDKC2Tuple_usizeTransactionZ; + +typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { + struct LDKC2Tuple_usizeTransactionZ *data; uintptr_t datalen; -} LDKCVecTempl_HTLCOutputInCommitment; +} 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 LDKCVecTempl_HTLCOutputInCommitment LDKCVec_HTLCOutputInCommitmentZ; +typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ { + union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents; + bool result_ok; +} LDKCResult_NoneChannelMonitorUpdateErrZ; /** - * We use this to track holder commitment transactions and put off signing them until we are ready - * to broadcast. This class can be used inside a signer implementation to generate a signature - * given the relevant secret key. + * An event to be processed by the ChannelManager. */ -typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction { +typedef struct MUST_USE_STRUCT LDKMonitorEvent { /** * Nearly everywhere, 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; + LDKnativeMonitorEvent *inner; bool is_owned; -} LDKHolderCommitmentTransaction; +} LDKMonitorEvent; + +typedef struct LDKCVec_MonitorEventZ { + struct LDKMonitorEvent *data; + uintptr_t datalen; +} LDKCVec_MonitorEventZ; /** - * The unsigned part of a channel_announcement + * 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 LDKUnsignedChannelAnnouncement { +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. */ - LDKnativeUnsignedChannelAnnouncement *inner; + LDKnativeOutPoint *inner; bool is_owned; -} LDKUnsignedChannelAnnouncement; +} LDKOutPoint; -/** - * Set of lightning keys needed to operate a channel as described in BOLT 3. +typedef struct LDKC2Tuple_u64u64Z { + uint64_t a; + uint64_t b; +} LDKC2Tuple_u64u64Z; + +/** + * 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, 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. + */ + 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 + * 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. + */ + LDKSpendableOutputDescriptor_DynamicOutputP2WSH, + /** + * 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. + */ + LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment, + /** + * 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 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body { + struct LDKOutPoint outpoint; + struct LDKPublicKey per_commitment_point; + uint16_t to_self_delay; + struct LDKTxOut output; + struct LDKC2Tuple_u64u64Z key_derivation_params; + struct LDKPublicKey revocation_pubkey; +} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body; + +typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body { + struct LDKOutPoint outpoint; + struct LDKTxOut output; + struct LDKC2Tuple_u64u64Z key_derivation_params; +} LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body; + +typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { + LDKSpendableOutputDescriptor_Tag tag; + union { + LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output; + LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh; + LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment; + }; +} 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; + + + +/** + * 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; + +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; + +/** + * 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 @@ -1515,7 +1934,7 @@ typedef struct LDKChannelKeys { * * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. */ - LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); + 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 * @@ -1527,52 +1946,43 @@ typedef struct LDKChannelKeys { * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. * TODO: return a Result so we can signal a validation error */ - LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); + struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); /** * Gets the holder's channel public keys and basepoints */ - LDKChannelPublicKeys pubkeys; + 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 LDKChannelKeys*); + 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); + struct 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, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs); - /** - * Create a signature for a holder's commitment transaction. This will only ever be called with - * the same holder_commitment_tx (or a copy thereof), though there are currently no guarantees - * that it will not be called multiple times. - * An external signer implementation should check that the commitment has not been revoked. - */ - LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx); + struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx); /** - * Create a signature for each HTLC transaction spending a holder's commitment transaction. + * 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. * - * Unlike sign_holder_commitment, this may be called multiple times with *different* - * holder_commitment_tx values. While this will never be called with a revoked - * holder_commitment_tx, it is possible that it is called with the second-latest - * holder_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary - * ChannelMonitor decided to broadcast before it had been updated to the latest. + * An external signer implementation should check that the commitment has not been revoked. * - * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in - * holder_commitment_tx. For those HTLCs which have transaction_output_index set to None - * (implying they were considered dust at the time the commitment transaction was negotiated), - * a corresponding None should be included in the return value. All other positions in the - * return value must contain a signature. + * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case. */ - LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx); + 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. @@ -1593,7 +2003,7 @@ typedef struct LDKChannelKeys { * 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, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc); + 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. @@ -1613,14 +2023,14 @@ typedef struct LDKChannelKeys { * 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, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc); + 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. */ - LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, LDKTransaction closing_tx); + 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. @@ -1629,17 +2039,22 @@ typedef struct LDKChannelKeys { * 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 LDKUnsignedChannelAnnouncement *msg); + struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** - * Set the counterparty channel basepoints and counterparty_selected/holder_selected_contest_delay. - * This is done immediately on incoming channels and as soon as the channel is accepted on outgoing channels. + * 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 (*on_accept)(void *this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay); + 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); } LDKChannelKeys; @@ -1656,51 +2071,186 @@ typedef struct LDKChannelKeys { * 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. + * Nearly everywhere, 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 */ - LDKnativeChannelMonitor *inner; - bool is_owned; -} LDKChannelMonitor; + void *result; + struct LDKAPIError *err; +} LDKCResult_NoneAPIErrorZPtr; + +typedef struct LDKCResult_NoneAPIErrorZ { + union LDKCResult_NoneAPIErrorZPtr contents; + bool result_ok; +} LDKCResult_NoneAPIErrorZ; /** - * An update generated by the underlying Channel itself which contains some new information the - * ChannelMonitor should be made aware of. + * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels */ -typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { +typedef struct MUST_USE_STRUCT LDKChannelDetails { /** * Nearly everywhere, 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; + LDKnativeChannelDetails *inner; bool is_owned; -} LDKChannelMonitorUpdate; +} LDKChannelDetails; + +typedef struct LDKCVec_ChannelDetailsZ { + struct LDKChannelDetails *data; + uintptr_t datalen; +} LDKCVec_ChannelDetailsZ; /** - * An event to be processed by the ChannelManager. + * 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 struct MUST_USE_STRUCT LDKMonitorEvent { +typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { /** * Nearly everywhere, 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; + LDKnativePaymentSendFailure *inner; bool is_owned; -} LDKMonitorEvent; +} LDKPaymentSendFailure; -typedef struct LDKCVecTempl_MonitorEvent { - LDKMonitorEvent *data; - uintptr_t datalen; -} LDKCVecTempl_MonitorEvent; +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 LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ; +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 @@ -1738,7 +2288,7 @@ typedef struct LDKWatch { * [`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, LDKOutPoint funding_txo, LDKChannelMonitor monitor); + 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. * @@ -1748,64 +2298,81 @@ typedef struct LDKWatch { * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update); + 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. */ - LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); + struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); void (*free)(void *this_arg); } LDKWatch; /** - * 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 + * An interface to send a transaction to the Bitcoin network. */ -typedef struct LDKFilter { +typedef struct LDKBroadcasterInterface { 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], LDKu8slice script_pubkey); - /** - * Registers interest in spends of a transaction output identified by `outpoint` having - * `script_pubkey` as the spending condition. + * Sends a transaction out to (hopefully) be mined. */ - void (*register_output)(const void *this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey); + void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); void (*free)(void *this_arg); -} LDKFilter; +} LDKBroadcasterInterface; + +typedef union LDKCResult_ChannelKeysDecodeErrorZPtr { + struct LDKChannelKeys *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelKeysDecodeErrorZPtr; + +typedef struct LDKCResult_ChannelKeysDecodeErrorZ { + union LDKCResult_ChannelKeysDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelKeysDecodeErrorZ; + +typedef struct LDKu8slice { + const uint8_t *data; + uintptr_t datalen; +} LDKu8slice; /** - * An interface to send a transaction to the Bitcoin network. + * A trait to describe an object which can get user secrets and key material. */ -typedef struct LDKBroadcasterInterface { +typedef struct LDKKeysInterface { void *this_arg; /** - * Sends a transaction out to (hopefully) be mined. + * 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. + */ + struct 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. */ - void (*broadcast_transaction)(const void *this_arg, LDKTransaction tx); + struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); + /** + * 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. + */ + struct LDKCResult_ChannelKeysDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); void (*free)(void *this_arg); -} LDKBroadcasterInterface; +} LDKKeysInterface; /** * A trait which should be implemented to provide feerate information on a number of time @@ -1826,482 +2393,1018 @@ typedef struct LDKFeeEstimator { * * satoshis-per-byte * 250 * * ceil(satoshis-per-kbyte / 4) */ - uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target); + uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); void (*free)(void *this_arg); } LDKFeeEstimator; /** - * `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 trait encapsulating the operations required of a logger */ -typedef struct LDKPersist { +typedef struct LDKLogger { 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 + * Logs the `Record` */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, LDKOutPoint id, const LDKChannelMonitor *data); + 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 { /** - * 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, LDKOutPoint id, const LDKChannelMonitorUpdate *update, const LDKChannelMonitor *data); - void (*free)(void *this_arg); -} LDKPersist; + 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; + + + +/** + * 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. + */ +typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys { + /** + * Nearly everywhere, 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; + bool is_owned; +} LDKInMemoryChannelKeys; + +typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr { + struct LDKInMemoryChannelKeys *result; + struct LDKDecodeError *err; +} LDKCResult_InMemoryChannelKeysDecodeErrorZPtr; + +typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ { + union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_InMemoryChannelKeysDecodeErrorZ; + + + +/** + * 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; + +typedef struct LDKCVec_RouteHopZ { + struct LDKRouteHop *data; + uintptr_t datalen; +} LDKCVec_RouteHopZ; + +typedef struct LDKCVec_CVec_RouteHopZZ { + struct LDKCVec_RouteHopZ *data; + uintptr_t datalen; +} LDKCVec_CVec_RouteHopZZ; /** - * 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 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 LDKChainMonitor { +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. */ - LDKnativeChainMonitor *inner; + LDKnativeRoute *inner; bool is_owned; -} LDKChainMonitor; +} LDKRoute; -typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction { - LDKC2TupleTempl_usize__Transaction *data; - uintptr_t datalen; -} LDKCVecTempl_C2TupleTempl_usize__Transaction; +typedef union LDKCResult_RouteDecodeErrorZPtr { + struct LDKRoute *result; + struct LDKDecodeError *err; +} LDKCResult_RouteDecodeErrorZPtr; -typedef LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ; +typedef struct LDKCResult_RouteDecodeErrorZ { + union LDKCResult_RouteDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_RouteDecodeErrorZ; /** - * 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 + * A channel descriptor which provides a last-hop route to get_route */ -typedef struct MUST_USE_STRUCT LDKHTLCUpdate { +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. */ - LDKnativeHTLCUpdate *inner; + LDKnativeRouteHint *inner; bool is_owned; -} LDKHTLCUpdate; +} LDKRouteHint; -typedef struct LDKCVecTempl_Transaction { - LDKTransaction *data; +typedef struct LDKCVec_RouteHintZ { + struct LDKRouteHint *data; uintptr_t datalen; -} LDKCVecTempl_Transaction; +} LDKCVec_RouteHintZ; -typedef LDKCVecTempl_Transaction LDKCVec_TransactionZ; +typedef union LDKCResult_RouteLightningErrorZPtr { + struct LDKRoute *result; + struct LDKLightningError *err; +} LDKCResult_RouteLightningErrorZPtr; -typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut { - LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut *data; +typedef struct LDKCResult_RouteLightningErrorZ { + union LDKCResult_RouteLightningErrorZPtr contents; + bool result_ok; +} LDKCResult_RouteLightningErrorZ; + +typedef union LDKCResult_NetAddressu8ZPtr { + struct LDKNetAddress *result; + uint8_t *err; +} LDKCResult_NetAddressu8ZPtr; + +typedef struct LDKCResult_NetAddressu8Z { + union LDKCResult_NetAddressu8ZPtr contents; + bool result_ok; +} LDKCResult_NetAddressu8Z; + +typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr { + struct LDKCResult_NetAddressu8Z *result; + struct LDKDecodeError *err; +} LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr; + +typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ { + union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_CResult_NetAddressu8ZDecodeErrorZ; + + + +/** + * 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_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut; +} LDKCVec_UpdateAddHTLCZ; -typedef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ; -typedef struct LDKSecretKey { - uint8_t bytes[32]; -} LDKSecretKey; /** - * A trait to describe an object which can get user secrets and key material. + * An update_fulfill_htlc message to be sent or received from a peer */ -typedef struct LDKKeysInterface { - void *this_arg; +typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC { /** - * Get node secret key (aka node_id or network_key) + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKSecretKey (*get_node_secret)(const void *this_arg); + LDKnativeUpdateFulfillHTLC *inner; + bool is_owned; +} LDKUpdateFulfillHTLC; + +typedef struct LDKCVec_UpdateFulfillHTLCZ { + struct LDKUpdateFulfillHTLC *data; + uintptr_t datalen; +} LDKCVec_UpdateFulfillHTLCZ; + + + +/** + * An update_fail_htlc message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC { /** - * Get destination redeemScript to encumber static protocol exit points. + * Nearly everywhere, 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_u8Z (*get_destination_script)(const void *this_arg); + LDKnativeUpdateFailHTLC *inner; + bool is_owned; +} LDKUpdateFailHTLC; + +typedef struct LDKCVec_UpdateFailHTLCZ { + struct LDKUpdateFailHTLC *data; + uintptr_t datalen; +} LDKCVec_UpdateFailHTLCZ; + + + +/** + * An update_fail_malformed_htlc message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC { /** - * Get shutdown_pubkey to use as PublicKey at channel closure + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg); + LDKnativeUpdateFailMalformedHTLC *inner; + bool is_owned; +} 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; + +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 LDKCommitmentSigned { /** - * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); + LDKnativeCommitmentSigned *inner; + bool is_owned; +} 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; + + + +/** + * An init message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKInit { /** - * 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. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); - void (*free)(void *this_arg); -} LDKKeysInterface; + LDKnativeInit *inner; + bool is_owned; +} 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; /** - * A simple implementation of ChannelKeys that just keeps the private keys in memory. + * An update_fee message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys { +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. */ - LDKnativeInMemoryChannelKeys *inner; + LDKnativeUpdateFee *inner; bool is_owned; -} LDKInMemoryChannelKeys; +} LDKUpdateFee; + +typedef union LDKCResult_UpdateFeeDecodeErrorZPtr { + struct LDKUpdateFee *result; + struct LDKDecodeError *err; +} LDKCResult_UpdateFeeDecodeErrorZPtr; + +typedef struct LDKCResult_UpdateFeeDecodeErrorZ { + union LDKCResult_UpdateFeeDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UpdateFeeDecodeErrorZ; + +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; /** - * 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! + * A ping message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKKeysManager { +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. */ - LDKnativeKeysManager *inner; + LDKnativePing *inner; bool is_owned; -} LDKKeysManager; +} 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; /** - * 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 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; + +typedef union LDKCResult_PongDecodeErrorZPtr { + struct LDKPong *result; + struct LDKDecodeError *err; +} LDKCResult_PongDecodeErrorZPtr; + +typedef struct LDKCResult_PongDecodeErrorZ { + union LDKCResult_PongDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_PongDecodeErrorZ; + +typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr { + struct LDKUnsignedChannelAnnouncement *result; + struct LDKDecodeError *err; +} LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr; + +typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ { + union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ; + +typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr { + struct LDKChannelAnnouncement *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelAnnouncementDecodeErrorZPtr; + +typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ { + union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelAnnouncementDecodeErrorZ; + + + +/** + * The unsigned part of a channel_update */ -typedef struct MUST_USE_STRUCT LDKChannelManager { +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. */ - LDKnativeChannelManager *inner; + LDKnativeUnsignedChannelUpdate *inner; bool is_owned; -} LDKChannelManager; +} LDKUnsignedChannelUpdate; + +typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr { + struct LDKUnsignedChannelUpdate *result; + struct LDKDecodeError *err; +} LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr; + +typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ { + union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UnsignedChannelUpdateDecodeErrorZ; + +typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr { + struct LDKChannelUpdate *result; + struct LDKDecodeError *err; +} LDKCResult_ChannelUpdateDecodeErrorZPtr; + +typedef struct LDKCResult_ChannelUpdateDecodeErrorZ { + union LDKCResult_ChannelUpdateDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ChannelUpdateDecodeErrorZ; + +typedef union LDKCResult_ErrorMessageDecodeErrorZPtr { + struct LDKErrorMessage *result; + struct LDKDecodeError *err; +} LDKCResult_ErrorMessageDecodeErrorZPtr; + +typedef struct LDKCResult_ErrorMessageDecodeErrorZ { + union LDKCResult_ErrorMessageDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ErrorMessageDecodeErrorZ; /** - * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + * The unsigned part of a node_announcement */ -typedef struct MUST_USE_STRUCT LDKChannelDetails { +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. */ - LDKnativeChannelDetails *inner; + LDKnativeUnsignedNodeAnnouncement *inner; bool is_owned; -} LDKChannelDetails; +} LDKUnsignedNodeAnnouncement; + +typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr { + struct LDKUnsignedNodeAnnouncement *result; + struct LDKDecodeError *err; +} LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr; + +typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ { + union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ; + +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; + +typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ { + union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_QueryShortChannelIdsDecodeErrorZ; /** - * Features used within an `init` message. + * 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 LDKInitFeatures { +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. */ - LDKnativeInitFeatures *inner; + LDKnativeReplyShortChannelIdsEnd *inner; bool is_owned; -} LDKInitFeatures; +} LDKReplyShortChannelIdsEnd; -typedef struct LDKCVecTempl_ChannelDetails { - LDKChannelDetails *data; - uintptr_t datalen; -} LDKCVecTempl_ChannelDetails; +typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr { + struct LDKReplyShortChannelIdsEnd *result; + struct LDKDecodeError *err; +} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr; -typedef LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ; +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; /** - * 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 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 LDKRoute { +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. */ - LDKnativeRoute *inner; + LDKnativeReplyChannelRange *inner; bool is_owned; -} LDKRoute; +} LDKReplyChannelRange; -typedef struct LDKThreeBytes { - uint8_t data[3]; -} LDKThreeBytes; +typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr { + struct LDKReplyChannelRange *result; + struct LDKDecodeError *err; +} LDKCResult_ReplyChannelRangeDecodeErrorZPtr; -typedef struct LDKFourBytes { - uint8_t data[4]; -} LDKFourBytes; +typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ { + union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_ReplyChannelRangeDecodeErrorZ; -typedef struct LDKSixteenBytes { - uint8_t data[16]; -} LDKSixteenBytes; -typedef struct LDKTenBytes { - uint8_t data[10]; -} LDKTenBytes; /** - * An address which can be used to connect to a remote peer + * 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 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, - /** - * 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\". - */ - LDKNetAddress_OnionV3, +typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter { /** - * 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. */ - LDKNetAddress_Sentinel, -} LDKNetAddress_Tag; - -typedef struct LDKNetAddress_LDKIPv4_Body { - LDKFourBytes addr; - uint16_t port; -} LDKNetAddress_LDKIPv4_Body; - -typedef struct LDKNetAddress_LDKIPv6_Body { - LDKSixteenBytes addr; - uint16_t port; -} LDKNetAddress_LDKIPv6_Body; - -typedef struct LDKNetAddress_LDKOnionV2_Body { - LDKTenBytes addr; - uint16_t port; -} LDKNetAddress_LDKOnionV2_Body; + LDKnativeGossipTimestampFilter *inner; + bool is_owned; +} LDKGossipTimestampFilter; -typedef struct LDKNetAddress_LDKOnionV3_Body { - LDKThirtyTwoBytes ed25519_pubkey; - uint16_t checksum; - uint8_t version; - uint16_t port; -} LDKNetAddress_LDKOnionV3_Body; +typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr { + struct LDKGossipTimestampFilter *result; + struct LDKDecodeError *err; +} LDKCResult_GossipTimestampFilterDecodeErrorZPtr; -typedef 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 LDKCResult_GossipTimestampFilterDecodeErrorZ { + union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_GossipTimestampFilterDecodeErrorZ; -typedef struct LDKCVecTempl_NetAddress { - LDKNetAddress *data; - uintptr_t datalen; -} LDKCVecTempl_NetAddress; +/** + * A trait indicating an object may generate message send events + */ +typedef struct LDKMessageSendEventsProvider { + void *this_arg; + /** + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. + */ + struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); + void (*free)(void *this_arg); +} LDKMessageSendEventsProvider; -typedef LDKCVecTempl_NetAddress LDKCVec_NetAddressZ; +/** + * A trait indicating an object may generate events + */ +typedef struct LDKEventsProvider { + void *this_arg; + /** + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. + */ + 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; - bool is_owned; -} LDKUpdateFailHTLC; - - + LDKnativeUserConfig *inner; + bool is_owned; +} 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 `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; /** - * An update_fail_malformed_htlc 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 LDKUpdateFailMalformedHTLC { +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 */ - LDKnativeUpdateFailMalformedHTLC *inner; - bool is_owned; -} LDKUpdateFailMalformedHTLC; + 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; /** - * A commitment_signed 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 LDKCommitmentSigned { +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. */ - LDKnativeCommitmentSigned *inner; + LDKnativeChainMonitor *inner; bool is_owned; -} LDKCommitmentSigned; +} LDKChainMonitor; /** - * An update_fee 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 LDKUpdateFee { +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. */ - LDKnativeUpdateFee *inner; + LDKnativeKeysManager *inner; bool is_owned; -} LDKUpdateFee; +} LDKKeysManager; /** - * An init message to be sent or received from a peer + * Features used within an `init` message. */ -typedef struct MUST_USE_STRUCT LDKInit { +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. */ - LDKnativeInit *inner; + LDKnativeInitFeatures *inner; bool is_owned; -} LDKInit; +} LDKInitFeatures; + +typedef struct LDKThreeBytes { + uint8_t data[3]; +} LDKThreeBytes; /** * A trait to describe an object which can receive channel messages. @@ -2314,83 +3417,83 @@ typedef struct LDKChannelMessageHandler { /** * Handle an incoming open_channel message from the given peer. */ - void (*handle_open_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg); + void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg); /** * Handle an incoming accept_channel message from the given peer. */ - void (*handle_accept_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg); + void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg); /** * Handle an incoming funding_created message from the given peer. */ - void (*handle_funding_created)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg); + void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg); /** * Handle an incoming funding_signed message from the given peer. */ - void (*handle_funding_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg); + void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg); /** * Handle an incoming funding_locked message from the given peer. */ - void (*handle_funding_locked)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg); + void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg); /** * Handle an incoming shutdown message from the given peer. */ - void (*handle_shutdown)(const void *this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg); + void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg); /** * Handle an incoming closing_signed message from the given peer. */ - void (*handle_closing_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg); + void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg); /** * Handle an incoming update_add_htlc message from the given peer. */ - void (*handle_update_add_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg); + void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg); /** * Handle an incoming update_fulfill_htlc message from the given peer. */ - void (*handle_update_fulfill_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg); + void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg); /** * Handle an incoming update_fail_htlc message from the given peer. */ - void (*handle_update_fail_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg); + void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg); /** * Handle an incoming update_fail_malformed_htlc message from the given peer. */ - void (*handle_update_fail_malformed_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg); + void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg); /** * Handle an incoming commitment_signed message from the given peer. */ - void (*handle_commitment_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg); + void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg); /** * Handle an incoming revoke_and_ack message from the given peer. */ - void (*handle_revoke_and_ack)(const void *this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg); + void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg); /** * Handle an incoming update_fee message from the given peer. */ - void (*handle_update_fee)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg); + 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, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg); + 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, LDKPublicKey their_node_id, bool no_connection_possible); + 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, LDKPublicKey their_node_id, const LDKInit *msg); + 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, LDKPublicKey their_node_id, const LDKChannelReestablish *msg); + 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, LDKPublicKey their_node_id, const LDKErrorMessage *msg); - LDKMessageSendEventsProvider MessageSendEventsProvider; + 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; @@ -2421,923 +3524,987 @@ typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { bool is_owned; } LDKChannelManagerReadArgs; -typedef struct LDKCVecTempl_ChannelMonitor { - LDKChannelMonitor *data; - uintptr_t datalen; -} LDKCVecTempl_ChannelMonitor; -typedef LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ; + +/** + * 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; /** - * An error in decoding a message or struct. + * Features used within a `node_announcement` message. */ -typedef struct MUST_USE_STRUCT LDKDecodeError { +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. */ - LDKnativeDecodeError *inner; + LDKnativeNodeFeatures *inner; bool is_owned; -} LDKDecodeError; +} LDKNodeFeatures; /** - * A ping message to be sent or received from a peer + * Features used within a `channel_announcement` message. */ -typedef struct MUST_USE_STRUCT LDKPing { +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. */ - LDKnativePing *inner; + LDKnativeChannelFeatures *inner; bool is_owned; -} LDKPing; +} LDKChannelFeatures; + +/** + * A trait to describe an object which can receive routing messages. + * + * # Implementor DoS Warnings + * + * For `gossip_queries` messages there are potential DoS vectors when handling + * inbound queries. Implementors using an on-disk network graph should be aware of + * repeated disk I/O for queries accessing different parts of the network graph. + */ +typedef struct LDKRoutingMessageHandler { + void *this_arg; + /** + * Handle an incoming node_announcement message, returning true if it should be forwarded on, + * false or returning an Err otherwise. + */ + struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); + /** + * Handle a channel_announcement message, returning true if it should be forwarded on, false + * or returning an Err otherwise. + */ + struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); + /** + * Handle an incoming channel_update message, returning true if it should be forwarded on, + * false or returning an Err otherwise. + */ + struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); + /** + * 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; /** - * A pong message to be sent or received from a peer + * Provides references to trait impls which handle different types of messages. */ -typedef struct MUST_USE_STRUCT LDKPong { +typedef struct MUST_USE_STRUCT LDKMessageHandler { /** * Nearly everywhere, 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; + LDKnativeMessageHandler *inner; bool is_owned; -} LDKPong; +} LDKMessageHandler; + +/** + * Provides an object which can be used to send data to and which uniquely identifies a connection + * to a remote host. You will need to be able to generate multiple of these which meet Eq and + * implement Hash to meet the PeerManager API. + * + * For efficiency, Clone should be relatively cheap for this type. + * + * You probably want to just extend an int and put a file descriptor in a struct and implement + * send_data. Note that if you are using a higher-level net library that may call close() itself, + * be careful to ensure you don't have races whereby you might register a new connection with an + * fd which is the same as a previous one which has yet to be removed via + * PeerManager::socket_disconnected(). + */ +typedef struct LDKSocketDescriptor { + void *this_arg; + /** + * Attempts to send some data from the given slice to the peer. + * + * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected. + * Note that in the disconnected case, socket_disconnected must still fire and further write + * attempts may occur until that time. + * + * If the returned size is smaller than data.len(), a write_available event must + * trigger the next time more data can be written. Additionally, until the a send_data event + * completes fully, no further read_events should trigger on the same peer! + * + * If a read_event on this descriptor had previously returned true (indicating that read + * events should be paused to prevent DoS in the send buffer), resume_read may be set + * indicating that read events on this descriptor should resume. A resume_read of false does + * *not* imply that further read events should be paused. + */ + uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read); + /** + * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no + * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with + * this descriptor. No socket_disconnected call should be generated as a result of this call, + * though races may occur whereby disconnect_socket is called after a call to + * socket_disconnected but prior to socket_disconnected returning. + */ + void (*disconnect_socket)(void *this_arg); + bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg); + uint64_t (*hash)(const void *this_arg); + void *(*clone)(const void *this_arg); + void (*free)(void *this_arg); +} LDKSocketDescriptor; /** - * 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. + * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket + * events into messages which it passes on to its MessageHandlers. + * + * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager + * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but + * essentially you should default to using a SimpleRefPeerManager, and use a + * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when + * you're using lightning-net-tokio. */ -typedef struct MUST_USE_STRUCT LDKDataLossProtect { +typedef struct MUST_USE_STRUCT LDKPeerManager { /** * Nearly everywhere, 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; + LDKnativePeerManager *inner; bool is_owned; -} LDKDataLossProtect; +} LDKPeerManager; /** - * The unsigned part of a node_announcement + * 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. */ -typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement { +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. */ - LDKnativeUnsignedNodeAnnouncement *inner; + LDKnativeDirectedChannelTransactionParameters *inner; bool is_owned; -} LDKUnsignedNodeAnnouncement; +} LDKDirectedChannelTransactionParameters; /** - * Features used within a `node_announcement` message. + * 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 LDKNodeFeatures { +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. */ - LDKnativeNodeFeatures *inner; + LDKnativeLockedNetworkGraph *inner; bool is_owned; -} LDKNodeFeatures; +} LDKLockedNetworkGraph; /** - * Features used within a `channel_announcement` message. + * 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 LDKChannelFeatures { +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. */ - LDKnativeChannelFeatures *inner; + LDKnativeNetGraphMsgHandler *inner; bool is_owned; -} LDKChannelFeatures; +} LDKNetGraphMsgHandler; +extern const uintptr_t MAX_BUF_SIZE; +extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; -/** - * The unsigned part of a channel_update - */ -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. - */ - LDKnativeUnsignedChannelUpdate *inner; - bool is_owned; -} LDKUnsignedChannelUpdate; +extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; +void Transaction_free(struct LDKTransaction _res); +void TxOut_free(struct LDKTxOut _res); -/** - * A query_channel_range message is used to query a peer for channel - * UTXOs in a range of blocks. The recipient of a query makes a best - * effort to reply to the query using one or more reply_channel_range - * messages. - */ -typedef struct MUST_USE_STRUCT LDKQueryChannelRange { - /** - * Nearly everywhere, 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; - bool is_owned; -} LDKQueryChannelRange; +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); -/** - * 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 { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeReplyChannelRange *inner; - bool is_owned; -} LDKReplyChannelRange; +void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res); -typedef struct LDKCVecTempl_u64 { - uint64_t *data; - uintptr_t datalen; -} LDKCVecTempl_u64; +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); -typedef LDKCVecTempl_u64 LDKCVec_u64Z; +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); -/** - * A query_short_channel_ids message is used to query a peer for - * routing gossip messages related to one or more short_channel_ids. - * The query recipient will reply with the latest, if available, - * channel_announcement, channel_update and node_announcement messages - * it maintains for the requested short_channel_ids followed by a - * reply_short_channel_ids_end message. The short_channel_ids sent in - * this query are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. - */ -typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { - /** - * Nearly everywhere, 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; - bool is_owned; -} LDKQueryShortChannelIds; +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); -/** - * 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 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. - */ - LDKnativeReplyShortChannelIdsEnd *inner; - bool is_owned; -} LDKReplyShortChannelIdsEnd; +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); -/** - * A gossip_timestamp_filter message is used by a node to request - * gossip relay for messages in the requested time range when the - * gossip_queries feature has been negotiated. - */ -typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter { - /** - * Nearly everywhere, 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; - bool is_owned; -} LDKGossipTimestampFilter; +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_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_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 LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); + +void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); + +void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); + +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void); + +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e); + +void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res); + +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); + +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); + +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); + +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); + +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); + +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); + +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); + +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); + +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); + +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); + +void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); + +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); + +void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); + +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); + +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); + +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); + +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); -/** - * An Err type for failure to process messages. - */ -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. - */ - LDKnativeLightningError *inner; - bool is_owned; -} LDKLightningError; +void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); -typedef struct LDKCVecTempl_UpdateAddHTLC { - LDKUpdateAddHTLC *data; - uintptr_t datalen; -} LDKCVecTempl_UpdateAddHTLC; +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); -typedef LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ; +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); -typedef struct LDKCVecTempl_UpdateFulfillHTLC { - LDKUpdateFulfillHTLC *data; - uintptr_t datalen; -} LDKCVecTempl_UpdateFulfillHTLC; +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); -typedef LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ; +void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); -typedef struct LDKCVecTempl_UpdateFailHTLC { - LDKUpdateFailHTLC *data; - uintptr_t datalen; -} LDKCVecTempl_UpdateFailHTLC; +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); -typedef LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ; +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); -typedef struct LDKCVecTempl_UpdateFailMalformedHTLC { - LDKUpdateFailMalformedHTLC *data; - uintptr_t datalen; -} LDKCVecTempl_UpdateFailMalformedHTLC; +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); -typedef LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ; +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); -typedef union LDKCResultPtr_bool__LightningError { - bool *result; - LDKLightningError *err; -} LDKCResultPtr_bool__LightningError; +void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); -typedef struct LDKCResultTempl_bool__LightningError { - LDKCResultPtr_bool__LightningError contents; - bool result_ok; -} LDKCResultTempl_bool__LightningError; +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); -typedef LDKCResultTempl_bool__LightningError LDKCResult_boolLightningErrorZ; +void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); -typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate { - LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data; - uintptr_t datalen; -} LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate; +struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); -typedef LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; +void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); -typedef struct LDKCVecTempl_NodeAnnouncement { - LDKNodeAnnouncement *data; - uintptr_t datalen; -} LDKCVecTempl_NodeAnnouncement; +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); -typedef LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ; +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); -/** - * A trait to describe an object which can receive routing messages. - */ -typedef struct LDKRoutingMessageHandler { - void *this_arg; - /** - * Handle an incoming node_announcement message, returning true if it should be forwarded on, - * false or returning an Err otherwise. - */ - LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const LDKNodeAnnouncement *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 LDKChannelAnnouncement *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 LDKChannelUpdate *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 LDKHTLCFailChannelUpdate *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, LDKPublicKey starting_point, uint8_t batch_amount); - /** - * Returns whether a full sync should be requested from a peer. - */ - bool (*should_request_full_sync)(const void *this_arg, LDKPublicKey node_id); - void (*free)(void *this_arg); -} LDKRoutingMessageHandler; +void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); -/** - * Provides references to trait impls which handle different types of messages. - */ -typedef struct MUST_USE_STRUCT LDKMessageHandler { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeMessageHandler *inner; - bool is_owned; -} LDKMessageHandler; +void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); -/** - * Provides an object which can be used to send data to and which uniquely identifies a connection - * to a remote host. You will need to be able to generate multiple of these which meet Eq and - * implement Hash to meet the PeerManager API. - * - * For efficiency, Clone should be relatively cheap for this type. - * - * You probably want to just extend an int and put a file descriptor in a struct and implement - * send_data. Note that if you are using a higher-level net library that may call close() itself, - * be careful to ensure you don't have races whereby you might register a new connection with an - * fd which is the same as a previous one which has yet to be removed via - * PeerManager::socket_disconnected(). - */ -typedef struct LDKSocketDescriptor { - void *this_arg; - /** - * Attempts to send some data from the given slice to the peer. - * - * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected. - * Note that in the disconnected case, socket_disconnected must still fire and further write - * attempts may occur until that time. - * - * If the returned size is smaller than data.len(), a write_available event must - * trigger the next time more data can be written. Additionally, until the a send_data event - * completes fully, no further read_events should trigger on the same peer! - * - * If a read_event on this descriptor had previously returned true (indicating that read - * events should be paused to prevent DoS in the send buffer), resume_read may be set - * indicating that read events on this descriptor should resume. A resume_read of false does - * *not* imply that further read events should be paused. - */ - uintptr_t (*send_data)(void *this_arg, LDKu8slice data, bool resume_read); - /** - * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no - * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with - * this descriptor. No socket_disconnected call should be generated as a result of this call, - * though races may occur whereby disconnect_socket is called after a call to - * socket_disconnected but prior to socket_disconnected returning. - */ - void (*disconnect_socket)(void *this_arg); - bool (*eq)(const void *this_arg, const LDKSocketDescriptor *other_arg); - uint64_t (*hash)(const void *this_arg); - void *(*clone)(const void *this_arg); - void (*free)(void *this_arg); -} LDKSocketDescriptor; +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); -/** - * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket - * events into messages which it passes on to its MessageHandlers. - * - * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager - * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but - * essentially you should default to using a SimpleRefPeerManager, and use a - * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when - * you're using lightning-net-tokio. - */ -typedef struct MUST_USE_STRUCT LDKPeerManager { - /** - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativePeerManager *inner; - bool is_owned; -} LDKPeerManager; +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); -typedef struct LDKCVecTempl_PublicKey { - LDKPublicKey *data; - uintptr_t datalen; -} LDKCVecTempl_PublicKey; +struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); -typedef LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ; +struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b); -typedef union LDKCResultPtr_CVecTempl_u8_____PeerHandleError { - LDKCVecTempl_u8 *result; - LDKPeerHandleError *err; -} LDKCResultPtr_CVecTempl_u8_____PeerHandleError; +void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res); -typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError { - LDKCResultPtr_CVecTempl_u8_____PeerHandleError contents; - bool result_ok; -} LDKCResultTempl_CVecTempl_u8_____PeerHandleError; +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o); -typedef LDKCResultTempl_CVecTempl_u8_____PeerHandleError LDKCResult_CVec_u8ZPeerHandleErrorZ; +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); -typedef union LDKCResultPtr_bool__PeerHandleError { - bool *result; - LDKPeerHandleError *err; -} LDKCResultPtr_bool__PeerHandleError; +void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res); -typedef struct LDKCResultTempl_bool__PeerHandleError { - LDKCResultPtr_bool__PeerHandleError contents; - bool result_ok; -} LDKCResultTempl_bool__PeerHandleError; +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig); -typedef LDKCResultTempl_bool__PeerHandleError LDKCResult_boolPeerHandleErrorZ; +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o); -typedef union LDKCResultPtr_SecretKey__Secp256k1Error { - LDKSecretKey *result; - LDKSecp256k1Error *err; -} LDKCResultPtr_SecretKey__Secp256k1Error; +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); -typedef struct LDKCResultTempl_SecretKey__Secp256k1Error { - LDKCResultPtr_SecretKey__Secp256k1Error contents; - bool result_ok; -} LDKCResultTempl_SecretKey__Secp256k1Error; +void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); -typedef LDKCResultTempl_SecretKey__Secp256k1Error LDKCResult_SecretKeySecpErrorZ; +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); -typedef union LDKCResultPtr_PublicKey__Secp256k1Error { - LDKPublicKey *result; - LDKSecp256k1Error *err; -} LDKCResultPtr_PublicKey__Secp256k1Error; +struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_ok(struct LDKChannelKeys o); -typedef struct LDKCResultTempl_PublicKey__Secp256k1Error { - LDKCResultPtr_PublicKey__Secp256k1Error contents; - bool result_ok; -} LDKCResultTempl_PublicKey__Secp256k1Error; +struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_err(struct LDKDecodeError e); -typedef LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ; +void CResult_ChannelKeysDecodeErrorZ_free(struct LDKCResult_ChannelKeysDecodeErrorZ _res); +struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o); -/** - * 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 - * PreCalculatedTxCreationKeys.trust_key_derivation 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; +struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e); -typedef union LDKCResultPtr_TxCreationKeys__Secp256k1Error { - LDKTxCreationKeys *result; - LDKSecp256k1Error *err; -} LDKCResultPtr_TxCreationKeys__Secp256k1Error; +void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res); -typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error { - LDKCResultPtr_TxCreationKeys__Secp256k1Error contents; - bool result_ok; -} LDKCResultTempl_TxCreationKeys__Secp256k1Error; +struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_clone(const struct LDKCResult_InMemoryChannelKeysDecodeErrorZ *NONNULL_PTR orig); -typedef LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ; +void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); -typedef struct LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature { - LDKC2TupleTempl_HTLCOutputInCommitment__Signature *data; - uintptr_t datalen; -} LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature; +void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res); -typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ; +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); -/** - * 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 LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); -typedef struct LDKCVecTempl_RouteHop { - LDKRouteHop *data; - uintptr_t datalen; -} LDKCVecTempl_RouteHop; +void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); -typedef struct LDKCVecTempl_CVecTempl_RouteHop { - LDKCVecTempl_RouteHop *data; - uintptr_t datalen; -} LDKCVecTempl_CVecTempl_RouteHop; +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); -typedef LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ; +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); -/** - * 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_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o); +struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e); +void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _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_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig); -typedef union LDKCResultPtr_Route__LightningError { - LDKRoute *result; - LDKLightningError *err; -} LDKCResultPtr_Route__LightningError; +struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o); -typedef struct LDKCResultTempl_Route__LightningError { - LDKCResultPtr_Route__LightningError contents; - bool result_ok; -} LDKCResultTempl_Route__LightningError; +struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e); -typedef LDKCResultTempl_Route__LightningError LDKCResult_RouteLightningErrorZ; +void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res); +struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig); +void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); -/** - * 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; +void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); -typedef struct LDKCVecTempl_RouteHint { - LDKRouteHint *data; - uintptr_t datalen; -} LDKCVecTempl_RouteHint; +void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); -typedef LDKCVecTempl_RouteHint LDKCVec_RouteHintZ; +void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError 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_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); -/** - * 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 LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); -/** - * 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 LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _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; +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); + +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); -/** - * 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_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); -/** - * 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; +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); -typedef LDKCVecTempl_RouteHop LDKCVec_RouteHopZ; +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); -extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ); +void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); -extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); -extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); -extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z); +void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); -extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); -extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o); -extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ); +void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res); -extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_CVec_SignatureZNoneZ_free)(LDKCResult_CVec_SignatureZNoneZ); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); -extern const LDKCResult_CVec_SignatureZNoneZ (*CResult_CVec_SignatureZNoneZ_ok)(LDKCVec_SignatureZ); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_err)(LDKPeerHandleError); +void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); -extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); -extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(LDKAPIError); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ); +void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); -extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonitorUpdateErrZ_err)(LDKChannelMonitorUpdateErr); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_NoneChannelMonitorUpdateErrZ_free)(LDKCResult_NoneChannelMonitorUpdateErrZ); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); -extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(LDKMonitorUpdateError); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ); +void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); -extern const LDKCResult_NonePaymentSendFailureZ (*CResult_NonePaymentSendFailureZ_err)(LDKPaymentSendFailure); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_NonePaymentSendFailureZ_free)(LDKCResult_NonePaymentSendFailureZ); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); -extern const LDKCResult_NonePeerHandleErrorZ (*CResult_NonePeerHandleErrorZ_err)(LDKPeerHandleError); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_NonePeerHandleErrorZ_free)(LDKCResult_NonePeerHandleErrorZ); +void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); -extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_err)(LDKSecp256k1Error); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_PublicKeySecpErrorZ_free)(LDKCResult_PublicKeySecpErrorZ); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); -extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_ok)(LDKPublicKey); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(LDKLightningError); +void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); -extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)(LDKRoute); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); -extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_err)(LDKSecp256k1Error); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ); +void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); -extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(LDKSecretKey); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); -extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(LDKSignature); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(LDKSecp256k1Error); +void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); -extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(LDKTxCreationKeys); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); -extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_err)(LDKAccessError); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CResult_TxOutAccessErrorZ_free)(LDKCResult_TxOutAccessErrorZ); +void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); -extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_ok)(LDKTxOut); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); -extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(LDKLightningError); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); -extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); -extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_ok)(bool); +void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); -extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_err)(LDKPeerHandleError); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CResult_boolPeerHandleErrorZ_free)(LDKCResult_boolPeerHandleErrorZ); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); -extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(bool); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free)(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ); +void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); -extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_C2Tuple_u32TxOutZZ_free)(LDKCVec_C2Tuple_u32TxOutZZ); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); -extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ); +void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); -extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); -extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_EventZ_free)(LDKCVec_EventZ); +void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); -extern const void (*CVec_HTLCOutputInCommitmentZ_free)(LDKCVec_HTLCOutputInCommitmentZ); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); -extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ); +void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); -extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); -extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ); +void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); -extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); -extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ); +void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); -extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); -extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); -extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); -extern const void (*CVec_u64Z_free)(LDKCVec_u64Z); +void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); -extern const void (*CVec_u8Z_free)(LDKCVec_u8Z); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); -extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; +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); + +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); + +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); -void Transaction_free(LDKTransaction _res); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); -void TxOut_free(LDKTxOut _res); +void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); -LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, LDKTransaction b); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); -LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); -LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); -LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b); +void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); -LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, LDKTxOut b); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); -LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); -LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); -LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(LDKSignature a, LDKCVec_SignatureZ b); +void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); -LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); -LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); -LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); +void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); -LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); -LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(LDKChannelAnnouncement a, LDKChannelUpdate b, LDKChannelUpdate c); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); -LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e); -LDKC2Tuple_HTLCOutputInCommitmentSignatureZ C2Tuple_HTLCOutputInCommitmentSignatureZ_new(LDKHTLCOutputInCommitment a, LDKSignature b); +void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); -void Event_free(LDKEvent this_ptr); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); -LDKEvent Event_clone(const LDKEvent *orig); +void Event_free(struct LDKEvent this_ptr); -void MessageSendEvent_free(LDKMessageSendEvent this_ptr); +struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); -LDKMessageSendEvent MessageSendEvent_clone(const LDKMessageSendEvent *orig); +struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); + +void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); + +struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void MessageSendEventsProvider_free(LDKMessageSendEventsProvider this_ptr); +void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); /** * Calls the free function if one is set */ -void EventsProvider_free(LDKEventsProvider this_ptr); +void EventsProvider_free(struct LDKEventsProvider this_ptr); -void APIError_free(LDKAPIError this_ptr); +void APIError_free(struct LDKAPIError this_ptr); -LDKAPIError APIError_clone(const LDKAPIError *orig); +struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); -LDKLevel Level_clone(const LDKLevel *orig); +enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); /** * Returns the most verbose logging level. */ -MUST_USE_RES LDKLevel Level_max(void); +MUST_USE_RES enum LDKLevel Level_max(void); /** * Calls the free function if one is set */ -void Logger_free(LDKLogger this_ptr); +void Logger_free(struct LDKLogger this_ptr); -void ChannelHandshakeConfig_free(LDKChannelHandshakeConfig this_ptr); - -LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const LDKChannelHandshakeConfig *orig); +void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr); /** * Confirmations we will wait for before considering the channel locked in. @@ -3346,7 +4513,7 @@ LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const LDKChannelHandshake * * Default value: 6. */ -uint32_t ChannelHandshakeConfig_get_minimum_depth(const LDKChannelHandshakeConfig *this_ptr); +uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** * Confirmations we will wait for before considering the channel locked in. @@ -3355,7 +4522,7 @@ uint32_t ChannelHandshakeConfig_get_minimum_depth(const LDKChannelHandshakeConfi * * Default value: 6. */ -void ChannelHandshakeConfig_set_minimum_depth(LDKChannelHandshakeConfig *this_ptr, uint32_t val); +void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); /** * Set to the amount of time we require our counterparty to wait to claim their money. @@ -3371,7 +4538,7 @@ void ChannelHandshakeConfig_set_minimum_depth(LDKChannelHandshakeConfig *this_pt * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel * opening so you can tweak config to ask for more security, not less. */ -uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const LDKChannelHandshakeConfig *this_ptr); +uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** * Set to the amount of time we require our counterparty to wait to claim their money. @@ -3387,7 +4554,7 @@ uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const LDKChannelHandshakeC * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel * opening so you can tweak config to ask for more security, not less. */ -void ChannelHandshakeConfig_set_our_to_self_delay(LDKChannelHandshakeConfig *this_ptr, uint16_t val); +void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); /** * Set to the smallest value HTLC we will accept to process. @@ -3398,7 +4565,7 @@ void ChannelHandshakeConfig_set_our_to_self_delay(LDKChannelHandshakeConfig *thi * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required * by the protocol. */ -uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const LDKChannelHandshakeConfig *this_ptr); +uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** * Set to the smallest value HTLC we will accept to process. @@ -3409,15 +4576,15 @@ uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const LDKChannelHandsh * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required * by the protocol. */ -void ChannelHandshakeConfig_set_our_htlc_minimum_msat(LDKChannelHandshakeConfig *this_ptr, uint64_t val); +void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); -MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg); +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); -MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); +struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); -void ChannelHandshakeLimits_free(LDKChannelHandshakeLimits this_ptr); +MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); -LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const LDKChannelHandshakeLimits *orig); +void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr); /** * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so @@ -3425,7 +4592,7 @@ LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const LDKChannelHandshake * * Default value: 0. */ -uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so @@ -3433,7 +4600,7 @@ uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const LDKChannelHandsha * * Default value: 0. */ -void ChannelHandshakeLimits_set_min_funding_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows @@ -3441,7 +4608,7 @@ void ChannelHandshakeLimits_set_min_funding_satoshis(LDKChannelHandshakeLimits * * * Default value: u64::max_value. */ -uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows @@ -3449,7 +4616,7 @@ uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const LDKChannelHandsh * * Default value: u64::max_value. */ -void ChannelHandshakeLimits_set_max_htlc_minimum_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * The remote node sets a limit on the maximum value of pending HTLCs to them at any given @@ -3457,7 +4624,7 @@ void ChannelHandshakeLimits_set_max_htlc_minimum_msat(LDKChannelHandshakeLimits * * Default value: 0. */ -uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * The remote node sets a limit on the maximum value of pending HTLCs to them at any given @@ -3465,7 +4632,7 @@ uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const LDKC * * Default value: 0. */ -void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * The remote node will require we keep a certain amount in direct payment to ourselves at all @@ -3474,7 +4641,7 @@ void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(LDKChannelHand * * Default value: u64::max_value. */ -uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * The remote node will require we keep a certain amount in direct payment to ourselves at all @@ -3483,7 +4650,7 @@ uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const LDKChanne * * Default value: u64::max_value. */ -void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * The remote node sets a limit on the maximum number of pending HTLCs to them at any given @@ -3491,7 +4658,7 @@ void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(LDKChannelHandshake * * Default value: 0. */ -uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const LDKChannelHandshakeLimits *this_ptr); +uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * The remote node sets a limit on the maximum number of pending HTLCs to them at any given @@ -3499,7 +4666,7 @@ uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const LDKChannelHands * * Default value: 0. */ -void ChannelHandshakeLimits_set_min_max_accepted_htlcs(LDKChannelHandshakeLimits *this_ptr, uint16_t val); +void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); /** * Outputs below a certain value will not be added to on-chain transactions. The dust value is @@ -3512,7 +4679,7 @@ void ChannelHandshakeLimits_set_min_max_accepted_htlcs(LDKChannelHandshakeLimits * * Default value: 546, the current dust limit on the Bitcoin network. */ -uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Outputs below a certain value will not be added to on-chain transactions. The dust value is @@ -3525,7 +4692,7 @@ uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const LDKChannelHand * * Default value: 546, the current dust limit on the Bitcoin network. */ -void ChannelHandshakeLimits_set_min_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * Maximum allowed threshold above which outputs will not be generated in their commitment @@ -3534,7 +4701,7 @@ void ChannelHandshakeLimits_set_min_dust_limit_satoshis(LDKChannelHandshakeLimit * * Default value: u64::max_value. */ -uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Maximum allowed threshold above which outputs will not be generated in their commitment @@ -3543,7 +4710,7 @@ uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const LDKChannelHand * * Default value: u64::max_value. */ -void ChannelHandshakeLimits_set_max_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * Before a channel is usable the funding transaction will need to be confirmed by at least a @@ -3553,7 +4720,7 @@ void ChannelHandshakeLimits_set_max_dust_limit_satoshis(LDKChannelHandshakeLimit * * Default value: 144, or roughly one day and only applies to outbound channels. */ -uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const LDKChannelHandshakeLimits *this_ptr); +uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Before a channel is usable the funding transaction will need to be confirmed by at least a @@ -3563,7 +4730,7 @@ uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const LDKChannelHandshakeL * * Default value: 144, or roughly one day and only applies to outbound channels. */ -void ChannelHandshakeLimits_set_max_minimum_depth(LDKChannelHandshakeLimits *this_ptr, uint32_t val); +void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); /** * Set to force the incoming channel to match our announced channel preference in @@ -3572,7 +4739,7 @@ void ChannelHandshakeLimits_set_max_minimum_depth(LDKChannelHandshakeLimits *thi * Default value: true, to make the default that no announced channels are possible (which is * appropriate for any nodes which are not online very reliably). */ -bool ChannelHandshakeLimits_get_force_announced_channel_preference(const LDKChannelHandshakeLimits *this_ptr); +bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Set to force the incoming channel to match our announced channel preference in @@ -3581,7 +4748,7 @@ bool ChannelHandshakeLimits_get_force_announced_channel_preference(const LDKChan * Default value: true, to make the default that no announced channels are possible (which is * appropriate for any nodes which are not online very reliably). */ -void ChannelHandshakeLimits_set_force_announced_channel_preference(LDKChannelHandshakeLimits *this_ptr, bool val); +void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); /** * Set to the amount of time we're willing to wait to claim money back to us. @@ -3592,7 +4759,7 @@ void ChannelHandshakeLimits_set_force_announced_channel_preference(LDKChannelHan * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts) */ -uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const LDKChannelHandshakeLimits *this_ptr); +uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Set to the amount of time we're willing to wait to claim money back to us. @@ -3603,15 +4770,15 @@ uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const LDKChannelHandshak * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts) */ -void ChannelHandshakeLimits_set_their_to_self_delay(LDKChannelHandshakeLimits *this_ptr, uint16_t val); +void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); -MUST_USE_RES 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); +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); -MUST_USE_RES LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); +struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); -void ChannelConfig_free(LDKChannelConfig this_ptr); +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); -LDKChannelConfig ChannelConfig_clone(const LDKChannelConfig *orig); +void ChannelConfig_free(struct LDKChannelConfig this_ptr); /** * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi. @@ -3620,7 +4787,7 @@ LDKChannelConfig ChannelConfig_clone(const LDKChannelConfig *orig); * * Default value: 0. */ -uint32_t ChannelConfig_get_fee_proportional_millionths(const LDKChannelConfig *this_ptr); +uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi. @@ -3629,7 +4796,7 @@ uint32_t ChannelConfig_get_fee_proportional_millionths(const LDKChannelConfig *t * * Default value: 0. */ -void ChannelConfig_set_fee_proportional_millionths(LDKChannelConfig *this_ptr, uint32_t val); +void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); /** * Set to announce the channel publicly and notify all nodes that they can route via this @@ -3644,7 +4811,7 @@ void ChannelConfig_set_fee_proportional_millionths(LDKChannelConfig *this_ptr, u * * Default value: false. */ -bool ChannelConfig_get_announced_channel(const LDKChannelConfig *this_ptr); +bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** * Set to announce the channel publicly and notify all nodes that they can route via this @@ -3659,7 +4826,7 @@ bool ChannelConfig_get_announced_channel(const LDKChannelConfig *this_ptr); * * Default value: false. */ -void ChannelConfig_set_announced_channel(LDKChannelConfig *this_ptr, bool val); +void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); /** * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty @@ -3674,7 +4841,7 @@ void ChannelConfig_set_announced_channel(LDKChannelConfig *this_ptr, bool val); * * Default value: true. */ -bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const LDKChannelConfig *this_ptr); +bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty @@ -3689,84 +4856,86 @@ bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const LDKChannelConfig *th * * Default value: true. */ -void ChannelConfig_set_commit_upfront_shutdown_pubkey(LDKChannelConfig *this_ptr, bool val); +void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); -MUST_USE_RES LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); -MUST_USE_RES LDKChannelConfig ChannelConfig_default(void); +struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); -LDKCVec_u8Z ChannelConfig_write(const LDKChannelConfig *obj); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); -LDKChannelConfig ChannelConfig_read(LDKu8slice ser); +struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); -void UserConfig_free(LDKUserConfig this_ptr); +struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); -LDKUserConfig UserConfig_clone(const LDKUserConfig *orig); +void UserConfig_free(struct LDKUserConfig this_ptr); /** * Channel config that we propose to our counterparty. */ -LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const LDKUserConfig *this_ptr); +struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** * Channel config that we propose to our counterparty. */ -void UserConfig_set_own_channel_config(LDKUserConfig *this_ptr, LDKChannelHandshakeConfig val); +void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); /** * Limits applied to our counterparty's proposed channel config settings. */ -LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const LDKUserConfig *this_ptr); +struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** * Limits applied to our counterparty's proposed channel config settings. */ -void UserConfig_set_peer_channel_config_limits(LDKUserConfig *this_ptr, LDKChannelHandshakeLimits val); +void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); /** * Channel config which affects behavior during channel lifetime. */ -LDKChannelConfig UserConfig_get_channel_options(const LDKUserConfig *this_ptr); +struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** * Channel config which affects behavior during channel lifetime. */ -void UserConfig_set_channel_options(LDKUserConfig *this_ptr, LDKChannelConfig val); +void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); + +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); -MUST_USE_RES LDKUserConfig UserConfig_new(LDKChannelHandshakeConfig own_channel_config_arg, LDKChannelHandshakeLimits peer_channel_config_limits_arg, LDKChannelConfig channel_options_arg); +struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); -MUST_USE_RES LDKUserConfig UserConfig_default(void); +MUST_USE_RES struct LDKUserConfig UserConfig_default(void); -LDKAccessError AccessError_clone(const LDKAccessError *orig); +enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void Access_free(LDKAccess this_ptr); +void Access_free(struct LDKAccess this_ptr); /** * Calls the free function if one is set */ -void Watch_free(LDKWatch this_ptr); +void Watch_free(struct LDKWatch this_ptr); /** * Calls the free function if one is set */ -void Filter_free(LDKFilter this_ptr); +void Filter_free(struct LDKFilter this_ptr); /** * Calls the free function if one is set */ -void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr); +void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); -LDKConfirmationTarget ConfirmationTarget_clone(const LDKConfirmationTarget *orig); +enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void FeeEstimator_free(LDKFeeEstimator this_ptr); +void FeeEstimator_free(struct LDKFeeEstimator this_ptr); -void ChainMonitor_free(LDKChainMonitor this_ptr); +void ChainMonitor_free(struct LDKChainMonitor this_ptr); /** * Dispatches to per-channel monitors, which are responsible for updating their on-chain view @@ -3783,7 +4952,7 @@ void ChainMonitor_free(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 LDKChainMonitor *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 @@ -3792,7 +4961,7 @@ void ChainMonitor_block_connected(const LDKChainMonitor *this_arg, const uint8_t * * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected */ -void ChainMonitor_block_disconnected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height); +void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height); /** * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels. @@ -3805,15 +4974,13 @@ void ChainMonitor_block_disconnected(const LDKChainMonitor *this_arg, const uint * * [`chain::Filter`]: ../trait.Filter.html */ -MUST_USE_RES LDKChainMonitor ChainMonitor_new(LDKFilter *chain_source, LDKBroadcasterInterface broadcaster, LDKLogger logger, LDKFeeEstimator feeest, LDKPersist persister); +MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); -LDKWatch ChainMonitor_as_Watch(const LDKChainMonitor *this_arg); +struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg); -LDKEventsProvider ChainMonitor_as_EventsProvider(const LDKChainMonitor *this_arg); +struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg); -void ChannelMonitorUpdate_free(LDKChannelMonitorUpdate this_ptr); - -LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const LDKChannelMonitorUpdate *orig); +void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr); /** * The sequence number of this update. Updates *must* be replayed in-order according to this @@ -3830,7 +4997,7 @@ LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const LDKChannelMonitorUpdate * * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html */ -uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ptr); +uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); /** * The sequence number of this update. Updates *must* be replayed in-order according to this @@ -3847,29 +5014,35 @@ uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ * * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html */ -void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val); +void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); + +struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); + +struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); + +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj); +enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); -LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser); +void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr); -LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const LDKChannelMonitorUpdateErr *orig); +struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig); -void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr); +void MonitorEvent_free(struct LDKMonitorEvent this_ptr); -void MonitorEvent_free(LDKMonitorEvent this_ptr); +struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); -LDKMonitorEvent MonitorEvent_clone(const LDKMonitorEvent *orig); +void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr); -void HTLCUpdate_free(LDKHTLCUpdate this_ptr); +struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); -LDKHTLCUpdate HTLCUpdate_clone(const LDKHTLCUpdate *orig); +struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); -LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj); +struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser); -LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser); +void ChannelMonitor_free(struct LDKChannelMonitor this_ptr); -void ChannelMonitor_free(LDKChannelMonitor this_ptr); +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 @@ -3877,18 +5050,18 @@ void ChannelMonitor_free(LDKChannelMonitor this_ptr); * * panics if the given update is not the next update by update_id. */ -MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(LDKChannelMonitor *this_arg, const LDKChannelMonitorUpdate *updates, const LDKBroadcasterInterface *broadcaster, const LDKFeeEstimator *fee_estimator, const LDKLogger *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 * ChannelMonitor. */ -MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const LDKChannelMonitor *this_arg); +MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. */ -MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDKChannelMonitor *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 @@ -3896,7 +5069,7 @@ MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDK * * [`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(LDKChannelMonitor *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 @@ -3906,7 +5079,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(LDKChannelMonitor *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 @@ -3919,7 +5092,7 @@ MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(LDKChann * 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(LDKChannelMonitor *this_arg, const LDKLogger *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: @@ -3934,169 +5107,194 @@ 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(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, 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 * appropriately. */ -void ChannelMonitor_block_disconnected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger); +void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** * Calls the free function if one is set */ -void Persist_free(LDKPersist this_ptr); +void Persist_free(struct LDKPersist this_ptr); -void OutPoint_free(LDKOutPoint this_ptr); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); -LDKOutPoint OutPoint_clone(const LDKOutPoint *orig); +void OutPoint_free(struct LDKOutPoint this_ptr); /** * The referenced transaction's txid. */ -const uint8_t (*OutPoint_get_txid(const LDKOutPoint *this_ptr))[32]; +const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; /** * The referenced transaction's txid. */ -void OutPoint_set_txid(LDKOutPoint *this_ptr, LDKThirtyTwoBytes val); +void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The index of the referenced output in its transaction's vout. */ -uint16_t OutPoint_get_index(const LDKOutPoint *this_ptr); +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(LDKOutPoint *this_ptr, uint16_t val); +void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); -MUST_USE_RES LDKOutPoint OutPoint_new(LDKThirtyTwoBytes txid_arg, uint16_t index_arg); +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 LDKThirtyTwoBytes OutPoint_to_channel_id(const LDKOutPoint *this_arg); +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); -LDKCVec_u8Z OutPoint_write(const LDKOutPoint *obj); +struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); -LDKOutPoint OutPoint_read(LDKu8slice ser); +void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); -void SpendableOutputDescriptor_free(LDKSpendableOutputDescriptor this_ptr); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); -LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const LDKSpendableOutputDescriptor *orig); +struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); -LDKChannelKeys ChannelKeys_clone(const LDKChannelKeys *orig); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); + +struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void ChannelKeys_free(LDKChannelKeys this_ptr); +void ChannelKeys_free(struct LDKChannelKeys this_ptr); /** * Calls the free function if one is set */ -void KeysInterface_free(LDKKeysInterface this_ptr); - -void InMemoryChannelKeys_free(LDKInMemoryChannelKeys this_ptr); +void KeysInterface_free(struct LDKKeysInterface this_ptr); -LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const LDKInMemoryChannelKeys *orig); +void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr); /** * Private key of anchor tx */ -const uint8_t (*InMemoryChannelKeys_get_funding_key(const LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Private key of anchor tx */ -void InMemoryChannelKeys_set_funding_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); +void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key for blinded revocation pubkey */ -const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Holder secret key for blinded revocation pubkey */ -void InMemoryChannelKeys_set_revocation_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); +void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *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 LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Holder secret key used for our balance in counterparty-broadcasted commitment transactions */ -void InMemoryChannelKeys_set_payment_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); +void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key used in HTLC tx */ -const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Holder secret key used in HTLC tx */ -void InMemoryChannelKeys_set_delayed_payment_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); +void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *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 LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Holder htlc secret key used in commitment tx htlc outputs */ -void InMemoryChannelKeys_set_htlc_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); +void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Commitment seed */ -const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Commitment seed */ -void InMemoryChannelKeys_set_commitment_seed(LDKInMemoryChannelKeys *this_ptr, LDKThirtyTwoBytes val); +void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig); /** * Create a new InMemoryChannelKeys */ -MUST_USE_RES LDKInMemoryChannelKeys InMemoryChannelKeys_new(LDKSecretKey funding_key, LDKSecretKey revocation_base_key, LDKSecretKey payment_key, LDKSecretKey delayed_payment_base_key, LDKSecretKey htlc_base_key, LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, LDKC2Tuple_u64u64Z key_derivation_params); +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, struct LDKC2Tuple_u64u64Z key_derivation_params); /** * Counterparty pubkeys. - * Will panic if on_accept wasn't called. + * Will panic if ready_channel wasn't called. */ -MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); /** * The contest_delay value specified by our counterparty and applied on holder-broadcastable * transactions, ie the amount of time that we have to wait to recover our funds if we - * broadcast a transaction. You'll likely want to pass this to the - * ln::chan_utils::build*_transaction functions when signing holder's transactions. - * Will panic if on_accept wasn't called. + * broadcast a transaction. + * Will panic if ready_channel wasn't called. */ -MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); /** * The contest_delay value specified by us and applied on transactions broadcastable * by our counterparty, ie the amount of time that they have to wait to recover their funds * if they broadcast a transaction. - * Will panic if on_accept wasn't called. + * 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); + +/** + * Whether the holder is the initiator + * Will panic if ready_channel wasn't called. */ -MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); -LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const LDKInMemoryChannelKeys *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); + +/** + * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or + * building transactions. + * + * Will panic if ready_channel wasn't called. + */ +MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); -LDKCVec_u8Z InMemoryChannelKeys_write(const LDKInMemoryChannelKeys *obj); +struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); -LDKInMemoryChannelKeys InMemoryChannelKeys_read(LDKu8slice ser); +struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj); -void KeysManager_free(LDKKeysManager this_ptr); +struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser); + +void KeysManager_free(struct LDKKeysManager this_ptr); /** * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your @@ -4119,7 +5317,7 @@ void KeysManager_free(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 LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos); +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); /** * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation @@ -4128,15 +5326,13 @@ MUST_USE_RES LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], LDKNetwor * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of * onchain output detection for which a corresponding delayed_payment_key must be derived. */ -MUST_USE_RES LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const LDKKeysManager *this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2); - -LDKKeysInterface KeysManager_as_KeysInterface(const LDKKeysManager *this_arg); +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); -void ChannelManager_free(LDKChannelManager this_ptr); +struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); -void ChannelDetails_free(LDKChannelDetails this_ptr); +void ChannelManager_free(struct LDKChannelManager this_ptr); -LDKChannelDetails ChannelDetails_clone(const LDKChannelDetails *orig); +void ChannelDetails_free(struct LDKChannelDetails this_ptr); /** * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, @@ -4144,7 +5340,7 @@ LDKChannelDetails ChannelDetails_clone(const LDKChannelDetails *orig); * Note that this means this value is *not* persistent - it can change once during the * lifetime of the channel. */ -const uint8_t (*ChannelDetails_get_channel_id(const LDKChannelDetails *this_ptr))[32]; +const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32]; /** * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, @@ -4152,51 +5348,51 @@ const uint8_t (*ChannelDetails_get_channel_id(const LDKChannelDetails *this_ptr) * Note that this means this value is *not* persistent - it can change once during the * lifetime of the channel. */ -void ChannelDetails_set_channel_id(LDKChannelDetails *this_ptr, LDKThirtyTwoBytes val); +void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The node_id of our counterparty */ -LDKPublicKey ChannelDetails_get_remote_network_id(const LDKChannelDetails *this_ptr); +struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The node_id of our counterparty */ -void ChannelDetails_set_remote_network_id(LDKChannelDetails *this_ptr, LDKPublicKey val); +void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The Features the channel counterparty provided upon last connection. * Useful for routing as it is the most up-to-date copy of the counterparty's features and * many routing-relevant features are present in the init context. */ -LDKInitFeatures ChannelDetails_get_counterparty_features(const LDKChannelDetails *this_ptr); +struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The Features the channel counterparty provided upon last connection. * Useful for routing as it is the most up-to-date copy of the counterparty's features and * many routing-relevant features are present in the init context. */ -void ChannelDetails_set_counterparty_features(LDKChannelDetails *this_ptr, LDKInitFeatures val); +void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** * The value, in satoshis, of this channel as appears in the funding output */ -uint64_t ChannelDetails_get_channel_value_satoshis(const LDKChannelDetails *this_ptr); +uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The value, in satoshis, of this channel as appears in the funding output */ -void ChannelDetails_set_channel_value_satoshis(LDKChannelDetails *this_ptr, uint64_t val); +void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** * The user_id passed in to create_channel, or 0 if the channel was inbound. */ -uint64_t ChannelDetails_get_user_id(const LDKChannelDetails *this_ptr); +uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The user_id passed in to create_channel, or 0 if the channel was inbound. */ -void ChannelDetails_set_user_id(LDKChannelDetails *this_ptr, uint64_t val); +void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include @@ -4204,7 +5400,7 @@ void ChannelDetails_set_user_id(LDKChannelDetails *this_ptr, uint64_t val); * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. */ -uint64_t ChannelDetails_get_outbound_capacity_msat(const LDKChannelDetails *this_ptr); +uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include @@ -4212,7 +5408,7 @@ uint64_t ChannelDetails_get_outbound_capacity_msat(const LDKChannelDetails *this * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. */ -void ChannelDetails_set_outbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val); +void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not @@ -4221,7 +5417,7 @@ void ChannelDetails_set_outbound_capacity_msat(LDKChannelDetails *this_ptr, uint * Note that there are some corner cases not fully handled here, so the actual available * inbound capacity may be slightly higher than this. */ -uint64_t ChannelDetails_get_inbound_capacity_msat(const LDKChannelDetails *this_ptr); +uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not @@ -4230,21 +5426,25 @@ uint64_t ChannelDetails_get_inbound_capacity_msat(const LDKChannelDetails *this_ * Note that there are some corner cases not fully handled here, so the actual available * inbound capacity may be slightly higher than this. */ -void ChannelDetails_set_inbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val); +void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) * the peer is connected, and (c) no monitor update failure is pending resolution. */ -bool ChannelDetails_get_is_live(const LDKChannelDetails *this_ptr); +bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) * the peer is connected, and (c) no monitor update failure is pending resolution. */ -void ChannelDetails_set_is_live(LDKChannelDetails *this_ptr, bool val); +void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); -void PaymentSendFailure_free(LDKPaymentSendFailure this_ptr); +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. @@ -4262,7 +5462,7 @@ void PaymentSendFailure_free(LDKPaymentSendFailure this_ptr); * Users need to notify the new ChannelManager when a new block is connected or * disconnected using its `block_connected` and `block_disconnected` methods. */ -MUST_USE_RES LDKChannelManager ChannelManager_new(LDKNetwork network, LDKFeeEstimator fee_est, LDKWatch chain_monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKKeysInterface keys_manager, LDKUserConfig config, uintptr_t current_blockchain_height); +MUST_USE_RES struct LDKChannelManager ChannelManager_new(enum LDKNetwork network, struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, uintptr_t current_blockchain_height); /** * Creates a new outbound channel to the given remote node and with the given value. @@ -4278,13 +5478,13 @@ MUST_USE_RES LDKChannelManager ChannelManager_new(LDKNetwork network, LDKFeeEsti * 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 LDKChannelManager *this_arg, LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, 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 LDKChannelManager *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 @@ -4293,7 +5493,7 @@ MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const LDKChann * 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 LDKChannelManager *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 @@ -4302,19 +5502,19 @@ MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const L * * May generate a SendShutdown message event on success, which should be relayed. */ -MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const LDKChannelManager *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. + * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager. */ -void ChannelManager_force_close_channel(const LDKChannelManager *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 * for each to the chain and rejecting new HTLCs on each. */ -void ChannelManager_force_close_all_channels(const LDKChannelManager *this_arg); +void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Sends a payment along a given route. @@ -4357,7 +5557,7 @@ void ChannelManager_force_close_all_channels(const LDKChannelManager *this_arg); * 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 LDKChannelManager *this_arg, const LDKRoute *route, LDKThirtyTwoBytes payment_hash, 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. @@ -4370,7 +5570,7 @@ MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(cons * May panic if the funding_txo is duplicative with some other channel (note that this should * be trivially prevented by using unique funding transaction keys per-channel). */ -void ChannelManager_funding_transaction_generated(const LDKChannelManager *this_arg, const uint8_t (*temporary_channel_id)[32], LDKOutPoint funding_txo); +void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo); /** * Generates a signed node_announcement from the given arguments and creates a @@ -4387,7 +5587,7 @@ void ChannelManager_funding_transaction_generated(const LDKChannelManager *this_ * * Panics if addresses is absurdly large (more than 500). */ -void ChannelManager_broadcast_node_announcement(const LDKChannelManager *this_arg, LDKThreeBytes rgb, 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. @@ -4395,7 +5595,7 @@ void ChannelManager_broadcast_node_announcement(const LDKChannelManager *this_ar * Should only really ever be called in response to a PendingHTLCsForwardable event. * Will likely generate further events. */ -void ChannelManager_process_pending_htlc_forwards(const LDKChannelManager *this_arg); +void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * If a peer is disconnected we mark any channels with that peer as 'disabled'. @@ -4404,7 +5604,7 @@ void ChannelManager_process_pending_htlc_forwards(const LDKChannelManager *this_ * * This method handles all the details, and must be called roughly once per minute. */ -void ChannelManager_timer_chan_freshness_every_min(const LDKChannelManager *this_arg); +void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect @@ -4413,7 +5613,7 @@ void ChannelManager_timer_chan_freshness_every_min(const LDKChannelManager *this * Returns false if no payment was found to fail backwards, true if the process of failing the * HTLC backwards has been started. */ -MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const LDKChannelManager *this_arg, const uint8_t (*payment_hash)[32], LDKThirtyTwoBytes payment_secret); +MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret); /** * Provides a payment preimage in response to a PaymentReceived event, returning true and @@ -4432,12 +5632,12 @@ MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const LDKChannelManager *th * * May panic if called except in response to a PaymentReceived event. */ -MUST_USE_RES bool ChannelManager_claim_funds(const LDKChannelManager *this_arg, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_secret, uint64_t expected_amount); +MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount); /** * Gets the node_id held by this ChannelManager */ -MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager *this_arg); +MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Restores a single, given channel to normal operation after a @@ -4461,16 +5661,16 @@ MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager * 4) once all remote copies are updated, you call this function with the update_id that * completed, and once it is the latest the Channel will be re-enabled. */ -void ChannelManager_channel_monitor_updated(const LDKChannelManager *this_arg, const LDKOutPoint *funding_txo, uint64_t highest_applied_update_id); +void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id); -LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const LDKChannelManager *this_arg); +struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); -LDKEventsProvider ChannelManager_as_EventsProvider(const LDKChannelManager *this_arg); +struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Updates channel state based on transactions seen in a connected block. */ -void ChannelManager_block_connected(const LDKChannelManager *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. @@ -4478,37 +5678,41 @@ void ChannelManager_block_connected(const LDKChannelManager *this_arg, const uin * If necessary, the channel may be force-closed without letting the counterparty participate * in the shutdown. */ -void ChannelManager_block_disconnected(const LDKChannelManager *this_arg, const uint8_t (*header)[80]); +void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]); -LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const LDKChannelManager *this_arg); +struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); -void ChannelManagerReadArgs_free(LDKChannelManagerReadArgs this_ptr); +struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); + +void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr); /** * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization. + * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel + * signing data. */ -const LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const LDKChannelManagerReadArgs *this_ptr); +const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization. + * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel + * signing data. */ -void ChannelManagerReadArgs_set_keys_manager(LDKChannelManagerReadArgs *this_ptr, LDKKeysInterface val); +void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val); /** * The fee_estimator for use in the ChannelManager in the future. * * No calls to the FeeEstimator will be made during deserialization. */ -const LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const LDKChannelManagerReadArgs *this_ptr); +const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The fee_estimator for use in the ChannelManager in the future. * * No calls to the FeeEstimator will be made during deserialization. */ -void ChannelManagerReadArgs_set_fee_estimator(LDKChannelManagerReadArgs *this_ptr, LDKFeeEstimator val); +void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); /** * The chain::Watch for use in the ChannelManager in the future. @@ -4517,7 +5721,7 @@ void ChannelManagerReadArgs_set_fee_estimator(LDKChannelManagerReadArgs *this_pt * you have deserialized ChannelMonitors separately and will add them to your * chain::Watch after deserializing this ChannelManager. */ -const LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const LDKChannelManagerReadArgs *this_ptr); +const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The chain::Watch for use in the ChannelManager in the future. @@ -4526,72 +5730,74 @@ const LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const LDKChannelManager * you have deserialized ChannelMonitors separately and will add them to your * chain::Watch after deserializing this ChannelManager. */ -void ChannelManagerReadArgs_set_chain_monitor(LDKChannelManagerReadArgs *this_ptr, LDKWatch val); +void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); /** * The BroadcasterInterface which will be used in the ChannelManager in the future and may be * used to broadcast the latest local commitment transactions of channels which must be * force-closed during deserialization. */ -const LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const LDKChannelManagerReadArgs *this_ptr); +const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The BroadcasterInterface which will be used in the ChannelManager in the future and may be * used to broadcast the latest local commitment transactions of channels which must be * force-closed during deserialization. */ -void ChannelManagerReadArgs_set_tx_broadcaster(LDKChannelManagerReadArgs *this_ptr, LDKBroadcasterInterface val); +void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); /** * The Logger for use in the ChannelManager and which may be used to log information during * deserialization. */ -const LDKLogger *ChannelManagerReadArgs_get_logger(const LDKChannelManagerReadArgs *this_ptr); +const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The Logger for use in the ChannelManager and which may be used to log information during * deserialization. */ -void ChannelManagerReadArgs_set_logger(LDKChannelManagerReadArgs *this_ptr, LDKLogger val); +void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); /** * Default settings used for new channels. Any existing channels will continue to use the * runtime settings which were stored when the ChannelManager was serialized. */ -LDKUserConfig ChannelManagerReadArgs_get_default_config(const LDKChannelManagerReadArgs *this_ptr); +struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * Default settings used for new channels. Any existing channels will continue to use the * runtime settings which were stored when the ChannelManager was serialized. */ -void ChannelManagerReadArgs_set_default_config(LDKChannelManagerReadArgs *this_ptr, LDKUserConfig val); +void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); /** * Simple utility function to create a ChannelManagerReadArgs which creates the monitor * HashMap for you. This is primarily useful for C bindings where it is not practical to * populate a HashMap directly from C. */ -MUST_USE_RES LDKChannelManagerReadArgs ChannelManagerReadArgs_new(LDKKeysInterface keys_manager, LDKFeeEstimator fee_estimator, LDKWatch chain_monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, 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); + +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); -void DecodeError_free(LDKDecodeError this_ptr); +void DecodeError_free(struct LDKDecodeError this_ptr); -void Init_free(LDKInit this_ptr); +struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); -LDKInit Init_clone(const LDKInit *orig); +void Init_free(struct LDKInit this_ptr); -void ErrorMessage_free(LDKErrorMessage this_ptr); +struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); -LDKErrorMessage ErrorMessage_clone(const LDKErrorMessage *orig); +void ErrorMessage_free(struct LDKErrorMessage this_ptr); /** * The channel ID involved in the error */ -const uint8_t (*ErrorMessage_get_channel_id(const LDKErrorMessage *this_ptr))[32]; +const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32]; /** * The channel ID involved in the error */ -void ErrorMessage_set_channel_id(LDKErrorMessage *this_ptr, LDKThirtyTwoBytes val); +void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * A possibly human-readable error description. @@ -4599,7 +5805,7 @@ void ErrorMessage_set_channel_id(LDKErrorMessage *this_ptr, LDKThirtyTwoBytes va * or printed to stdout). Otherwise, a well crafted error message may trigger a security * vulnerability in the terminal emulator or the logging subsystem. */ -LDKStr ErrorMessage_get_data(const LDKErrorMessage *this_ptr); +struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** * A possibly human-readable error description. @@ -4607,1673 +5813,1681 @@ LDKStr ErrorMessage_get_data(const LDKErrorMessage *this_ptr); * 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(LDKErrorMessage *this_ptr, LDKCVec_u8Z val); +void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); -MUST_USE_RES LDKErrorMessage ErrorMessage_new(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(LDKPing this_ptr); +struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); -LDKPing Ping_clone(const LDKPing *orig); +void Ping_free(struct LDKPing this_ptr); /** * The desired response length */ -uint16_t Ping_get_ponglen(const LDKPing *this_ptr); +uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); /** * The desired response length */ -void Ping_set_ponglen(LDKPing *this_ptr, uint16_t val); +void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** * The ping packet size. * This field is not sent on the wire. byteslen zeros are sent. */ -uint16_t Ping_get_byteslen(const LDKPing *this_ptr); +uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); /** * The ping packet size. * This field is not sent on the wire. byteslen zeros are sent. */ -void Ping_set_byteslen(LDKPing *this_ptr, uint16_t val); +void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); -MUST_USE_RES LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); +MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); -void Pong_free(LDKPong this_ptr); +struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); -LDKPong Pong_clone(const LDKPong *orig); +void Pong_free(struct LDKPong this_ptr); /** * The pong packet size. * This field is not sent on the wire. byteslen zeros are sent. */ -uint16_t Pong_get_byteslen(const LDKPong *this_ptr); +uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); /** * The pong packet size. * This field is not sent on the wire. byteslen zeros are sent. */ -void Pong_set_byteslen(LDKPong *this_ptr, uint16_t val); +void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); -MUST_USE_RES LDKPong Pong_new(uint16_t byteslen_arg); +MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); -void OpenChannel_free(LDKOpenChannel this_ptr); +struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); -LDKOpenChannel OpenChannel_clone(const LDKOpenChannel *orig); +void OpenChannel_free(struct LDKOpenChannel this_ptr); /** * The genesis hash of the blockchain where the channel is to be opened */ -const uint8_t (*OpenChannel_get_chain_hash(const LDKOpenChannel *this_ptr))[32]; +const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain where the channel is to be opened */ -void OpenChannel_set_chain_hash(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val); +void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * A temporary channel ID, until the funding outpoint is announced */ -const uint8_t (*OpenChannel_get_temporary_channel_id(const LDKOpenChannel *this_ptr))[32]; +const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; /** * A temporary channel ID, until the funding outpoint is announced */ -void OpenChannel_set_temporary_channel_id(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val); +void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The channel value */ -uint64_t OpenChannel_get_funding_satoshis(const LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The channel value */ -void OpenChannel_set_funding_satoshis(LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The amount to push to the counterparty as part of the open, in milli-satoshi */ -uint64_t OpenChannel_get_push_msat(const LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The amount to push to the counterparty as part of the open, in milli-satoshi */ -void OpenChannel_set_push_msat(LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The threshold below which outputs on transactions broadcast by sender will be omitted */ -uint64_t OpenChannel_get_dust_limit_satoshis(const LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The threshold below which outputs on transactions broadcast by sender will be omitted */ -void OpenChannel_set_dust_limit_satoshis(LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -void OpenChannel_set_max_htlc_value_in_flight_msat(LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -uint64_t OpenChannel_get_channel_reserve_satoshis(const LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -void OpenChannel_set_channel_reserve_satoshis(LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint64_t OpenChannel_get_htlc_minimum_msat(const LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -void OpenChannel_set_htlc_minimum_msat(LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The feerate per 1000-weight of sender generated transactions, until updated by update_fee */ -uint32_t OpenChannel_get_feerate_per_kw(const LDKOpenChannel *this_ptr); +uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The feerate per 1000-weight of sender generated transactions, until updated by update_fee */ -void OpenChannel_set_feerate_per_kw(LDKOpenChannel *this_ptr, uint32_t val); +void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val); /** * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -uint16_t OpenChannel_get_to_self_delay(const LDKOpenChannel *this_ptr); +uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -void OpenChannel_set_to_self_delay(LDKOpenChannel *this_ptr, uint16_t val); +void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); /** * The maximum number of inbound HTLCs towards sender */ -uint16_t OpenChannel_get_max_accepted_htlcs(const LDKOpenChannel *this_ptr); +uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The maximum number of inbound HTLCs towards sender */ -void OpenChannel_set_max_accepted_htlcs(LDKOpenChannel *this_ptr, uint16_t val); +void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); /** * The sender's key controlling the funding transaction */ -LDKPublicKey OpenChannel_get_funding_pubkey(const LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The sender's key controlling the funding transaction */ -void OpenChannel_set_funding_pubkey(LDKOpenChannel *this_ptr, LDKPublicKey val); +void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive a revocation key for transactions broadcast by counterparty */ -LDKPublicKey OpenChannel_get_revocation_basepoint(const LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * Used to derive a revocation key for transactions broadcast by counterparty */ -void OpenChannel_set_revocation_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val); +void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * A payment key to sender for transactions broadcast by counterparty */ -LDKPublicKey OpenChannel_get_payment_point(const LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * A payment key to sender for transactions broadcast by counterparty */ -void OpenChannel_set_payment_point(LDKOpenChannel *this_ptr, LDKPublicKey val); +void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive a payment key to sender for transactions broadcast by sender */ -LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * Used to derive a payment key to sender for transactions broadcast by sender */ -void OpenChannel_set_delayed_payment_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val); +void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive an HTLC payment key to sender */ -LDKPublicKey OpenChannel_get_htlc_basepoint(const LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * Used to derive an HTLC payment key to sender */ -void OpenChannel_set_htlc_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val); +void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The first to-be-broadcast-by-sender transaction's per commitment point */ -LDKPublicKey OpenChannel_get_first_per_commitment_point(const LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The first to-be-broadcast-by-sender transaction's per commitment point */ -void OpenChannel_set_first_per_commitment_point(LDKOpenChannel *this_ptr, LDKPublicKey val); +void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Channel flags */ -uint8_t OpenChannel_get_channel_flags(const LDKOpenChannel *this_ptr); +uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * Channel flags */ -void OpenChannel_set_channel_flags(LDKOpenChannel *this_ptr, uint8_t val); +void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); -void AcceptChannel_free(LDKAcceptChannel this_ptr); +struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); -LDKAcceptChannel AcceptChannel_clone(const LDKAcceptChannel *orig); +void AcceptChannel_free(struct LDKAcceptChannel this_ptr); /** * A temporary channel ID, until the funding outpoint is announced */ -const uint8_t (*AcceptChannel_get_temporary_channel_id(const LDKAcceptChannel *this_ptr))[32]; +const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32]; /** * A temporary channel ID, until the funding outpoint is announced */ -void AcceptChannel_set_temporary_channel_id(LDKAcceptChannel *this_ptr, LDKThirtyTwoBytes val); +void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The threshold below which outputs on transactions broadcast by sender will be omitted */ -uint64_t AcceptChannel_get_dust_limit_satoshis(const LDKAcceptChannel *this_ptr); +uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The threshold below which outputs on transactions broadcast by sender will be omitted */ -void AcceptChannel_set_dust_limit_satoshis(LDKAcceptChannel *this_ptr, uint64_t val); +void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const LDKAcceptChannel *this_ptr); +uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -void AcceptChannel_set_max_htlc_value_in_flight_msat(LDKAcceptChannel *this_ptr, uint64_t val); +void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -uint64_t AcceptChannel_get_channel_reserve_satoshis(const LDKAcceptChannel *this_ptr); +uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -void AcceptChannel_set_channel_reserve_satoshis(LDKAcceptChannel *this_ptr, uint64_t val); +void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint64_t AcceptChannel_get_htlc_minimum_msat(const LDKAcceptChannel *this_ptr); +uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -void AcceptChannel_set_htlc_minimum_msat(LDKAcceptChannel *this_ptr, uint64_t val); +void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** * Minimum depth of the funding transaction before the channel is considered open */ -uint32_t AcceptChannel_get_minimum_depth(const LDKAcceptChannel *this_ptr); +uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * Minimum depth of the funding transaction before the channel is considered open */ -void AcceptChannel_set_minimum_depth(LDKAcceptChannel *this_ptr, uint32_t val); +void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val); /** * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -uint16_t AcceptChannel_get_to_self_delay(const LDKAcceptChannel *this_ptr); +uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -void AcceptChannel_set_to_self_delay(LDKAcceptChannel *this_ptr, uint16_t val); +void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); /** * The maximum number of inbound HTLCs towards sender */ -uint16_t AcceptChannel_get_max_accepted_htlcs(const LDKAcceptChannel *this_ptr); +uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The maximum number of inbound HTLCs towards sender */ -void AcceptChannel_set_max_accepted_htlcs(LDKAcceptChannel *this_ptr, uint16_t val); +void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); /** * The sender's key controlling the funding transaction */ -LDKPublicKey AcceptChannel_get_funding_pubkey(const LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The sender's key controlling the funding transaction */ -void AcceptChannel_set_funding_pubkey(LDKAcceptChannel *this_ptr, LDKPublicKey val); +void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive a revocation key for transactions broadcast by counterparty */ -LDKPublicKey AcceptChannel_get_revocation_basepoint(const LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * Used to derive a revocation key for transactions broadcast by counterparty */ -void AcceptChannel_set_revocation_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val); +void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * A payment key to sender for transactions broadcast by counterparty */ -LDKPublicKey AcceptChannel_get_payment_point(const LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * A payment key to sender for transactions broadcast by counterparty */ -void AcceptChannel_set_payment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val); +void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive a payment key to sender for transactions broadcast by sender */ -LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * Used to derive a payment key to sender for transactions broadcast by sender */ -void AcceptChannel_set_delayed_payment_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val); +void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ -LDKPublicKey AcceptChannel_get_htlc_basepoint(const LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ -void AcceptChannel_set_htlc_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val); +void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The first to-be-broadcast-by-sender transaction's per commitment point */ -LDKPublicKey AcceptChannel_get_first_per_commitment_point(const LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The first to-be-broadcast-by-sender transaction's per commitment point */ -void AcceptChannel_set_first_per_commitment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val); +void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); -void FundingCreated_free(LDKFundingCreated this_ptr); +struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); -LDKFundingCreated FundingCreated_clone(const LDKFundingCreated *orig); +void FundingCreated_free(struct LDKFundingCreated this_ptr); /** * A temporary channel ID, until the funding is established */ -const uint8_t (*FundingCreated_get_temporary_channel_id(const LDKFundingCreated *this_ptr))[32]; +const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** * A temporary channel ID, until the funding is established */ -void FundingCreated_set_temporary_channel_id(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val); +void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The funding transaction ID */ -const uint8_t (*FundingCreated_get_funding_txid(const LDKFundingCreated *this_ptr))[32]; +const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** * The funding transaction ID */ -void FundingCreated_set_funding_txid(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val); +void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The specific output index funding this channel */ -uint16_t FundingCreated_get_funding_output_index(const LDKFundingCreated *this_ptr); +uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** * The specific output index funding this channel */ -void FundingCreated_set_funding_output_index(LDKFundingCreated *this_ptr, uint16_t val); +void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); /** * The signature of the channel initiator (funder) on the funding transaction */ -LDKSignature FundingCreated_get_signature(const LDKFundingCreated *this_ptr); +struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** * The signature of the channel initiator (funder) on the funding transaction */ -void FundingCreated_set_signature(LDKFundingCreated *this_ptr, LDKSignature val); +void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val); -MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_channel_id_arg, LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, LDKSignature signature_arg); +MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg); -void FundingSigned_free(LDKFundingSigned this_ptr); +struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); -LDKFundingSigned FundingSigned_clone(const LDKFundingSigned *orig); +void FundingSigned_free(struct LDKFundingSigned this_ptr); /** * The channel ID */ -const uint8_t (*FundingSigned_get_channel_id(const LDKFundingSigned *this_ptr))[32]; +const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void FundingSigned_set_channel_id(LDKFundingSigned *this_ptr, LDKThirtyTwoBytes val); +void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The signature of the channel acceptor (fundee) on the funding transaction */ -LDKSignature FundingSigned_get_signature(const LDKFundingSigned *this_ptr); +struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** * The signature of the channel acceptor (fundee) on the funding transaction */ -void FundingSigned_set_signature(LDKFundingSigned *this_ptr, LDKSignature val); +void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); -MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg); +MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); -void FundingLocked_free(LDKFundingLocked this_ptr); +struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); -LDKFundingLocked FundingLocked_clone(const LDKFundingLocked *orig); +void FundingLocked_free(struct LDKFundingLocked this_ptr); /** * The channel ID */ -const uint8_t (*FundingLocked_get_channel_id(const LDKFundingLocked *this_ptr))[32]; +const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void FundingLocked_set_channel_id(LDKFundingLocked *this_ptr, LDKThirtyTwoBytes val); +void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The per-commitment point of the second commitment transaction */ -LDKPublicKey FundingLocked_get_next_per_commitment_point(const LDKFundingLocked *this_ptr); +struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr); /** * The per-commitment point of the second commitment transaction */ -void FundingLocked_set_next_per_commitment_point(LDKFundingLocked *this_ptr, LDKPublicKey val); +void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val); -MUST_USE_RES LDKFundingLocked FundingLocked_new(LDKThirtyTwoBytes channel_id_arg, LDKPublicKey next_per_commitment_point_arg); +MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg); -void Shutdown_free(LDKShutdown this_ptr); +struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); -LDKShutdown Shutdown_clone(const LDKShutdown *orig); +void Shutdown_free(struct LDKShutdown this_ptr); /** * The channel ID */ -const uint8_t (*Shutdown_get_channel_id(const LDKShutdown *this_ptr))[32]; +const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void Shutdown_set_channel_id(LDKShutdown *this_ptr, LDKThirtyTwoBytes val); +void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The destination of this peer's funds on closing. * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. */ -LDKu8slice Shutdown_get_scriptpubkey(const LDKShutdown *this_ptr); +struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); /** * The destination of this peer's funds on closing. * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. */ -void Shutdown_set_scriptpubkey(LDKShutdown *this_ptr, LDKCVec_u8Z val); +void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); -MUST_USE_RES LDKShutdown Shutdown_new(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(LDKClosingSigned this_ptr); +struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); -LDKClosingSigned ClosingSigned_clone(const LDKClosingSigned *orig); +void ClosingSigned_free(struct LDKClosingSigned this_ptr); /** * The channel ID */ -const uint8_t (*ClosingSigned_get_channel_id(const LDKClosingSigned *this_ptr))[32]; +const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void ClosingSigned_set_channel_id(LDKClosingSigned *this_ptr, LDKThirtyTwoBytes val); +void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The proposed total fee for the closing transaction */ -uint64_t ClosingSigned_get_fee_satoshis(const LDKClosingSigned *this_ptr); +uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** * The proposed total fee for the closing transaction */ -void ClosingSigned_set_fee_satoshis(LDKClosingSigned *this_ptr, uint64_t val); +void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); /** * A signature on the closing transaction */ -LDKSignature ClosingSigned_get_signature(const LDKClosingSigned *this_ptr); +struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** * A signature on the closing transaction */ -void ClosingSigned_set_signature(LDKClosingSigned *this_ptr, LDKSignature val); +void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); -MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, LDKSignature signature_arg); +MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg); -void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr); +struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); -LDKUpdateAddHTLC UpdateAddHTLC_clone(const LDKUpdateAddHTLC *orig); +void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr); /** * The channel ID */ -const uint8_t (*UpdateAddHTLC_get_channel_id(const LDKUpdateAddHTLC *this_ptr))[32]; +const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateAddHTLC_set_channel_id(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val); +void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The HTLC ID */ -uint64_t UpdateAddHTLC_get_htlc_id(const LDKUpdateAddHTLC *this_ptr); +uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** * The HTLC ID */ -void UpdateAddHTLC_set_htlc_id(LDKUpdateAddHTLC *this_ptr, uint64_t val); +void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** * The HTLC value in milli-satoshi */ -uint64_t UpdateAddHTLC_get_amount_msat(const LDKUpdateAddHTLC *this_ptr); +uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** * The HTLC value in milli-satoshi */ -void UpdateAddHTLC_set_amount_msat(LDKUpdateAddHTLC *this_ptr, uint64_t val); +void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** * The payment hash, the pre-image of which controls HTLC redemption */ -const uint8_t (*UpdateAddHTLC_get_payment_hash(const LDKUpdateAddHTLC *this_ptr))[32]; +const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** * The payment hash, the pre-image of which controls HTLC redemption */ -void UpdateAddHTLC_set_payment_hash(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val); +void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The expiry height of the HTLC */ -uint32_t UpdateAddHTLC_get_cltv_expiry(const LDKUpdateAddHTLC *this_ptr); +uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** * The expiry height of the HTLC */ -void UpdateAddHTLC_set_cltv_expiry(LDKUpdateAddHTLC *this_ptr, uint32_t val); +void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); -void UpdateFulfillHTLC_free(LDKUpdateFulfillHTLC this_ptr); +struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); -LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const LDKUpdateFulfillHTLC *orig); +void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr); /** * The channel ID */ -const uint8_t (*UpdateFulfillHTLC_get_channel_id(const LDKUpdateFulfillHTLC *this_ptr))[32]; +const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateFulfillHTLC_set_channel_id(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val); +void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The HTLC ID */ -uint64_t UpdateFulfillHTLC_get_htlc_id(const LDKUpdateFulfillHTLC *this_ptr); +uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** * The HTLC ID */ -void UpdateFulfillHTLC_set_htlc_id(LDKUpdateFulfillHTLC *this_ptr, uint64_t val); +void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); /** * The pre-image of the payment hash, allowing HTLC redemption */ -const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const LDKUpdateFulfillHTLC *this_ptr))[32]; +const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** * The pre-image of the payment hash, allowing HTLC redemption */ -void UpdateFulfillHTLC_set_payment_preimage(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val); +void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); -MUST_USE_RES LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, LDKThirtyTwoBytes payment_preimage_arg); +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(LDKUpdateFailHTLC this_ptr); +struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); -LDKUpdateFailHTLC UpdateFailHTLC_clone(const LDKUpdateFailHTLC *orig); +void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr); /** * The channel ID */ -const uint8_t (*UpdateFailHTLC_get_channel_id(const LDKUpdateFailHTLC *this_ptr))[32]; +const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateFailHTLC_set_channel_id(LDKUpdateFailHTLC *this_ptr, LDKThirtyTwoBytes val); +void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The HTLC ID */ -uint64_t UpdateFailHTLC_get_htlc_id(const LDKUpdateFailHTLC *this_ptr); +uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** * The HTLC ID */ -void UpdateFailHTLC_set_htlc_id(LDKUpdateFailHTLC *this_ptr, uint64_t val); +void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); -void UpdateFailMalformedHTLC_free(LDKUpdateFailMalformedHTLC this_ptr); +struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); -LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const LDKUpdateFailMalformedHTLC *orig); +void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr); /** * The channel ID */ -const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const LDKUpdateFailMalformedHTLC *this_ptr))[32]; +const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateFailMalformedHTLC_set_channel_id(LDKUpdateFailMalformedHTLC *this_ptr, LDKThirtyTwoBytes val); +void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The HTLC ID */ -uint64_t UpdateFailMalformedHTLC_get_htlc_id(const LDKUpdateFailMalformedHTLC *this_ptr); +uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** * The HTLC ID */ -void UpdateFailMalformedHTLC_set_htlc_id(LDKUpdateFailMalformedHTLC *this_ptr, uint64_t val); +void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** * The failure code */ -uint16_t UpdateFailMalformedHTLC_get_failure_code(const LDKUpdateFailMalformedHTLC *this_ptr); +uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** * The failure code */ -void UpdateFailMalformedHTLC_set_failure_code(LDKUpdateFailMalformedHTLC *this_ptr, uint16_t val); +void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); -void CommitmentSigned_free(LDKCommitmentSigned this_ptr); +struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); -LDKCommitmentSigned CommitmentSigned_clone(const LDKCommitmentSigned *orig); +void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr); /** * The channel ID */ -const uint8_t (*CommitmentSigned_get_channel_id(const LDKCommitmentSigned *this_ptr))[32]; +const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void CommitmentSigned_set_channel_id(LDKCommitmentSigned *this_ptr, LDKThirtyTwoBytes val); +void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * A signature on the commitment transaction */ -LDKSignature CommitmentSigned_get_signature(const LDKCommitmentSigned *this_ptr); +struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** * A signature on the commitment transaction */ -void CommitmentSigned_set_signature(LDKCommitmentSigned *this_ptr, LDKSignature val); +void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); /** * Signatures on the HTLC transactions */ -void CommitmentSigned_set_htlc_signatures(LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); -MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_id_arg, 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(LDKRevokeAndACK this_ptr); +struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); -LDKRevokeAndACK RevokeAndACK_clone(const LDKRevokeAndACK *orig); +void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr); /** * The channel ID */ -const uint8_t (*RevokeAndACK_get_channel_id(const LDKRevokeAndACK *this_ptr))[32]; +const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void RevokeAndACK_set_channel_id(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val); +void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The secret corresponding to the per-commitment point */ -const uint8_t (*RevokeAndACK_get_per_commitment_secret(const LDKRevokeAndACK *this_ptr))[32]; +const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** * The secret corresponding to the per-commitment point */ -void RevokeAndACK_set_per_commitment_secret(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val); +void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The next sender-broadcast commitment transaction's per-commitment point */ -LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const LDKRevokeAndACK *this_ptr); +struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** * The next sender-broadcast commitment transaction's per-commitment point */ -void RevokeAndACK_set_next_per_commitment_point(LDKRevokeAndACK *this_ptr, LDKPublicKey val); +void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); -MUST_USE_RES LDKRevokeAndACK RevokeAndACK_new(LDKThirtyTwoBytes channel_id_arg, LDKThirtyTwoBytes per_commitment_secret_arg, LDKPublicKey next_per_commitment_point_arg); +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(LDKUpdateFee this_ptr); +struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); -LDKUpdateFee UpdateFee_clone(const LDKUpdateFee *orig); +void UpdateFee_free(struct LDKUpdateFee this_ptr); /** * The channel ID */ -const uint8_t (*UpdateFee_get_channel_id(const LDKUpdateFee *this_ptr))[32]; +const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateFee_set_channel_id(LDKUpdateFee *this_ptr, LDKThirtyTwoBytes val); +void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * Fee rate per 1000-weight of the transaction */ -uint32_t UpdateFee_get_feerate_per_kw(const LDKUpdateFee *this_ptr); +uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); /** * Fee rate per 1000-weight of the transaction */ -void UpdateFee_set_feerate_per_kw(LDKUpdateFee *this_ptr, uint32_t val); +void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); -MUST_USE_RES LDKUpdateFee UpdateFee_new(LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); +MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); -void DataLossProtect_free(LDKDataLossProtect this_ptr); +struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); -LDKDataLossProtect DataLossProtect_clone(const LDKDataLossProtect *orig); +void DataLossProtect_free(struct LDKDataLossProtect this_ptr); /** * Proof that the sender knows the per-commitment secret of a specific commitment transaction * belonging to the recipient */ -const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const LDKDataLossProtect *this_ptr))[32]; +const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32]; /** * Proof that the sender knows the per-commitment secret of a specific commitment transaction * belonging to the recipient */ -void DataLossProtect_set_your_last_per_commitment_secret(LDKDataLossProtect *this_ptr, LDKThirtyTwoBytes val); +void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The sender's per-commitment point for their current commitment transaction */ -LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const LDKDataLossProtect *this_ptr); +struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr); /** * The sender's per-commitment point for their current commitment transaction */ -void DataLossProtect_set_my_current_per_commitment_point(LDKDataLossProtect *this_ptr, LDKPublicKey val); +void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val); -MUST_USE_RES LDKDataLossProtect DataLossProtect_new(LDKThirtyTwoBytes your_last_per_commitment_secret_arg, LDKPublicKey my_current_per_commitment_point_arg); +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(LDKChannelReestablish this_ptr); +struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig); -LDKChannelReestablish ChannelReestablish_clone(const LDKChannelReestablish *orig); +void ChannelReestablish_free(struct LDKChannelReestablish this_ptr); /** * The channel ID */ -const uint8_t (*ChannelReestablish_get_channel_id(const LDKChannelReestablish *this_ptr))[32]; +const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void ChannelReestablish_set_channel_id(LDKChannelReestablish *this_ptr, LDKThirtyTwoBytes val); +void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The next commitment number for the sender */ -uint64_t ChannelReestablish_get_next_local_commitment_number(const LDKChannelReestablish *this_ptr); +uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** * The next commitment number for the sender */ -void ChannelReestablish_set_next_local_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val); +void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** * The next commitment number for the recipient */ -uint64_t ChannelReestablish_get_next_remote_commitment_number(const LDKChannelReestablish *this_ptr); +uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** * The next commitment number for the recipient */ -void ChannelReestablish_set_next_remote_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val); +void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); -void AnnouncementSignatures_free(LDKAnnouncementSignatures this_ptr); +struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); -LDKAnnouncementSignatures AnnouncementSignatures_clone(const LDKAnnouncementSignatures *orig); +void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr); /** * The channel ID */ -const uint8_t (*AnnouncementSignatures_get_channel_id(const LDKAnnouncementSignatures *this_ptr))[32]; +const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void AnnouncementSignatures_set_channel_id(LDKAnnouncementSignatures *this_ptr, LDKThirtyTwoBytes val); +void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The short channel ID */ -uint64_t AnnouncementSignatures_get_short_channel_id(const LDKAnnouncementSignatures *this_ptr); +uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * The short channel ID */ -void AnnouncementSignatures_set_short_channel_id(LDKAnnouncementSignatures *this_ptr, uint64_t val); +void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); /** * A signature by the node key */ -LDKSignature AnnouncementSignatures_get_node_signature(const LDKAnnouncementSignatures *this_ptr); +struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * A signature by the node key */ -void AnnouncementSignatures_set_node_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val); +void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); /** * A signature by the funding key */ -LDKSignature AnnouncementSignatures_get_bitcoin_signature(const LDKAnnouncementSignatures *this_ptr); +struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * A signature by the funding key */ -void AnnouncementSignatures_set_bitcoin_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val); +void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); + +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); -MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, LDKSignature node_signature_arg, LDKSignature bitcoin_signature_arg); +void NetAddress_free(struct LDKNetAddress this_ptr); -void NetAddress_free(LDKNetAddress this_ptr); +struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); -LDKNetAddress NetAddress_clone(const LDKNetAddress *orig); +struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); -void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr); +struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser); -LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const LDKUnsignedNodeAnnouncement *orig); +void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr); /** * The advertised features */ -LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const LDKUnsignedNodeAnnouncement *this_ptr); +struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** * The advertised features */ -void UnsignedNodeAnnouncement_set_features(LDKUnsignedNodeAnnouncement *this_ptr, LDKNodeFeatures val); +void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** * A strictly monotonic announcement counter, with gaps allowed */ -uint32_t UnsignedNodeAnnouncement_get_timestamp(const LDKUnsignedNodeAnnouncement *this_ptr); +uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** * A strictly monotonic announcement counter, with gaps allowed */ -void UnsignedNodeAnnouncement_set_timestamp(LDKUnsignedNodeAnnouncement *this_ptr, uint32_t val); +void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); /** * The node_id this announcement originated from (don't rebroadcast the node_announcement back * to this node). */ -LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const LDKUnsignedNodeAnnouncement *this_ptr); +struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** * The node_id this announcement originated from (don't rebroadcast the node_announcement back * to this node). */ -void UnsignedNodeAnnouncement_set_node_id(LDKUnsignedNodeAnnouncement *this_ptr, LDKPublicKey val); +void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * An RGB color for UI purposes */ -const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const LDKUnsignedNodeAnnouncement *this_ptr))[3]; +const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; /** * An RGB color for UI purposes */ -void UnsignedNodeAnnouncement_set_rgb(LDKUnsignedNodeAnnouncement *this_ptr, LDKThreeBytes val); +void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** * An alias, for UI purposes. This should be sanitized before use. There is no guarantee * of uniqueness. */ -const uint8_t (*UnsignedNodeAnnouncement_get_alias(const LDKUnsignedNodeAnnouncement *this_ptr))[32]; +const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32]; /** * An alias, for UI purposes. This should be sanitized before use. There is no guarantee * of uniqueness. */ -void UnsignedNodeAnnouncement_set_alias(LDKUnsignedNodeAnnouncement *this_ptr, LDKThirtyTwoBytes val); +void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * List of addresses on which this node is reachable */ -void UnsignedNodeAnnouncement_set_addresses(LDKUnsignedNodeAnnouncement *this_ptr, LDKCVec_NetAddressZ val); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); -void NodeAnnouncement_free(LDKNodeAnnouncement this_ptr); +struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); -LDKNodeAnnouncement NodeAnnouncement_clone(const LDKNodeAnnouncement *orig); +void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr); /** * The signature by the node key */ -LDKSignature NodeAnnouncement_get_signature(const LDKNodeAnnouncement *this_ptr); +struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** * The signature by the node key */ -void NodeAnnouncement_set_signature(LDKNodeAnnouncement *this_ptr, LDKSignature val); +void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * The actual content of the announcement */ -LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const LDKNodeAnnouncement *this_ptr); +struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** * The actual content of the announcement */ -void NodeAnnouncement_set_contents(LDKNodeAnnouncement *this_ptr, LDKUnsignedNodeAnnouncement val); +void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); -MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg, LDKUnsignedNodeAnnouncement contents_arg); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); -void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr); +struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); -LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const LDKUnsignedChannelAnnouncement *orig); +void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr); /** * The advertised channel features */ -LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The advertised channel features */ -void UnsignedChannelAnnouncement_set_features(LDKUnsignedChannelAnnouncement *this_ptr, LDKChannelFeatures val); +void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** * The genesis hash of the blockchain where the channel is to be opened */ -const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const LDKUnsignedChannelAnnouncement *this_ptr))[32]; +const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain where the channel is to be opened */ -void UnsignedChannelAnnouncement_set_chain_hash(LDKUnsignedChannelAnnouncement *this_ptr, LDKThirtyTwoBytes val); +void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The short channel ID */ -uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const LDKUnsignedChannelAnnouncement *this_ptr); +uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The short channel ID */ -void UnsignedChannelAnnouncement_set_short_channel_id(LDKUnsignedChannelAnnouncement *this_ptr, uint64_t val); +void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); /** * One of the two node_ids which are endpoints of this channel */ -LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * One of the two node_ids which are endpoints of this channel */ -void UnsignedChannelAnnouncement_set_node_id_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val); +void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The other of the two node_ids which are endpoints of this channel */ -LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The other of the two node_ids which are endpoints of this channel */ -void UnsignedChannelAnnouncement_set_node_id_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val); +void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The funding key for the first node */ -LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The funding key for the first node */ -void UnsignedChannelAnnouncement_set_bitcoin_key_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val); +void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The funding key for the second node */ -LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The funding key for the second node */ -void UnsignedChannelAnnouncement_set_bitcoin_key_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val); +void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); -void ChannelAnnouncement_free(LDKChannelAnnouncement this_ptr); +struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); -LDKChannelAnnouncement ChannelAnnouncement_clone(const LDKChannelAnnouncement *orig); +void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr); /** * Authentication of the announcement by the first public node */ -LDKSignature ChannelAnnouncement_get_node_signature_1(const LDKChannelAnnouncement *this_ptr); +struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Authentication of the announcement by the first public node */ -void ChannelAnnouncement_set_node_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val); +void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * Authentication of the announcement by the second public node */ -LDKSignature ChannelAnnouncement_get_node_signature_2(const LDKChannelAnnouncement *this_ptr); +struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Authentication of the announcement by the second public node */ -void ChannelAnnouncement_set_node_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val); +void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * Proof of funding UTXO ownership by the first public node */ -LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const LDKChannelAnnouncement *this_ptr); +struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Proof of funding UTXO ownership by the first public node */ -void ChannelAnnouncement_set_bitcoin_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val); +void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * Proof of funding UTXO ownership by the second public node */ -LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const LDKChannelAnnouncement *this_ptr); +struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Proof of funding UTXO ownership by the second public node */ -void ChannelAnnouncement_set_bitcoin_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val); +void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * The actual announcement */ -LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const LDKChannelAnnouncement *this_ptr); +struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * The actual announcement */ -void ChannelAnnouncement_set_contents(LDKChannelAnnouncement *this_ptr, LDKUnsignedChannelAnnouncement val); +void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); -MUST_USE_RES LDKChannelAnnouncement ChannelAnnouncement_new(LDKSignature node_signature_1_arg, LDKSignature node_signature_2_arg, LDKSignature bitcoin_signature_1_arg, LDKSignature bitcoin_signature_2_arg, LDKUnsignedChannelAnnouncement contents_arg); +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(LDKUnsignedChannelUpdate this_ptr); +struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); -LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const LDKUnsignedChannelUpdate *orig); +void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr); /** * The genesis hash of the blockchain where the channel is to be opened */ -const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const LDKUnsignedChannelUpdate *this_ptr))[32]; +const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain where the channel is to be opened */ -void UnsignedChannelUpdate_set_chain_hash(LDKUnsignedChannelUpdate *this_ptr, LDKThirtyTwoBytes val); +void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The short channel ID */ -uint64_t UnsignedChannelUpdate_get_short_channel_id(const LDKUnsignedChannelUpdate *this_ptr); +uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The short channel ID */ -void UnsignedChannelUpdate_set_short_channel_id(LDKUnsignedChannelUpdate *this_ptr, uint64_t val); +void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -uint32_t UnsignedChannelUpdate_get_timestamp(const LDKUnsignedChannelUpdate *this_ptr); +uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -void UnsignedChannelUpdate_set_timestamp(LDKUnsignedChannelUpdate *this_ptr, uint32_t val); +void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** * Channel flags */ -uint8_t UnsignedChannelUpdate_get_flags(const LDKUnsignedChannelUpdate *this_ptr); +uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * Channel flags */ -void UnsignedChannelUpdate_set_flags(LDKUnsignedChannelUpdate *this_ptr, uint8_t val); +void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); /** * The number of blocks to subtract from incoming HTLC cltv_expiry values */ -uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const LDKUnsignedChannelUpdate *this_ptr); +uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The number of blocks to subtract from incoming HTLC cltv_expiry values */ -void UnsignedChannelUpdate_set_cltv_expiry_delta(LDKUnsignedChannelUpdate *this_ptr, uint16_t val); +void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const LDKUnsignedChannelUpdate *this_ptr); +uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -void UnsignedChannelUpdate_set_htlc_minimum_msat(LDKUnsignedChannelUpdate *this_ptr, uint64_t val); +void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** * The base HTLC fee charged by sender, in milli-satoshi */ -uint32_t UnsignedChannelUpdate_get_fee_base_msat(const LDKUnsignedChannelUpdate *this_ptr); +uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The base HTLC fee charged by sender, in milli-satoshi */ -void UnsignedChannelUpdate_set_fee_base_msat(LDKUnsignedChannelUpdate *this_ptr, uint32_t val); +void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** * The amount to fee multiplier, in micro-satoshi */ -uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const LDKUnsignedChannelUpdate *this_ptr); +uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The amount to fee multiplier, in micro-satoshi */ -void UnsignedChannelUpdate_set_fee_proportional_millionths(LDKUnsignedChannelUpdate *this_ptr, uint32_t val); +void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); -void ChannelUpdate_free(LDKChannelUpdate this_ptr); +struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); -LDKChannelUpdate ChannelUpdate_clone(const LDKChannelUpdate *orig); +void ChannelUpdate_free(struct LDKChannelUpdate this_ptr); /** * A signature of the channel update */ -LDKSignature ChannelUpdate_get_signature(const LDKChannelUpdate *this_ptr); +struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** * A signature of the channel update */ -void ChannelUpdate_set_signature(LDKChannelUpdate *this_ptr, LDKSignature val); +void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val); /** * The actual channel update */ -LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const LDKChannelUpdate *this_ptr); +struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** * The actual channel update */ -void ChannelUpdate_set_contents(LDKChannelUpdate *this_ptr, LDKUnsignedChannelUpdate val); +void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); -MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKUnsignedChannelUpdate contents_arg); +MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); -void QueryChannelRange_free(LDKQueryChannelRange this_ptr); +struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); -LDKQueryChannelRange QueryChannelRange_clone(const LDKQueryChannelRange *orig); +void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr); /** * The genesis hash of the blockchain being queried */ -const uint8_t (*QueryChannelRange_get_chain_hash(const LDKQueryChannelRange *this_ptr))[32]; +const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain being queried */ -void QueryChannelRange_set_chain_hash(LDKQueryChannelRange *this_ptr, LDKThirtyTwoBytes val); +void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The height of the first block for the channel UTXOs being queried */ -uint32_t QueryChannelRange_get_first_blocknum(const LDKQueryChannelRange *this_ptr); +uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** * The height of the first block for the channel UTXOs being queried */ -void QueryChannelRange_set_first_blocknum(LDKQueryChannelRange *this_ptr, uint32_t val); +void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** * The number of blocks to include in the query results */ -uint32_t QueryChannelRange_get_number_of_blocks(const LDKQueryChannelRange *this_ptr); +uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** * The number of blocks to include in the query results */ -void QueryChannelRange_set_number_of_blocks(LDKQueryChannelRange *this_ptr, uint32_t val); +void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); -MUST_USE_RES LDKQueryChannelRange QueryChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); +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(LDKReplyChannelRange this_ptr); +struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); -LDKReplyChannelRange ReplyChannelRange_clone(const LDKReplyChannelRange *orig); +void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr); /** * The genesis hash of the blockchain being queried */ -const uint8_t (*ReplyChannelRange_get_chain_hash(const LDKReplyChannelRange *this_ptr))[32]; +const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain being queried */ -void ReplyChannelRange_set_chain_hash(LDKReplyChannelRange *this_ptr, LDKThirtyTwoBytes val); +void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The height of the first block in the range of the reply */ -uint32_t ReplyChannelRange_get_first_blocknum(const LDKReplyChannelRange *this_ptr); +uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** * The height of the first block in the range of the reply */ -void ReplyChannelRange_set_first_blocknum(LDKReplyChannelRange *this_ptr, uint32_t val); +void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** * The number of blocks included in the range of the reply */ -uint32_t ReplyChannelRange_get_number_of_blocks(const LDKReplyChannelRange *this_ptr); +uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** * The number of blocks included in the range of the reply */ -void ReplyChannelRange_set_number_of_blocks(LDKReplyChannelRange *this_ptr, uint32_t val); +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 LDKReplyChannelRange *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(LDKReplyChannelRange *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(LDKReplyChannelRange *this_ptr, LDKCVec_u64Z val); +void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); -MUST_USE_RES LDKReplyChannelRange ReplyChannelRange_new(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(LDKQueryShortChannelIds this_ptr); +struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); -LDKQueryShortChannelIds QueryShortChannelIds_clone(const LDKQueryShortChannelIds *orig); +void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr); /** * The genesis hash of the blockchain being queried */ -const uint8_t (*QueryShortChannelIds_get_chain_hash(const LDKQueryShortChannelIds *this_ptr))[32]; +const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain being queried */ -void QueryShortChannelIds_set_chain_hash(LDKQueryShortChannelIds *this_ptr, LDKThirtyTwoBytes val); +void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The short_channel_ids that are being queried */ -void QueryShortChannelIds_set_short_channel_ids(LDKQueryShortChannelIds *this_ptr, LDKCVec_u64Z val); +void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); -MUST_USE_RES LDKQueryShortChannelIds QueryShortChannelIds_new(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(LDKReplyShortChannelIdsEnd this_ptr); +struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); -LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const LDKReplyShortChannelIdsEnd *orig); +void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr); /** * The genesis hash of the blockchain that was queried */ -const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const LDKReplyShortChannelIdsEnd *this_ptr))[32]; +const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain that was queried */ -void ReplyShortChannelIdsEnd_set_chain_hash(LDKReplyShortChannelIdsEnd *this_ptr, LDKThirtyTwoBytes val); +void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * Indicates if the query recipient maintains up-to-date channel * information for the chain_hash */ -bool ReplyShortChannelIdsEnd_get_full_information(const LDKReplyShortChannelIdsEnd *this_ptr); +bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); /** * Indicates if the query recipient maintains up-to-date channel * information for the chain_hash */ -void ReplyShortChannelIdsEnd_set_full_information(LDKReplyShortChannelIdsEnd *this_ptr, bool val); +void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); -MUST_USE_RES LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); +MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); -void GossipTimestampFilter_free(LDKGossipTimestampFilter this_ptr); +struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); -LDKGossipTimestampFilter GossipTimestampFilter_clone(const LDKGossipTimestampFilter *orig); +void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr); /** * The genesis hash of the blockchain for channel and node information */ -const uint8_t (*GossipTimestampFilter_get_chain_hash(const LDKGossipTimestampFilter *this_ptr))[32]; +const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain for channel and node information */ -void GossipTimestampFilter_set_chain_hash(LDKGossipTimestampFilter *this_ptr, LDKThirtyTwoBytes val); +void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The starting unix timestamp */ -uint32_t GossipTimestampFilter_get_first_timestamp(const LDKGossipTimestampFilter *this_ptr); +uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** * The starting unix timestamp */ -void GossipTimestampFilter_set_first_timestamp(LDKGossipTimestampFilter *this_ptr, uint32_t val); +void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** * The range of information in seconds */ -uint32_t GossipTimestampFilter_get_timestamp_range(const LDKGossipTimestampFilter *this_ptr); +uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** * The range of information in seconds */ -void GossipTimestampFilter_set_timestamp_range(LDKGossipTimestampFilter *this_ptr, uint32_t val); +void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); -MUST_USE_RES LDKGossipTimestampFilter GossipTimestampFilter_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); +MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); -void ErrorAction_free(LDKErrorAction this_ptr); +struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); -LDKErrorAction ErrorAction_clone(const LDKErrorAction *orig); +void ErrorAction_free(struct LDKErrorAction this_ptr); -void LightningError_free(LDKLightningError this_ptr); +struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); + +void LightningError_free(struct LDKLightningError this_ptr); /** * A human-readable message describing the error */ -LDKStr LightningError_get_err(const LDKLightningError *this_ptr); +struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); /** * A human-readable message describing the error */ -void LightningError_set_err(LDKLightningError *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. */ -LDKErrorAction LightningError_get_action(const LDKLightningError *this_ptr); +struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); /** * The action which should be taken against the offending peer. */ -void LightningError_set_action(LDKLightningError *this_ptr, LDKErrorAction val); +void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); -MUST_USE_RES LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, LDKErrorAction action_arg); +MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg); -void CommitmentUpdate_free(LDKCommitmentUpdate this_ptr); +struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); -LDKCommitmentUpdate CommitmentUpdate_clone(const LDKCommitmentUpdate *orig); +void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr); /** * update_add_htlc messages which should be sent */ -void CommitmentUpdate_set_update_add_htlcs(LDKCommitmentUpdate *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(LDKCommitmentUpdate *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(LDKCommitmentUpdate *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(LDKCommitmentUpdate *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 */ -LDKUpdateFee CommitmentUpdate_get_update_fee(const LDKCommitmentUpdate *this_ptr); +struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** * An update_fee message which should be sent */ -void CommitmentUpdate_set_update_fee(LDKCommitmentUpdate *this_ptr, LDKUpdateFee val); +void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); /** * Finally, the commitment_signed message which should be sent */ -LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const LDKCommitmentUpdate *this_ptr); +struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** * Finally, the commitment_signed message which should be sent */ -void CommitmentUpdate_set_commitment_signed(LDKCommitmentUpdate *this_ptr, LDKCommitmentSigned val); +void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); + +MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); -MUST_USE_RES 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, LDKUpdateFee update_fee_arg, LDKCommitmentSigned commitment_signed_arg); +struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); -void HTLCFailChannelUpdate_free(LDKHTLCFailChannelUpdate this_ptr); +void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr); -LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const LDKHTLCFailChannelUpdate *orig); +struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void ChannelMessageHandler_free(LDKChannelMessageHandler this_ptr); +void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); /** * Calls the free function if one is set */ -void RoutingMessageHandler_free(LDKRoutingMessageHandler this_ptr); +void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); -LDKCVec_u8Z AcceptChannel_write(const LDKAcceptChannel *obj); +struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); -LDKAcceptChannel AcceptChannel_read(LDKu8slice ser); +struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); -LDKCVec_u8Z AnnouncementSignatures_write(const LDKAnnouncementSignatures *obj); +struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); -LDKAnnouncementSignatures AnnouncementSignatures_read(LDKu8slice ser); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelReestablish_write(const LDKChannelReestablish *obj); +struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); -LDKChannelReestablish ChannelReestablish_read(LDKu8slice ser); +struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); -LDKCVec_u8Z ClosingSigned_write(const LDKClosingSigned *obj); +struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); -LDKClosingSigned ClosingSigned_read(LDKu8slice ser); +struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z CommitmentSigned_write(const LDKCommitmentSigned *obj); +struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); -LDKCommitmentSigned CommitmentSigned_read(LDKu8slice ser); +struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingCreated_write(const LDKFundingCreated *obj); +struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); -LDKFundingCreated FundingCreated_read(LDKu8slice ser); +struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingSigned_write(const LDKFundingSigned *obj); +struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); -LDKFundingSigned FundingSigned_read(LDKu8slice ser); +struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingLocked_write(const LDKFundingLocked *obj); +struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj); -LDKFundingLocked FundingLocked_read(LDKu8slice ser); +struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser); -LDKCVec_u8Z Init_write(const LDKInit *obj); +struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); -LDKInit Init_read(LDKu8slice ser); +struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); -LDKCVec_u8Z OpenChannel_write(const LDKOpenChannel *obj); +struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); -LDKOpenChannel OpenChannel_read(LDKu8slice ser); +struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); -LDKCVec_u8Z RevokeAndACK_write(const LDKRevokeAndACK *obj); +struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); -LDKRevokeAndACK RevokeAndACK_read(LDKu8slice ser); +struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); -LDKCVec_u8Z Shutdown_write(const LDKShutdown *obj); +struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); -LDKShutdown Shutdown_read(LDKu8slice ser); +struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFailHTLC_write(const LDKUpdateFailHTLC *obj); +struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); -LDKUpdateFailHTLC UpdateFailHTLC_read(LDKu8slice ser); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFailMalformedHTLC_write(const LDKUpdateFailMalformedHTLC *obj); +struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); -LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(LDKu8slice ser); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFee_write(const LDKUpdateFee *obj); +struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); -LDKUpdateFee UpdateFee_read(LDKu8slice ser); +struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFulfillHTLC_write(const LDKUpdateFulfillHTLC *obj); +struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); -LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(LDKu8slice ser); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateAddHTLC_write(const LDKUpdateAddHTLC *obj); +struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); -LDKUpdateAddHTLC UpdateAddHTLC_read(LDKu8slice ser); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z Ping_write(const LDKPing *obj); +struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); -LDKPing Ping_read(LDKu8slice ser); +struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); -LDKCVec_u8Z Pong_write(const LDKPong *obj); +struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); -LDKPong Pong_read(LDKu8slice ser); +struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedChannelAnnouncement_write(const LDKUnsignedChannelAnnouncement *obj); +struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); -LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_read(LDKu8slice ser); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelAnnouncement_write(const LDKChannelAnnouncement *obj); +struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); -LDKChannelAnnouncement ChannelAnnouncement_read(LDKu8slice ser); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedChannelUpdate_write(const LDKUnsignedChannelUpdate *obj); +struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); -LDKUnsignedChannelUpdate UnsignedChannelUpdate_read(LDKu8slice ser); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelUpdate_write(const LDKChannelUpdate *obj); +struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); -LDKChannelUpdate ChannelUpdate_read(LDKu8slice ser); +struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); -LDKCVec_u8Z ErrorMessage_write(const LDKErrorMessage *obj); +struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); -LDKErrorMessage ErrorMessage_read(LDKu8slice ser); +struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedNodeAnnouncement_write(const LDKUnsignedNodeAnnouncement *obj); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); -LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_read(LDKu8slice ser); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z NodeAnnouncement_write(const LDKNodeAnnouncement *obj); +struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); -LDKNodeAnnouncement NodeAnnouncement_read(LDKu8slice ser); +struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); -LDKQueryShortChannelIds QueryShortChannelIds_read(LDKu8slice ser); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); -LDKCVec_u8Z QueryShortChannelIds_write(const LDKQueryShortChannelIds *obj); +struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); -LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_read(LDKu8slice ser); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); -LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const LDKReplyShortChannelIdsEnd *obj); +struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); -LDKQueryChannelRange QueryChannelRange_read(LDKu8slice ser); +struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); -LDKCVec_u8Z QueryChannelRange_write(const LDKQueryChannelRange *obj); +struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); -LDKReplyChannelRange ReplyChannelRange_read(LDKu8slice ser); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); -LDKCVec_u8Z ReplyChannelRange_write(const LDKReplyChannelRange *obj); +struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); -LDKGossipTimestampFilter GossipTimestampFilter_read(LDKu8slice ser); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); -LDKCVec_u8Z GossipTimestampFilter_write(const LDKGossipTimestampFilter *obj); +struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); -void MessageHandler_free(LDKMessageHandler this_ptr); +void MessageHandler_free(struct LDKMessageHandler this_ptr); /** * A message handler which handles messages specific to channels. Usually this is just a * ChannelManager object. */ -const LDKChannelMessageHandler *MessageHandler_get_chan_handler(const LDKMessageHandler *this_ptr); +const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** * A message handler which handles messages specific to channels. Usually this is just a * ChannelManager object. */ -void MessageHandler_set_chan_handler(LDKMessageHandler *this_ptr, LDKChannelMessageHandler val); +void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); /** * A message handler which handles messages updating our knowledge of the network channel * graph. Usually this is just a NetGraphMsgHandlerMonitor object. */ -const LDKRoutingMessageHandler *MessageHandler_get_route_handler(const LDKMessageHandler *this_ptr); +const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** * A message handler which handles messages updating our knowledge of the network channel * graph. Usually this is just a NetGraphMsgHandlerMonitor object. */ -void MessageHandler_set_route_handler(LDKMessageHandler *this_ptr, LDKRoutingMessageHandler val); +void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); -MUST_USE_RES LDKMessageHandler MessageHandler_new(LDKChannelMessageHandler chan_handler_arg, LDKRoutingMessageHandler route_handler_arg); +MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg); -LDKSocketDescriptor SocketDescriptor_clone(const LDKSocketDescriptor *orig); +struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void SocketDescriptor_free(LDKSocketDescriptor this_ptr); +void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); -void PeerHandleError_free(LDKPeerHandleError this_ptr); +void PeerHandleError_free(struct LDKPeerHandleError this_ptr); /** * Used to indicate that we probably can't make any future connections to this peer, implying * we should go ahead and force-close any channels we have with it. */ -bool PeerHandleError_get_no_connection_possible(const LDKPeerHandleError *this_ptr); +bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr); /** * Used to indicate that we probably can't make any future connections to this peer, implying * we should go ahead and force-close any channels we have with it. */ -void PeerHandleError_set_no_connection_possible(LDKPeerHandleError *this_ptr, bool val); +void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val); -MUST_USE_RES LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); +MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); -void PeerManager_free(LDKPeerManager this_ptr); +struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); + +void PeerManager_free(struct LDKPeerManager this_ptr); /** * Constructs a new PeerManager with the given message handlers and node_id secret key * ephemeral_random_data is used to derive per-connection ephemeral keys and must be * cryptographically secure random bytes. */ -MUST_USE_RES LDKPeerManager PeerManager_new(LDKMessageHandler message_handler, LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], LDKLogger logger); +MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger); /** * Get the list of node ids for peers which have completed the initial handshake. @@ -6282,7 +7496,7 @@ MUST_USE_RES LDKPeerManager PeerManager_new(LDKMessageHandler message_handler, L * 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 LDKPeerManager *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. @@ -6294,7 +7508,7 @@ MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const LDKPeerManag * 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 LDKPeerManager *this_arg, LDKPublicKey their_node_id, 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. @@ -6307,7 +7521,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 LDKPeerManager *this_arg, 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. @@ -6321,7 +7535,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 LDKPeerManager *this_arg, LDKSocketDescriptor *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. @@ -6337,14 +7551,14 @@ 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 LDKPeerManager *this_arg, LDKSocketDescriptor *peer_descriptor, 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 * response messages as well as messages generated by calls to handler functions directly (eg * functions like ChannelManager::process_pending_htlc_forward or send_payment). */ -void PeerManager_process_events(const LDKPeerManager *this_arg); +void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); /** * Indicates that the given socket descriptor's connection is now closed. @@ -6356,19 +7570,30 @@ void PeerManager_process_events(const LDKPeerManager *this_arg); * * Panics if the descriptor was not previously registered in a successful new_*_connection event. */ -void PeerManager_socket_disconnected(const LDKPeerManager *this_arg, const LDKSocketDescriptor *descriptor); +void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); + +/** + * Disconnect a peer given its node id. + * + * Set no_connection_possible to true to prevent any further connection with this peer, + * force-closing any channels we have with it. + * + * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer, + * so be careful about reentrancy issues. + */ +void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible); /** * This function should be called roughly once every 30 seconds. * It will send pings to each peer and disconnect those which did not respond to the last round of pings. * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues! */ -void PeerManager_timer_tick_occured(const LDKPeerManager *this_arg); +void PeerManager_timer_tick_occured(const struct LDKPeerManager *NONNULL_PTR this_arg); /** * Build the commitment secret from the seed and the commitment number */ -LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); +struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); /** * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) @@ -6377,7 +7602,7 @@ LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], * 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(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) @@ -6387,7 +7612,7 @@ LDKCResult_SecretKeySecpErrorZ derive_private_key(LDKPublicKey per_commitment_po * 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(LDKPublicKey per_commitment_point, 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. @@ -6400,7 +7625,7 @@ LDKCResult_PublicKeySecpErrorZ derive_public_key(LDKPublicKey per_commitment_poi * 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 @@ -6415,107 +7640,85 @@ 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(LDKPublicKey per_commitment_point, 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(LDKTxCreationKeys this_ptr); - -LDKTxCreationKeys TxCreationKeys_clone(const LDKTxCreationKeys *orig); +void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr); /** * The broadcaster's per-commitment public key which was used to derive the other keys. */ -LDKPublicKey TxCreationKeys_get_per_commitment_point(const LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * The broadcaster's per-commitment public key which was used to derive the other keys. */ -void TxCreationKeys_set_per_commitment_point(LDKTxCreationKeys *this_ptr, LDKPublicKey val); +void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The revocation key which is used to allow the broadcaster of the commitment * transaction to provide their counterparty the ability to punish them if they broadcast * an old state. */ -LDKPublicKey TxCreationKeys_get_revocation_key(const LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * The revocation key which is used to allow the broadcaster of the commitment * transaction to provide their counterparty the ability to punish them if they broadcast * an old state. */ -void TxCreationKeys_set_revocation_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val); +void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Broadcaster's HTLC Key */ -LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Broadcaster's HTLC Key */ -void TxCreationKeys_set_broadcaster_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val); +void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Countersignatory's HTLC Key */ -LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Countersignatory's HTLC Key */ -void TxCreationKeys_set_countersignatory_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val); +void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -void TxCreationKeys_set_broadcaster_delayed_payment_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val); - -MUST_USE_RES LDKTxCreationKeys TxCreationKeys_new(LDKPublicKey per_commitment_point_arg, LDKPublicKey revocation_key_arg, LDKPublicKey broadcaster_htlc_key_arg, LDKPublicKey countersignatory_htlc_key_arg, LDKPublicKey broadcaster_delayed_payment_key_arg); - -LDKCVec_u8Z TxCreationKeys_write(const LDKTxCreationKeys *obj); - -LDKTxCreationKeys TxCreationKeys_read(LDKu8slice ser); +void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); -void PreCalculatedTxCreationKeys_free(LDKPreCalculatedTxCreationKeys this_ptr); +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); -LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_clone(const LDKPreCalculatedTxCreationKeys *orig); +struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); -/** - * Create a new PreCalculatedTxCreationKeys from TxCreationKeys - */ -MUST_USE_RES LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_new(LDKTxCreationKeys keys); - -/** - * The pre-calculated transaction creation public keys. - * An external validating signer should not trust these keys. - */ -MUST_USE_RES LDKTxCreationKeys PreCalculatedTxCreationKeys_trust_key_derivation(const LDKPreCalculatedTxCreationKeys *this_arg); - -/** - * The transaction per-commitment point - */ -MUST_USE_RES LDKPublicKey PreCalculatedTxCreationKeys_per_commitment_point(const LDKPreCalculatedTxCreationKeys *this_arg); +struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); -void ChannelPublicKeys_free(LDKChannelPublicKeys this_ptr); +struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); -LDKChannelPublicKeys ChannelPublicKeys_clone(const LDKChannelPublicKeys *orig); +void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr); /** * The public key which is used to sign all commitment transactions, as it appears in the * on-chain channel lock-in 2-of-2 multisig output. */ -LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The public key which is used to sign all commitment transactions, as it appears in the * on-chain channel lock-in 2-of-2 multisig output. */ -void ChannelPublicKeys_set_funding_pubkey(LDKChannelPublicKeys *this_ptr, LDKPublicKey val); +void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The base point which is used (with derive_public_revocation_key) to derive per-commitment @@ -6523,7 +7726,7 @@ void ChannelPublicKeys_set_funding_pubkey(LDKChannelPublicKeys *this_ptr, LDKPub * counterparty to create a secret which the counterparty can reveal to revoke previous * states. */ -LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The base point which is used (with derive_public_revocation_key) to derive per-commitment @@ -6531,69 +7734,76 @@ LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const LDKChannelPublicKe * counterparty to create a secret which the counterparty can reveal to revoke previous * states. */ -void ChannelPublicKeys_set_revocation_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val); +void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately * spendable primary channel balance on the broadcaster's commitment transaction. This key is * static across every commitment transaction. */ -LDKPublicKey ChannelPublicKeys_get_payment_point(const LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately * spendable primary channel balance on the broadcaster's commitment transaction. This key is * static across every commitment transaction. */ -void ChannelPublicKeys_set_payment_point(LDKChannelPublicKeys *this_ptr, LDKPublicKey val); +void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The base point which is used (with derive_public_key) to derive a per-commitment payment * public key which receives non-HTLC-encumbered funds which are only available for spending * after some delay (or can be claimed via the revocation path). */ -LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The base point which is used (with derive_public_key) to derive a per-commitment payment * public key which receives non-HTLC-encumbered funds which are only available for spending * after some delay (or can be claimed via the revocation path). */ -void ChannelPublicKeys_set_delayed_payment_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val); +void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The base point which is used (with derive_public_key) to derive a per-commitment public key * which is used to encumber HTLC-in-flight outputs. */ -LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The base point which is used (with derive_public_key) to derive a per-commitment public key * which is used to encumber HTLC-in-flight outputs. */ -void ChannelPublicKeys_set_htlc_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val); +void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg); -MUST_USE_RES LDKChannelPublicKeys ChannelPublicKeys_new(LDKPublicKey funding_pubkey_arg, LDKPublicKey revocation_basepoint_arg, LDKPublicKey payment_point_arg, LDKPublicKey delayed_payment_basepoint_arg, LDKPublicKey htlc_basepoint_arg); +struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); -LDKCVec_u8Z ChannelPublicKeys_write(const LDKChannelPublicKeys *obj); +struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); -LDKChannelPublicKeys ChannelPublicKeys_read(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 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); /** - * Create a new TxCreationKeys from channel base points and the per-commitment point + * 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_derive_new(LDKPublicKey per_commitment_point, LDKPublicKey broadcaster_delayed_payment_base, LDKPublicKey broadcaster_htlc_base, LDKPublicKey countersignatory_revocation_base, LDKPublicKey countersignatory_htlc_base); +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(LDKPublicKey revocation_key, uint16_t contest_delay, LDKPublicKey broadcaster_delayed_payment_key); - -void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr); +struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); -LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const LDKHTLCOutputInCommitment *orig); +void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr); /** * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). @@ -6601,7 +7811,7 @@ LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const LDKHTLCOutputInComm * need to compare this value to whether the commitment transaction in question is that of * the counterparty or our own. */ -bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_ptr); +bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). @@ -6609,237 +7819,444 @@ bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_pt * need to compare this value to whether the commitment transaction in question is that of * the counterparty or our own. */ -void HTLCOutputInCommitment_set_offered(LDKHTLCOutputInCommitment *this_ptr, bool val); +void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); /** * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is * this divided by 1000. */ -uint64_t HTLCOutputInCommitment_get_amount_msat(const LDKHTLCOutputInCommitment *this_ptr); +uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is * this divided by 1000. */ -void HTLCOutputInCommitment_set_amount_msat(LDKHTLCOutputInCommitment *this_ptr, uint64_t val); +void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); /** * The CLTV lock-time at which this HTLC expires. */ -uint32_t HTLCOutputInCommitment_get_cltv_expiry(const LDKHTLCOutputInCommitment *this_ptr); +uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** * The CLTV lock-time at which this HTLC expires. */ -void HTLCOutputInCommitment_set_cltv_expiry(LDKHTLCOutputInCommitment *this_ptr, uint32_t val); +void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); /** * The hash of the preimage which unlocks this HTLC. */ -const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const LDKHTLCOutputInCommitment *this_ptr))[32]; +const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; /** * The hash of the preimage which unlocks this HTLC. */ -void HTLCOutputInCommitment_set_payment_hash(LDKHTLCOutputInCommitment *this_ptr, LDKThirtyTwoBytes val); +void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); -LDKCVec_u8Z HTLCOutputInCommitment_write(const LDKHTLCOutputInCommitment *obj); +struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); -LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser); +struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); + +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 LDKHTLCOutputInCommitment *htlc, const LDKTxCreationKeys *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(LDKPublicKey broadcaster, LDKPublicKey countersignatory); +struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); /** * panics if htlc.transaction_output_index.is_none()! */ -LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey broadcaster_delayed_payment_key, LDKPublicKey revocation_key); +struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); + +void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr); + +/** + * Holder public keys + */ +struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * Holder public keys + */ +void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); + +/** + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + */ +uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + */ +void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. + */ +bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. + */ +void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); + +/** + * The late-bound counterparty channel transaction parameters. + * These parameters are populated at the point in the protocol where the counterparty provides them. + */ +struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * The late-bound counterparty channel transaction parameters. + * These parameters are populated at the point in the protocol where the counterparty provides them. + */ +void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); + +/** + * The late-bound funding outpoint + */ +struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * The late-bound funding outpoint + */ +void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); + +MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg); + +struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); + +void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr); + +/** + * Counter-party public keys + */ +struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * Counter-party public keys + */ +void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); + +/** + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + */ +uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + */ +void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); + +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. + */ +MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); + +/** + * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, + * given that the holder is the broadcaster. + * + * self.is_populated() must be true before calling this function. + */ +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); + +/** + * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, + * given that the counterparty is the broadcaster. + * + * self.is_populated() must be true before calling this function. + */ +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); + +struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); + +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); + +struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); + +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); + +void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_ptr); + +/** + * Get the channel pubkeys for the broadcaster + */ +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); + +/** + * Get the channel pubkeys for the countersignatory + */ +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); + +/** + * Get the contest delay applicable to the transactions. + * Note that the contest delay was selected by the countersignatory. + */ +MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); -void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr); +/** + * Whether the channel is outbound from the broadcaster. + * + * The boolean representing the side that initiated the channel is + * an input to the commitment number obscure factor computation. + */ +MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); + +/** + * The funding outpoint + */ +MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); -LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const LDKHolderCommitmentTransaction *orig); +void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr); /** - * The commitment transaction itself, in unsigned form. + * Our counterparty's signature for the transaction */ -LDKTransaction HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr); +struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** - * The commitment transaction itself, in unsigned form. + * Our counterparty's signature for the transaction */ -void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKTransaction val); +void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Our counterparty's signature for the transaction, above. + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const LDKHolderCommitmentTransaction *this_ptr); +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); + +struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); + +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); /** - * Our counterparty's signature for the transaction, above. + * 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. */ -void HolderCommitmentTransaction_set_counterparty_sig(LDKHolderCommitmentTransaction *this_ptr, LDKSignature val); +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); /** - * The feerate paid per 1000-weight-unit in this commitment transaction. This value is - * controlled by the channel initiator. + * The commitment transaction */ -uint32_t HolderCommitmentTransaction_get_feerate_per_kw(const LDKHolderCommitmentTransaction *this_ptr); +struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); /** - * The feerate paid per 1000-weight-unit in this commitment transaction. This value is - * controlled by the channel initiator. + * The commitment transaction */ -void HolderCommitmentTransaction_set_feerate_per_kw(LDKHolderCommitmentTransaction *this_ptr, uint32_t val); +void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); /** - * The HTLCs and counterparty htlc signatures which were included in this commitment transaction. + * The txid for the commitment transaction. * - * Note that this includes all HTLCs, including ones which were considered dust and not - * actually included in the transaction as it appears on-chain, but who's value is burned as - * fees and not included in the to_holder or to_counterparty outputs. + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. + */ +const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; + +/** + * The txid for the commitment transaction. * - * The counterparty HTLC signatures in the second element will always be set for non-dust HTLCs, ie - * those for which transaction_output_index.is_some(). + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val); +void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); + +struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); + +struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); + +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); /** - * Generate a new HolderCommitmentTransaction based on a raw commitment transaction, - * counterparty signature and both parties keys. + * Get the SIGHASH_ALL sighash value of the transaction. * - * The unsigned transaction outputs must be consistent with htlc_data. This function - * only checks that the shape and amounts are consistent, but does not check the scriptPubkey. + * This can be used to verify a signature. */ -MUST_USE_RES LDKHolderCommitmentTransaction HolderCommitmentTransaction_new_missing_holder_sig(LDKTransaction unsigned_tx, LDKSignature counterparty_sig, LDKPublicKey holder_funding_key, LDKPublicKey counterparty_funding_key, LDKTxCreationKeys keys, uint32_t feerate_per_kw, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data); +MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * The pre-calculated transaction creation public keys. - * An external validating signer should not trust these keys. + * Sign a transaction, either because we are counter-signing the counterparty's transaction or + * because we are about to broadcast a holder transaction. + */ +MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); + +void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr); + +struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); + +struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); + +struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); + +/** + * The backwards-counting commitment number + */ +MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); + +/** + * The value to be sent to the broadcaster */ -MUST_USE_RES LDKTxCreationKeys HolderCommitmentTransaction_trust_key_derivation(const LDKHolderCommitmentTransaction *this_arg); +MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Get the txid of the holder commitment transaction contained in this - * HolderCommitmentTransaction + * The value to be sent to the counterparty */ -MUST_USE_RES LDKThirtyTwoBytes HolderCommitmentTransaction_txid(const LDKHolderCommitmentTransaction *this_arg); +MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Gets holder signature for the contained commitment transaction given holder funding private key. + * The feerate paid per 1000-weight-unit in this commitment transaction. + */ +MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); + +/** + * Trust our pre-built transaction and derived transaction creation public keys. + * + * Applies a wrapper which allows access to these fields. * - * Funding key is your key included in the 2-2 funding_outpoint lock. Should be provided - * by your ChannelKeys. - * Funding redeemscript is script locking funding_outpoint. This is the mutlsig script - * between your own funding key and your counterparty's. Currently, this is provided in - * ChannelKeys::sign_holder_commitment() calls directly. - * Channel value is amount locked in funding_outpoint. + * This should only be used if you fully trust the builder of this object. It should not + *\tbe used by an external signer - instead use the verify function. */ -MUST_USE_RES LDKSignature HolderCommitmentTransaction_get_holder_sig(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*funding_key)[32], LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Get a signature for each HTLC which was included in the commitment transaction (ie for - * which HTLCOutputInCommitment::transaction_output_index.is_some()). + * Verify our pre-built transaction and derived transaction creation public keys. * - * The returned Vec has one entry for each HTLC, and in the same order. For HTLCs which were - * considered dust and not included, a None entry exists, for all others a signature is - * included. + * Applies a wrapper which allows access to these fields. + * + * An external validating signer must call this method before signing + * or using the built transaction. + */ +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); + +/** + * The transaction ID of the built Bitcoin transaction + */ +MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); + +/** + * The pre-built Bitcoin commitment transaction */ -MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ HolderCommitmentTransaction_get_htlc_sigs(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*htlc_base_key)[32], uint16_t counterparty_selected_contest_delay); +MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); -LDKCVec_u8Z HolderCommitmentTransaction_write(const LDKHolderCommitmentTransaction *obj); +/** + * The pre-calculated transaction creation public keys. + */ +MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); -LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(LDKu8slice ser); +/** + * Get a signature for each HTLC which was included in the commitment transaction (ie for + * which HTLCOutputInCommitment::transaction_output_index.is_some()). + * + * The returned Vec has one entry for each HTLC, and in the same order. + */ +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); -void InitFeatures_free(LDKInitFeatures this_ptr); +/** + * 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); -void NodeFeatures_free(LDKNodeFeatures this_ptr); +void InitFeatures_free(struct LDKInitFeatures this_ptr); -void ChannelFeatures_free(LDKChannelFeatures this_ptr); +void NodeFeatures_free(struct LDKNodeFeatures this_ptr); -void RouteHop_free(LDKRouteHop this_ptr); +void ChannelFeatures_free(struct LDKChannelFeatures this_ptr); -LDKRouteHop RouteHop_clone(const LDKRouteHop *orig); +void RouteHop_free(struct LDKRouteHop this_ptr); /** * The node_id of the node at this hop. */ -LDKPublicKey RouteHop_get_pubkey(const LDKRouteHop *this_ptr); +struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The node_id of the node at this hop. */ -void RouteHop_set_pubkey(LDKRouteHop *this_ptr, LDKPublicKey val); +void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The node_announcement features of the node at this hop. For the last hop, these may be * amended to match the features present in the invoice this node generated. */ -LDKNodeFeatures RouteHop_get_node_features(const LDKRouteHop *this_ptr); +struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The node_announcement features of the node at this hop. For the last hop, these may be * amended to match the features present in the invoice this node generated. */ -void RouteHop_set_node_features(LDKRouteHop *this_ptr, LDKNodeFeatures val); +void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** * The channel that should be used from the previous hop to reach this node. */ -uint64_t RouteHop_get_short_channel_id(const LDKRouteHop *this_ptr); +uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The channel that should be used from the previous hop to reach this node. */ -void RouteHop_set_short_channel_id(LDKRouteHop *this_ptr, uint64_t val); +void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** * The channel_announcement features of the channel that should be used from the previous hop * to reach this node. */ -LDKChannelFeatures RouteHop_get_channel_features(const LDKRouteHop *this_ptr); +struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The channel_announcement features of the channel that should be used from the previous hop * to reach this node. */ -void RouteHop_set_channel_features(LDKRouteHop *this_ptr, LDKChannelFeatures val); +void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** * The fee taken on this hop. For the last hop, this should be the full value of the payment. */ -uint64_t RouteHop_get_fee_msat(const LDKRouteHop *this_ptr); +uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The fee taken on this hop. For the last hop, this should be the full value of the payment. */ -void RouteHop_set_fee_msat(LDKRouteHop *this_ptr, uint64_t val); +void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value * expected at the destination, in excess of the current block height. */ -uint32_t RouteHop_get_cltv_expiry_delta(const LDKRouteHop *this_ptr); +uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value * expected at the destination, in excess of the current block height. */ -void RouteHop_set_cltv_expiry_delta(LDKRouteHop *this_ptr, uint32_t val); +void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); -MUST_USE_RES LDKRouteHop RouteHop_new(LDKPublicKey pubkey_arg, LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); +MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); -void Route_free(LDKRoute this_ptr); +struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); -LDKRoute Route_clone(const LDKRoute *orig); +void Route_free(struct LDKRoute this_ptr); /** * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the @@ -6849,69 +8266,71 @@ LDKRoute Route_clone(const LDKRoute *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(LDKRoute *this_ptr, LDKCVec_CVec_RouteHopZZ val); +void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); -MUST_USE_RES 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 LDKRoute *obj); +struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); -LDKRoute Route_read(LDKu8slice ser); +struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); -void RouteHint_free(LDKRouteHint this_ptr); +struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); -LDKRouteHint RouteHint_clone(const LDKRouteHint *orig); +void RouteHint_free(struct LDKRouteHint this_ptr); /** * The node_id of the non-target end of the route */ -LDKPublicKey RouteHint_get_src_node_id(const LDKRouteHint *this_ptr); +struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The node_id of the non-target end of the route */ -void RouteHint_set_src_node_id(LDKRouteHint *this_ptr, LDKPublicKey val); +void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The short_channel_id of this channel */ -uint64_t RouteHint_get_short_channel_id(const LDKRouteHint *this_ptr); +uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The short_channel_id of this channel */ -void RouteHint_set_short_channel_id(LDKRouteHint *this_ptr, uint64_t val); +void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val); /** * The fees which must be paid to use this channel */ -LDKRoutingFees RouteHint_get_fees(const LDKRouteHint *this_ptr); +struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The fees which must be paid to use this channel */ -void RouteHint_set_fees(LDKRouteHint *this_ptr, LDKRoutingFees val); +void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** * The difference in CLTV values between this node and the next node. */ -uint16_t RouteHint_get_cltv_expiry_delta(const LDKRouteHint *this_ptr); +uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The difference in CLTV values between this node and the next node. */ -void RouteHint_set_cltv_expiry_delta(LDKRouteHint *this_ptr, uint16_t val); +void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val); /** * The minimum value, in msat, which must be relayed to the next hop. */ -uint64_t RouteHint_get_htlc_minimum_msat(const LDKRouteHint *this_ptr); +uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The minimum value, in msat, which must be relayed to the next hop. */ -void RouteHint_set_htlc_minimum_msat(LDKRouteHint *this_ptr, uint64_t val); +void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val); -MUST_USE_RES LDKRouteHint RouteHint_new(LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg); +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. @@ -6931,13 +8350,13 @@ MUST_USE_RES LDKRouteHint RouteHint_new(LDKPublicKey src_node_id_arg, uint64_t s * 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(LDKPublicKey our_node_id, const LDKNetworkGraph *network, LDKPublicKey target, LDKCVec_ChannelDetailsZ *first_hops, LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, 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(LDKNetworkGraph this_ptr); +void NetworkGraph_free(struct LDKNetworkGraph this_ptr); -void LockedNetworkGraph_free(LDKLockedNetworkGraph this_ptr); +void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr); -void NetGraphMsgHandler_free(LDKNetGraphMsgHandler this_ptr); +void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr); /** * Creates a new tracker of the actual state of the network of channels and nodes, @@ -6946,13 +8365,13 @@ void NetGraphMsgHandler_free(LDKNetGraphMsgHandler this_ptr); * channel data is correct, and that the announcement is signed with * channel owners' keys. */ -MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_new(LDKAccess *chain_access, LDKLogger logger); +MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger); /** * Creates a new tracker of the actual state of the network of channels and nodes, * assuming an existing Network Graph. */ -MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKAccess *chain_access, LDKLogger logger, LDKNetworkGraph network_graph); +MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph); /** * Take a read lock on the network_graph and return it in the C-bindings @@ -6960,58 +8379,70 @@ MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKAccess * * bindings as you can call `self.network_graph.read().unwrap()` in Rust * yourself. */ -MUST_USE_RES LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const LDKNetGraphMsgHandler *this_arg); +MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); /** * Get a reference to the NetworkGraph which this read-lock contains. */ -MUST_USE_RES LDKNetworkGraph LockedNetworkGraph_graph(const LDKLockedNetworkGraph *this_arg); +MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg); + +struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); -LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const LDKNetGraphMsgHandler *this_arg); +struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); -void DirectionalChannelInfo_free(LDKDirectionalChannelInfo this_ptr); +void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr); /** * When the last update to the channel direction was issued. * Value is opaque, as set in the announcement. */ -uint32_t DirectionalChannelInfo_get_last_update(const LDKDirectionalChannelInfo *this_ptr); +uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * When the last update to the channel direction was issued. * Value is opaque, as set in the announcement. */ -void DirectionalChannelInfo_set_last_update(LDKDirectionalChannelInfo *this_ptr, uint32_t val); +void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val); /** * Whether the channel can be currently used for payments (in this one direction). */ -bool DirectionalChannelInfo_get_enabled(const LDKDirectionalChannelInfo *this_ptr); +bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * Whether the channel can be currently used for payments (in this one direction). */ -void DirectionalChannelInfo_set_enabled(LDKDirectionalChannelInfo *this_ptr, bool val); +void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val); /** * The difference in CLTV values that you must have when routing through this channel. */ -uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const LDKDirectionalChannelInfo *this_ptr); +uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * The difference in CLTV values that you must have when routing through this channel. */ -void DirectionalChannelInfo_set_cltv_expiry_delta(LDKDirectionalChannelInfo *this_ptr, uint16_t val); +void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val); /** * The minimum value, which must be relayed to the next hop via the channel */ -uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const LDKDirectionalChannelInfo *this_ptr); +uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * The minimum value, which must be relayed to the next hop via the channel */ -void DirectionalChannelInfo_set_htlc_minimum_msat(LDKDirectionalChannelInfo *this_ptr, uint64_t val); +void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Fees charged when the channel is used for routing + */ +struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); + +/** + * Fees charged when the channel is used for routing + */ +void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** * Most recent update for the channel received from the network @@ -7019,7 +8450,7 @@ void DirectionalChannelInfo_set_htlc_minimum_msat(LDKDirectionalChannelInfo *thi * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const LDKDirectionalChannelInfo *this_ptr); +struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * Most recent update for the channel received from the network @@ -7027,63 +8458,65 @@ LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const LDKDirecti * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -void DirectionalChannelInfo_set_last_update_message(LDKDirectionalChannelInfo *this_ptr, LDKChannelUpdate val); +void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); -LDKCVec_u8Z DirectionalChannelInfo_write(const LDKDirectionalChannelInfo *obj); +struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig); -LDKDirectionalChannelInfo DirectionalChannelInfo_read(LDKu8slice ser); +struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); -void ChannelInfo_free(LDKChannelInfo this_ptr); +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser); + +void ChannelInfo_free(struct LDKChannelInfo this_ptr); /** * Protocol features of a channel communicated during its announcement */ -LDKChannelFeatures ChannelInfo_get_features(const LDKChannelInfo *this_ptr); +struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Protocol features of a channel communicated during its announcement */ -void ChannelInfo_set_features(LDKChannelInfo *this_ptr, LDKChannelFeatures val); +void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** * Source node of the first direction of a channel */ -LDKPublicKey ChannelInfo_get_node_one(const LDKChannelInfo *this_ptr); +struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Source node of the first direction of a channel */ -void ChannelInfo_set_node_one(LDKChannelInfo *this_ptr, LDKPublicKey val); +void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Details about the first direction of a channel */ -LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const LDKChannelInfo *this_ptr); +struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Details about the first direction of a channel */ -void ChannelInfo_set_one_to_two(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val); +void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); /** * Source node of the second direction of a channel */ -LDKPublicKey ChannelInfo_get_node_two(const LDKChannelInfo *this_ptr); +struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Source node of the second direction of a channel */ -void ChannelInfo_set_node_two(LDKChannelInfo *this_ptr, LDKPublicKey val); +void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Details about the second direction of a channel */ -LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const LDKChannelInfo *this_ptr); +struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Details about the second direction of a channel */ -void ChannelInfo_set_two_to_one(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val); +void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); /** * An initial announcement of the channel @@ -7091,7 +8524,7 @@ void ChannelInfo_set_two_to_one(LDKChannelInfo *this_ptr, LDKDirectionalChannelI * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -LDKChannelAnnouncement ChannelInfo_get_announcement_message(const LDKChannelInfo *this_ptr); +struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * An initial announcement of the channel @@ -7099,96 +8532,96 @@ LDKChannelAnnouncement ChannelInfo_get_announcement_message(const LDKChannelInfo * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -void ChannelInfo_set_announcement_message(LDKChannelInfo *this_ptr, LDKChannelAnnouncement val); - -LDKCVec_u8Z ChannelInfo_write(const LDKChannelInfo *obj); +void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); -LDKChannelInfo ChannelInfo_read(LDKu8slice ser); +struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); -void RoutingFees_free(LDKRoutingFees this_ptr); +struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); -LDKRoutingFees RoutingFees_clone(const LDKRoutingFees *orig); +void RoutingFees_free(struct LDKRoutingFees this_ptr); /** * Flat routing fee in satoshis */ -uint32_t RoutingFees_get_base_msat(const LDKRoutingFees *this_ptr); +uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** * Flat routing fee in satoshis */ -void RoutingFees_set_base_msat(LDKRoutingFees *this_ptr, uint32_t val); +void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** * Liquidity-based routing fee in millionths of a routed amount. * In other words, 10000 is 1%. */ -uint32_t RoutingFees_get_proportional_millionths(const LDKRoutingFees *this_ptr); +uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** * Liquidity-based routing fee in millionths of a routed amount. * In other words, 10000 is 1%. */ -void RoutingFees_set_proportional_millionths(LDKRoutingFees *this_ptr, uint32_t val); +void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); -MUST_USE_RES LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); +MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); -LDKRoutingFees RoutingFees_read(LDKu8slice ser); +struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); -LDKCVec_u8Z RoutingFees_write(const LDKRoutingFees *obj); +struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); -void NodeAnnouncementInfo_free(LDKNodeAnnouncementInfo this_ptr); +struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); + +void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr); /** * Protocol features the node announced support for */ -LDKNodeFeatures NodeAnnouncementInfo_get_features(const LDKNodeAnnouncementInfo *this_ptr); +struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** * Protocol features the node announced support for */ -void NodeAnnouncementInfo_set_features(LDKNodeAnnouncementInfo *this_ptr, LDKNodeFeatures val); +void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** * When the last known update to the node state was issued. * Value is opaque, as set in the announcement. */ -uint32_t NodeAnnouncementInfo_get_last_update(const LDKNodeAnnouncementInfo *this_ptr); +uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** * When the last known update to the node state was issued. * Value is opaque, as set in the announcement. */ -void NodeAnnouncementInfo_set_last_update(LDKNodeAnnouncementInfo *this_ptr, uint32_t val); +void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); /** * Color assigned to the node */ -const uint8_t (*NodeAnnouncementInfo_get_rgb(const LDKNodeAnnouncementInfo *this_ptr))[3]; +const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; /** * Color assigned to the node */ -void NodeAnnouncementInfo_set_rgb(LDKNodeAnnouncementInfo *this_ptr, LDKThreeBytes val); +void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** * Moniker assigned to the node. * May be invalid or malicious (eg control chars), * should not be exposed to the user. */ -const uint8_t (*NodeAnnouncementInfo_get_alias(const LDKNodeAnnouncementInfo *this_ptr))[32]; +const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32]; /** * Moniker assigned to the node. * May be invalid or malicious (eg control chars), * should not be exposed to the user. */ -void NodeAnnouncementInfo_set_alias(LDKNodeAnnouncementInfo *this_ptr, LDKThirtyTwoBytes val); +void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * Internet-level addresses via which one can connect to the node */ -void NodeAnnouncementInfo_set_addresses(LDKNodeAnnouncementInfo *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 @@ -7196,7 +8629,7 @@ void NodeAnnouncementInfo_set_addresses(LDKNodeAnnouncementInfo *this_ptr, LDKCV * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeAnnouncementInfo *this_ptr); +struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** * An initial announcement of the node @@ -7204,63 +8637,107 @@ LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeA * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -void NodeAnnouncementInfo_set_announcement_message(LDKNodeAnnouncementInfo *this_ptr, LDKNodeAnnouncement val); +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, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); -MUST_USE_RES LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(LDKNodeFeatures features_arg, uint32_t last_update_arg, LDKThreeBytes rgb_arg, LDKThirtyTwoBytes alias_arg, LDKCVec_NetAddressZ addresses_arg, LDKNodeAnnouncement announcement_message_arg); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); -LDKCVec_u8Z NodeAnnouncementInfo_write(const LDKNodeAnnouncementInfo *obj); +struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); -LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); -void NodeInfo_free(LDKNodeInfo this_ptr); +void NodeInfo_free(struct LDKNodeInfo this_ptr); /** * All valid channels a node has announced */ -void NodeInfo_set_channels(LDKNodeInfo *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. * The two fields (flat and proportional fee) are independent, * meaning they don't have to refer to the same channel. */ -LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const LDKNodeInfo *this_ptr); +struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** * Lowest fees enabling routing via any of the enabled, known channels to a node. * The two fields (flat and proportional fee) are independent, * meaning they don't have to refer to the same channel. */ -void NodeInfo_set_lowest_inbound_channel_fees(LDKNodeInfo *this_ptr, LDKRoutingFees val); +void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** * More information about a node from node_announcement. * Optional because we store a Node entry after learning about it from * a channel announcement, but before receiving a node announcement. */ -LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const LDKNodeInfo *this_ptr); +struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** * More information about a node from node_announcement. * Optional because we store a Node entry after learning about it from * a channel announcement, but before receiving a node announcement. */ -void NodeInfo_set_announcement_info(LDKNodeInfo *this_ptr, LDKNodeAnnouncementInfo val); +void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); -MUST_USE_RES LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, LDKRoutingFees lowest_inbound_channel_fees_arg, 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); -LDKCVec_u8Z NodeInfo_write(const LDKNodeInfo *obj); +struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); -LDKNodeInfo NodeInfo_read(LDKu8slice ser); +struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); -LDKCVec_u8Z NetworkGraph_write(const LDKNetworkGraph *obj); +struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); -LDKNetworkGraph NetworkGraph_read(LDKu8slice ser); +struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); + +struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); /** * Creates a new, empty, network graph. */ -MUST_USE_RES LDKNetworkGraph NetworkGraph_new(void); +MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash); + +/** + * For an already known node (from channel announcements), update its stored properties from a + * given node announcement. + * + * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's + * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. + */ +MUST_USE_RES 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 + * given node announcement without verifying the associated signatures. Because we aren't + * given the associated signatures here we cannot relay the node announcement to any of our + * peers. + */ +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. + * + * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's + * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. + * + * If a `chain::Access` object is provided via `chain_access`, it will be called to verify + * the corresponding UTXO exists on chain and is correctly-formatted. + */ +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 + * signatures. Because we aren't given the associated signatures here we cannot relay the + * channel announcement to any of our peers. + * + * If a `chain::Access` object is provided via `chain_access`, it will be called to verify + * the corresponding UTXO exists on chain and is correctly-formatted. + */ +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. @@ -7268,6 +8745,23 @@ MUST_USE_RES LDKNetworkGraph NetworkGraph_new(void); * May cause the removal of nodes too, if this was their last channel. * If not permanent, makes channels unavailable for routing. */ -void NetworkGraph_close_channel_from_update(LDKNetworkGraph *this_arg, uint64_t short_channel_id, bool is_permanent); +void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); + +/** + * For an already known (from announcement) channel, update info about one of the directions + * of the channel. + * + * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's + * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. + */ +MUST_USE_RES 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 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 */