X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=8076e251b85ed9039859d20a1df09320007a610e;hb=59d2040c74beb54ff1eb3128004167273c35a176;hp=d5a8b3491c21bb2d36bfca3f01cc817428be74cf;hpb=de58bcf27125a0269c62606ded161d57c016fe6e;p=rust-lightning diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index d5a8b349..8076e251 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -7,7 +7,7 @@ #include #include #include -#include + /** * An error when accessing the chain via [`Access`]. @@ -174,8 +174,8 @@ typedef enum LDKSecp256k1Error { LDKSecp256k1Error_InvalidSecretKey, LDKSecp256k1Error_InvalidRecoveryId, LDKSecp256k1Error_InvalidTweak, + LDKSecp256k1Error_TweakCheckFailed, LDKSecp256k1Error_NotEnoughMemory, - LDKSecp256k1Error_CallbackPanicked, /** * Must be last for serialization purposes */ @@ -1551,21 +1551,20 @@ typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ { /** - * An event to be processed by the ChannelManager. + * 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 LDKMonitorEvent { +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. */ - LDKnativeMonitorEvent *inner; + LDKnativeHTLCUpdate *inner; bool is_owned; -} LDKMonitorEvent; - -typedef struct LDKCVec_MonitorEventZ { - struct LDKMonitorEvent *data; - uintptr_t datalen; -} LDKCVec_MonitorEventZ; +} LDKHTLCUpdate; @@ -1584,6 +1583,71 @@ typedef struct MUST_USE_STRUCT LDKOutPoint { bool is_owned; } LDKOutPoint; +/** + * An event to be processed by the ChannelManager. + */ +typedef enum LDKMonitorEvent_Tag { + /** + * A monitor event containing an HTLCUpdate. + */ + LDKMonitorEvent_HTLCEvent, + /** + * A monitor event that the Channel's commitment transaction was broadcasted. + */ + LDKMonitorEvent_CommitmentTxBroadcasted, + /** + * Must be last for serialization purposes + */ + LDKMonitorEvent_Sentinel, +} LDKMonitorEvent_Tag; + +typedef struct MUST_USE_STRUCT LDKMonitorEvent { + LDKMonitorEvent_Tag tag; + union { + struct { + struct LDKHTLCUpdate htlc_event; + }; + struct { + struct LDKOutPoint commitment_tx_broadcasted; + }; + }; +} LDKMonitorEvent; + +typedef struct LDKCVec_MonitorEventZ { + struct LDKMonitorEvent *data; + uintptr_t datalen; +} LDKCVec_MonitorEventZ; + + + +/** + * Information about a spendable output to a P2WSH script. See + * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this. + */ +typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDelayedPaymentOutputDescriptor *inner; + bool is_owned; +} LDKDelayedPaymentOutputDescriptor; + + + +/** + * Information about a spendable output to our \"payment key\". See + * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this. + */ +typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor { + /** + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeStaticPaymentOutputDescriptor *inner; + bool is_owned; +} LDKStaticPaymentOutputDescriptor; + /** * When on-chain outputs are created by rust-lightning (which our counterparty is not able to * claim at any point in the future) an event is generated which you must track and be able to @@ -1615,14 +1679,14 @@ typedef enum LDKSpendableOutputDescriptor_Tag { * * 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 + * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to * chan_utils::derive_private_key. The public key can be generated without the secret key * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in - * ChannelKeys::pubkeys(). + * Sign::pubkeys(). * * To derive the revocation_pubkey provided here (which is used in the witness * script generation), you must pass the counterparty revocation_basepoint (which appears in the - * call to ChannelKeys::ready_channel) and the provided per_commitment point + * call to Sign::ready_channel) and the provided per_commitment point * to chan_utils::derive_public_revocation_key. * * The witness script which is hashed and included in the output script_pubkey may be @@ -1630,17 +1694,17 @@ typedef enum LDKSpendableOutputDescriptor_Tag { * (derived as above), and the to_self_delay contained here to * chan_utils::get_revokeable_redeemscript. */ - LDKSpendableOutputDescriptor_DynamicOutputP2WSH, + LDKSpendableOutputDescriptor_DelayedPaymentOutput, /** * 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). + * corresponds to the public key in Sign::pubkeys().payment_point). * The witness in the spending input, is, thus, simply: * * * These are generally the result of our counterparty having broadcast the current state, * allowing us to claim the non-HTLC-encumbered outputs immediately. */ - LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment, + LDKSpendableOutputDescriptor_StaticPaymentOutput, /** * Must be last for serialization purposes */ @@ -1652,29 +1716,16 @@ typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { 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 LDKPublicKey revocation_pubkey; - struct LDKThirtyTwoBytes channel_keys_id; - uint64_t channel_value_satoshis; -} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body; - -typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body { - struct LDKOutPoint outpoint; - struct LDKTxOut output; - struct LDKThirtyTwoBytes channel_keys_id; - uint64_t channel_value_satoshis; -} 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; + struct { + struct LDKDelayedPaymentOutputDescriptor delayed_payment_output; + }; + struct { + struct LDKStaticPaymentOutputDescriptor static_payment_output; + }; }; } LDKSpendableOutputDescriptor; @@ -1838,24 +1889,6 @@ typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { 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; @@ -1973,10 +2006,10 @@ typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { } LDKUnsignedChannelAnnouncement; /** - * Set of lightning keys needed to operate a channel as described in BOLT 3. + * A trait to sign lightning channel transactions as described in BOLT 3. * * Signing services could be implemented on a hardware wallet. In this case, - * the current ChannelKeys would be a front-end on top of a communication + * the current Sign would be a front-end on top of a communication * channel connected to your secure device and lightning key material wouldn't * reside on a hot server. Nevertheless, a this deployment would still need * to trust the ChannelManager to avoid loss of funds as this latest component @@ -1990,13 +2023,8 @@ typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted * to act, as liveness and breach reply correctness are always going to be hard requirements * of LN security model, orthogonal of key management issues. - * - * If you're implementing a custom signer, you almost certainly want to implement - * Readable/Writable to serialize out a unique reference to this set of keys so - * that you can serialize the full ChannelManager object. - * */ -typedef struct LDKChannelKeys { +typedef struct LDKSign { void *this_arg; /** * Gets the per-commitment point for a specific commitment number @@ -2013,7 +2041,6 @@ typedef struct LDKChannelKeys { * May be called more than once for the same index. * * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. - * TODO: return a Result so we can signal a validation error */ struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); /** @@ -2025,11 +2052,11 @@ typedef struct LDKChannelKeys { * Note that this takes a pointer to this object, not the this_ptr like other methods do * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. */ - void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR ); + void (*set_pubkeys)(const struct LDKSign*NONNULL_PTR ); /** * Gets an arbitrary identifier describing the set of keys which are provided back to you in * some SpendableOutputDescriptor types. This should be sufficient to identify this - * ChannelKeys object uniquely and lookup or re-derive its keys. + * Sign object uniquely and lookup or re-derive its keys. */ struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg); /** @@ -2125,7 +2152,7 @@ typedef struct LDKChannelKeys { void *(*clone)(const void *this_arg); struct LDKCVec_u8Z (*write)(const void *this_arg); void (*free)(void *this_arg); -} LDKChannelKeys; +} LDKSign; @@ -2268,6 +2295,16 @@ typedef struct LDKCResult_NoneAPIErrorZ { bool result_ok; } LDKCResult_NoneAPIErrorZ; +typedef struct LDKCVec_CResult_NoneAPIErrorZZ { + struct LDKCResult_NoneAPIErrorZ *data; + uintptr_t datalen; +} LDKCVec_CResult_NoneAPIErrorZZ; + +typedef struct LDKCVec_APIErrorZ { + struct LDKAPIError *data; + uintptr_t datalen; +} LDKCVec_APIErrorZ; + /** @@ -2287,20 +2324,71 @@ typedef struct LDKCVec_ChannelDetailsZ { uintptr_t datalen; } LDKCVec_ChannelDetailsZ; - - /** * If a payment fails to send, it can be in one of several states. This enum is returned as the * Err() type describing which state the payment is in, see the description of individual enum * states for more. */ -typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { +typedef enum LDKPaymentSendFailure_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. + * A parameter which was passed to send_payment was invalid, preventing us from attempting to + * send the payment at all. No channel state has been changed or messages sent to peers, and + * once you've changed the parameter at error, you can freely retry the payment in full. */ - LDKnativePaymentSendFailure *inner; - bool is_owned; + LDKPaymentSendFailure_ParameterError, + /** + * A parameter in a single path which was passed to send_payment was invalid, preventing us + * from attempting to send the payment at all. No channel state has been changed or messages + * sent to peers, and once you've changed the parameter at error, you can freely retry the + * payment in full. + * + * The results here are ordered the same as the paths in the route object which was passed to + * send_payment. + */ + LDKPaymentSendFailure_PathParameterError, + /** + * All paths which were attempted failed to send, with no channel state change taking place. + * You can freely retry the payment in full (though you probably want to do so over different + * paths than the ones selected). + */ + LDKPaymentSendFailure_AllFailedRetrySafe, + /** + * Some paths which were attempted failed to send, though possibly not all. At least some + * paths have irrevocably committed to the HTLC and retrying the payment in full would result + * in over-/re-payment. + * + * The results here are ordered the same as the paths in the route object which was passed to + * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely + * retried (though there is currently no API with which to do so). + * + * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried + * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the + * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel + * with the latest update_id. + */ + LDKPaymentSendFailure_PartialFailure, + /** + * Must be last for serialization purposes + */ + LDKPaymentSendFailure_Sentinel, +} LDKPaymentSendFailure_Tag; + +typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { + LDKPaymentSendFailure_Tag tag; + union { + struct { + struct LDKAPIError parameter_error; + }; + struct { + struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; + }; + struct { + struct LDKCVec_APIErrorZ all_failed_retry_safe; + }; + struct { + struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure; + }; + }; } LDKPaymentSendFailure; typedef union LDKCResult_NonePaymentSendFailureZPtr { @@ -2388,15 +2476,15 @@ typedef struct LDKBroadcasterInterface { void (*free)(void *this_arg); } LDKBroadcasterInterface; -typedef union LDKCResult_ChannelKeysDecodeErrorZPtr { - struct LDKChannelKeys *result; +typedef union LDKCResult_SignDecodeErrorZPtr { + struct LDKSign *result; struct LDKDecodeError *err; -} LDKCResult_ChannelKeysDecodeErrorZPtr; +} LDKCResult_SignDecodeErrorZPtr; -typedef struct LDKCResult_ChannelKeysDecodeErrorZ { - union LDKCResult_ChannelKeysDecodeErrorZPtr contents; +typedef struct LDKCResult_SignDecodeErrorZ { + union LDKCResult_SignDecodeErrorZPtr contents; bool result_ok; -} LDKCResult_ChannelKeysDecodeErrorZ; +} LDKCResult_SignDecodeErrorZ; typedef struct LDKu8slice { const uint8_t *data; @@ -2430,12 +2518,12 @@ typedef struct LDKKeysInterface { */ 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 + * Get a new set of Sign for per-channel secrets. These MUST be unique even if you * restarted with some stale data! * * This method must return a different value each time it is called. */ - struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); + struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); /** * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting * onion packets and for temporary channel IDs. There is no requirement that these be @@ -2445,14 +2533,14 @@ typedef struct LDKKeysInterface { */ struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); /** - * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream. + * Reads a `Signer` 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 + * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). + * The bytes are exactly those which `::write()` writes, and * contain no versioning scheme. You may wish to include your own version prefix and ensure * you've read all of the provided bytes to ensure no corruption occurred. */ - struct LDKCResult_ChannelKeysDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); void (*free)(void *this_arg); } LDKKeysInterface; @@ -2565,32 +2653,68 @@ typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ { bool result_ok; } LDKCResult_SpendableOutputDescriptorDecodeErrorZ; +typedef struct LDKCVec_CVec_u8ZZ { + struct LDKCVec_u8Z *data; + uintptr_t datalen; +} LDKCVec_CVec_u8ZZ; + +typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr { + struct LDKCVec_CVec_u8ZZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_CVec_u8ZZNoneZPtr; + +typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { + union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents; + bool result_ok; +} LDKCResult_CVec_CVec_u8ZZNoneZ; + /** - * A simple implementation of ChannelKeys that just keeps the private keys in memory. + * A simple implementation of Sign that just keeps the private keys in memory. * * This implementation performs no policy checks and is insufficient by itself as * a secure external signer. */ -typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys { +typedef struct MUST_USE_STRUCT LDKInMemorySigner { /** * Nearly everywhere, 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; + LDKnativeInMemorySigner *inner; bool is_owned; -} LDKInMemoryChannelKeys; +} LDKInMemorySigner; -typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr { - struct LDKInMemoryChannelKeys *result; +typedef union LDKCResult_InMemorySignerDecodeErrorZPtr { + struct LDKInMemorySigner *result; struct LDKDecodeError *err; -} LDKCResult_InMemoryChannelKeysDecodeErrorZPtr; +} LDKCResult_InMemorySignerDecodeErrorZPtr; + +typedef struct LDKCResult_InMemorySignerDecodeErrorZ { + union LDKCResult_InMemorySignerDecodeErrorZPtr contents; + bool result_ok; +} LDKCResult_InMemorySignerDecodeErrorZ; + +typedef struct LDKCVec_TxOutZ { + struct LDKTxOut *data; + uintptr_t datalen; +} LDKCVec_TxOutZ; + +typedef union LDKCResult_TransactionNoneZPtr { + struct LDKTransaction *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_TransactionNoneZPtr; -typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ { - union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents; +typedef struct LDKCResult_TransactionNoneZ { + union LDKCResult_TransactionNoneZPtr contents; bool result_ok; -} LDKCResult_InMemoryChannelKeysDecodeErrorZ; +} LDKCResult_TransactionNoneZ; @@ -3327,6 +3451,25 @@ typedef struct LDKAccess { void (*free)(void *this_arg); } LDKAccess; +/** + * The `Listen` trait is used to be notified of when blocks have been connected or disconnected + * from the chain. + * + * Useful when needing to replay chain data upon startup or as new chain events occur. + */ +typedef struct LDKListen { + void *this_arg; + /** + * Notifies the listener that a block was added at the given height. + */ + void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height); + /** + * Notifies the listener that a block was removed at the given height. + */ + void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); + void (*free)(void *this_arg); +} LDKListen; + /** * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to * channels. @@ -3505,7 +3648,7 @@ typedef struct LDKChannelMessageHandler { /** * Handle an incoming shutdown message from the given peer. */ - void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg); + void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg); /** * Handle an incoming closing_signed message from the given peer. */ @@ -3824,6 +3967,8 @@ extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; +extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; + void Transaction_free(struct LDKTransaction _res); void TxOut_free(struct LDKTxOut _res); @@ -4024,6 +4169,8 @@ struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(st void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); + struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); @@ -4058,6 +4205,8 @@ struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err( void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig); + struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); @@ -4158,6 +4307,10 @@ void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); +void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); + +void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); + void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); @@ -4210,21 +4363,39 @@ void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); -struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_ok(struct LDKChannelKeys o); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); + +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); + +void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); + +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); + +void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); + +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); -struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); -void CResult_ChannelKeysDecodeErrorZ_free(struct LDKCResult_ChannelKeysDecodeErrorZ _res); +void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); -struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); -struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); -struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); -void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res); +void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); -struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_clone(const struct LDKCResult_InMemoryChannelKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); + +void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); + +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); + +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); + +void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); @@ -4965,6 +5136,11 @@ enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR ori */ void Access_free(struct LDKAccess this_ptr); +/** + * Calls the free function if one is set + */ +void Listen_free(struct LDKListen this_ptr); + /** * Calls the free function if one is set */ @@ -5209,6 +5385,130 @@ struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); +void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_ptr); + +/** + * The outpoint which is spendable + */ +struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The outpoint which is spendable + */ +void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + +/** + * Per commitment point to derive delayed_payment_key by key holder + */ +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * Per commitment point to derive delayed_payment_key by key holder + */ +void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * the witness_script. + */ +uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * the witness_script. + */ +void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); + +/** + * The output which is referenced by the given outpoint + */ +void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + +/** + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. + */ +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. + */ +void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The value of the channel which this output originated from, possibly indirectly. + */ +uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The value of the channel which this output originated from, possibly indirectly. + */ +void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + +MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); + +struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); + +void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_ptr); + +/** + * The outpoint which is spendable + */ +struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The outpoint which is spendable + */ +void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + +/** + * The output which is referenced by the given outpoint + */ +void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The value of the channel which this transactions spends. + */ +uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The value of the channel which this transactions spends. + */ +void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + +MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); + +struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); + void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); @@ -5217,92 +5517,92 @@ struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutp struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); -struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig); +struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void ChannelKeys_free(struct LDKChannelKeys this_ptr); +void Sign_free(struct LDKSign this_ptr); /** * Calls the free function if one is set */ void KeysInterface_free(struct LDKKeysInterface this_ptr); -void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr); +void InMemorySigner_free(struct LDKInMemorySigner this_ptr); /** * Private key of anchor tx */ -const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Private key of anchor tx */ -void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key for blinded revocation pubkey */ -const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Holder secret key for blinded revocation pubkey */ -void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key used for our balance in counterparty-broadcasted commitment transactions */ -const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Holder secret key used for our balance in counterparty-broadcasted commitment transactions */ -void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key used in HTLC tx */ -const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Holder secret key used in HTLC tx */ -void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder htlc secret key used in commitment tx htlc outputs */ -const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Holder htlc secret key used in commitment tx htlc outputs */ -void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Commitment seed */ -const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; +const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** * Commitment seed */ -void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); -struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig); +struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); /** - * Create a new InMemoryChannelKeys + * Create a new InMemorySigner */ -MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); +MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); /** * Counterparty pubkeys. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * The contest_delay value specified by our counterparty and applied on holder-broadcastable @@ -5310,7 +5610,7 @@ MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkey * broadcast a transaction. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * The contest_delay value specified by us and applied on transactions broadcastable @@ -5318,19 +5618,19 @@ MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(co * if they broadcast a transaction. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Whether the holder is the initiator * Will panic if ready_channel wasn't called. */ -MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Funding outpoint * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or @@ -5338,13 +5638,32 @@ MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struc * * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + +/** + * Sign the single input of spend_tx at index `input_idx` which spends the output + * described by descriptor, returning the witness stack for the input. + * + * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, + * or is not spending the outpoint described by `descriptor.outpoint`. + */ +MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); + +/** + * Sign the single input of spend_tx at index `input_idx` which spends the output + * described by descriptor, returning the witness stack for the input. + * + * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, + * is not spending the outpoint described by `descriptor.outpoint`, or does not have a + * sequence set to `descriptor.to_self_delay`. + */ +MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); -struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); +struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); -struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj); +struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); -struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser); +struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser); void KeysManager_free(struct LDKKeysManager this_ptr); @@ -5369,16 +5688,31 @@ void KeysManager_free(struct LDKKeysManager this_ptr); * versions. Once the library is more fully supported, the docs will be updated to include a * detailed description of the guarantee. */ -MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos); +MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); /** - * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation - * parameters. + * Derive an old Sign containing per-channel secrets based on a key derivation parameters. + * * Key derivation parameters are accessible through a per-channel secrets - * ChannelKeys::channel_keys_id and is provided inside DynamicOuputP2WSH in case of + * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of * onchain output detection for which a corresponding delayed_payment_key must be derived. */ -MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); +MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); + +/** + * Creates a Transaction which spends the given descriptors to the given outputs, plus an + * output to the given change destination (if sufficient change value remains). The + * transaction will have a feerate, at least, of the given value. + * + * Returns `Err(())` if the output value is greater than the input value minus required fee or + * if a descriptor was duplicated. + * + * We do not enforce that outputs meet the dust limit or that any output scripts are standard. + * + * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used + * this KeysManager or one of the `InMemorySigner` created by this KeysManager. + */ +MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); @@ -5719,6 +6053,8 @@ struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider( struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); + /** * Updates channel state based on transactions seen in a connected block. */ @@ -5732,6 +6068,12 @@ void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR */ void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]); +/** + * Blocks until ChannelManager needs to be persisted. Only one listener on `wait` is + * guaranteed to be woken up. + */ +void ChannelManager_wait(const struct LDKChannelManager *NONNULL_PTR this_arg); + struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); @@ -5837,6 +6179,18 @@ struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR void Init_free(struct LDKInit this_ptr); +/** + * The relevant features which the sender supports + */ +struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); + +/** + * The relevant features which the sender supports + */ +void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); + +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg); + struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); void ErrorMessage_free(struct LDKErrorMessage this_ptr); @@ -8460,6 +8814,8 @@ struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id void NetworkGraph_free(struct LDKNetworkGraph this_ptr); +struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); + void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr); void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr); @@ -8640,6 +8996,8 @@ struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct */ void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); +struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); + struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);