bool data_is_owned;
} LDKTransaction;
-typedef struct LDKCVecTempl_u8 {
+typedef struct LDKCVec_u8Z {
uint8_t *data;
uintptr_t datalen;
-} LDKCVecTempl_u8;
-
-typedef struct LDKCVecTempl_u8 LDKCVec_u8Z;
+} LDKCVec_u8Z;
/**
* A transaction output including a scriptPubKey and value.
* This type *does* own its own memory, so must be free'd appropriately.
*/
typedef struct LDKTxOut {
- LDKCVec_u8Z script_pubkey;
+ struct LDKCVec_u8Z script_pubkey;
uint64_t value;
} LDKTxOut;
-typedef struct LDKC2TupleTempl_usize__Transaction {
- uintptr_t a;
- struct LDKTransaction b;
-} LDKC2TupleTempl_usize__Transaction;
-typedef struct LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ;
-typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
+/**
+ * A reference to a transaction output.
+ *
+ * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
+ * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
+ */
+typedef struct MUST_USE_STRUCT LDKOutPoint {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void *result;
- enum LDKChannelMonitorUpdateErr *err;
-} LDKCResult_NoneChannelMonitorUpdateErrZPtr;
+ LDKnativeOutPoint *inner;
+ bool is_owned;
+} LDKOutPoint;
-typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
- union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
- bool result_ok;
-} LDKCResult_NoneChannelMonitorUpdateErrZ;
+typedef struct LDKPublicKey {
+ uint8_t compressed_form[33];
+} LDKPublicKey;
+typedef struct LDKC2TupleTempl_u64__u64 {
+ uint64_t a;
+ uint64_t b;
+} LDKC2TupleTempl_u64__u64;
+typedef struct LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
/**
- * An update generated by the underlying Channel itself which contains some new information the
- * ChannelMonitor should be made aware of.
+ * 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 struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
+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:
+ * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
+ *
+ * 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:
+ * <BIP 143 signature> <payment key>
+ *
+ * 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;
+ LDKC2Tuple_u64u64Z key_derivation_params;
+ struct LDKPublicKey revocation_pubkey;
+} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
+
+typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
+ struct LDKOutPoint outpoint;
+ struct LDKTxOut output;
+ 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 accept_channel message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKAcceptChannel {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeChannelMonitorUpdate *inner;
+ LDKnativeAcceptChannel *inner;
bool is_owned;
-} LDKChannelMonitorUpdate;
+} LDKAcceptChannel;
/**
- * An error in decoding a message or struct.
+ * An open_channel message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKDecodeError {
+typedef struct MUST_USE_STRUCT LDKOpenChannel {
/**
* Nearly everywhere, 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;
+ LDKnativeOpenChannel *inner;
bool is_owned;
-} LDKDecodeError;
-
-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;
+} LDKOpenChannel;
/**
- * 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.
+ * A funding_created message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
+typedef struct MUST_USE_STRUCT LDKFundingCreated {
/**
* Nearly everywhere, 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;
+ LDKnativeFundingCreated *inner;
bool is_owned;
-} LDKMonitorUpdateError;
+} LDKFundingCreated;
-typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
+
+
+/**
+ * A funding_signed message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKFundingSigned {
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void *result;
- struct LDKMonitorUpdateError *err;
-} LDKCResult_NoneMonitorUpdateErrorZPtr;
-
-typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
- union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
- bool result_ok;
-} LDKCResult_NoneMonitorUpdateErrorZ;
+ LDKnativeFundingSigned *inner;
+ bool is_owned;
+} LDKFundingSigned;
/**
- * 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.
+ * A funding_locked message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKOutPoint {
+typedef struct MUST_USE_STRUCT LDKFundingLocked {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeOutPoint *inner;
+ LDKnativeFundingLocked *inner;
bool is_owned;
-} LDKOutPoint;
-
-typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
- struct LDKOutPoint a;
- LDKCVec_u8Z b;
-} LDKC2TupleTempl_OutPoint__CVec_u8Z;
-
-typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
+} LDKFundingLocked;
-typedef struct LDKC2TupleTempl_u32__TxOut {
- uint32_t a;
- struct LDKTxOut b;
-} LDKC2TupleTempl_u32__TxOut;
-typedef struct LDKC2TupleTempl_u32__TxOut LDKC2Tuple_u32TxOutZ;
/**
- * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
- * look up the corresponding function in rust-lightning's docs.
+ * An announcement_signatures message to be sent or received from a peer
*/
-typedef struct LDKThirtyTwoBytes {
- uint8_t data[32];
-} LDKThirtyTwoBytes;
-
-typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut {
- struct LDKC2TupleTempl_u32__TxOut *data;
- uintptr_t datalen;
-} LDKCVecTempl_C2TupleTempl_u32__TxOut;
-
-typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
- struct LDKThirtyTwoBytes a;
- struct LDKCVecTempl_C2TupleTempl_u32__TxOut b;
-} LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
+typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeAnnouncementSignatures *inner;
+ bool is_owned;
+} LDKAnnouncementSignatures;
-typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
-typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_u32TxOutZZ;
-typedef struct LDKPublicKey {
- uint8_t compressed_form[33];
-} LDKPublicKey;
+/**
+ * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
+ * transaction updates if they were pending.
+ */
+typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeCommitmentUpdate *inner;
+ bool is_owned;
+} LDKCommitmentUpdate;
/**
- * One counterparty's public keys which do not change over the life of a channel.
+ * A revoke_and_ack message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
+typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeChannelPublicKeys *inner;
+ LDKnativeRevokeAndACK *inner;
bool is_owned;
-} LDKChannelPublicKeys;
+} LDKRevokeAndACK;
-typedef struct LDKC2TupleTempl_u64__u64 {
- uint64_t a;
- uint64_t b;
-} LDKC2TupleTempl_u64__u64;
-
-typedef struct LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
-
-typedef struct LDKSignature {
- uint8_t compact_form[64];
-} LDKSignature;
-
-typedef struct LDKCVecTempl_Signature {
- struct LDKSignature *data;
- uintptr_t datalen;
-} LDKCVecTempl_Signature;
-typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature {
- struct LDKSignature a;
- struct LDKCVecTempl_Signature b;
-} LDKC2TupleTempl_Signature__CVecTempl_Signature;
-typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
- struct LDKC2TupleTempl_Signature__CVecTempl_Signature *result;
+/**
+ * A closing_signed message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKClosingSigned {
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void *err;
-} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
-
-typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
- bool result_ok;
-} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
+ LDKnativeClosingSigned *inner;
+ bool is_owned;
+} LDKClosingSigned;
/**
- * 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.
+ * A shutdown message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
+typedef struct MUST_USE_STRUCT LDKShutdown {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeCommitmentTransaction *inner;
+ LDKnativeShutdown *inner;
bool is_owned;
-} LDKCommitmentTransaction;
-
-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;
+} LDKShutdown;
/**
- * Information needed to build and sign a holder's commitment transaction.
- *
- * The transaction is only signed once we are ready to broadcast.
+ * A channel_reestablish message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
+typedef struct MUST_USE_STRUCT LDKChannelReestablish {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeHolderCommitmentTransaction *inner;
+ LDKnativeChannelReestablish *inner;
bool is_owned;
-} LDKHolderCommitmentTransaction;
+} LDKChannelReestablish;
-typedef union LDKCResult_CVec_SignatureZNoneZPtr {
- struct LDKCVecTempl_Signature *result;
+
+
+/**
+ * A channel_announcement message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- void *err;
-} LDKCResult_CVec_SignatureZNoneZPtr;
-
-typedef struct LDKCResult_CVec_SignatureZNoneZ {
- union LDKCResult_CVec_SignatureZNoneZPtr contents;
- bool result_ok;
-} LDKCResult_CVec_SignatureZNoneZ;
+ LDKnativeChannelAnnouncement *inner;
+ bool is_owned;
+} LDKChannelAnnouncement;
/**
- * Information about an HTLC as it appears in a commitment transaction
+ * A channel_update message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
+typedef struct MUST_USE_STRUCT LDKChannelUpdate {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeHTLCOutputInCommitment *inner;
+ LDKnativeChannelUpdate *inner;
bool is_owned;
-} LDKHTLCOutputInCommitment;
+} LDKChannelUpdate;
/**
- * The unsigned part of a channel_announcement
+ * A node_announcement message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
+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.
*/
- LDKnativeUnsignedChannelAnnouncement *inner;
+ LDKnativeNodeAnnouncement *inner;
bool is_owned;
-} LDKUnsignedChannelAnnouncement;
+} LDKNodeAnnouncement;
/**
- * 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.
+ * An error message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
+typedef struct MUST_USE_STRUCT LDKErrorMessage {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeChannelTransactionParameters *inner;
+ LDKnativeErrorMessage *inner;
bool is_owned;
-} LDKChannelTransactionParameters;
+} LDKErrorMessage;
/**
- * Set of lightning keys needed to operate a channel as described in BOLT 3.
- *
- * Signing services could be implemented on a hardware wallet. In this case,
- * the current ChannelKeys would be a front-end on top of a communication
- * channel connected to your secure device and lightning key material wouldn't
- * reside on a hot server. Nevertheless, a this deployment would still need
- * to trust the ChannelManager to avoid loss of funds as this latest component
- * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
- *
- * A more secure iteration would be to use hashlock (or payment points) to pair
- * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
- * at the price of more state and computation on the hardware wallet side. In the future,
- * we are looking forward to design such interface.
- *
- * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
- * to act, as liveness and breach reply correctness are always going to be hard requirements
- * of LN security model, orthogonal of key management issues.
- *
- * If you're implementing a custom signer, you almost certainly want to implement
- * Readable/Writable to serialize out a unique reference to this set of keys so
- * that you can serialize the full ChannelManager object.
- *
+ * Used to put an error message in a LightningError
*/
-typedef struct LDKChannelKeys {
- void *this_arg;
- /**
- * Gets the per-commitment point for a specific commitment number
- *
- * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
- */
- struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
+typedef enum LDKErrorAction_Tag {
/**
- * Gets the commitment secret for a specific commitment number as part of the revocation process
- *
- * An external signer implementation should error here if the commitment was already signed
- * and should refuse to sign it in the future.
- *
- * May be called more than once for the same index.
- *
- * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
- * TODO: return a Result so we can signal a validation error
+ * The peer took some action which made us think they were useless. Disconnect them.
*/
- struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
+ LDKErrorAction_DisconnectPeer,
/**
- * Gets the holder's channel public keys and basepoints
+ * The peer did something harmless that we weren't able to process, just log and ignore
*/
- struct LDKChannelPublicKeys pubkeys;
+ LDKErrorAction_IgnoreError,
/**
- * 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.
+ * The peer did something incorrect. Tell them.
*/
- void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
+ LDKErrorAction_SendErrorMessage,
/**
- * 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.
+ * Must be last for serialization purposes
*/
- LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
+ LDKErrorAction_Sentinel,
+} LDKErrorAction_Tag;
+
+typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
+ struct LDKErrorMessage msg;
+} LDKErrorAction_LDKDisconnectPeer_Body;
+
+typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
+ struct LDKErrorMessage msg;
+} LDKErrorAction_LDKSendErrorMessage_Body;
+
+typedef struct MUST_USE_STRUCT LDKErrorAction {
+ LDKErrorAction_Tag tag;
+ union {
+ LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
+ LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
+ };
+} LDKErrorAction;
+
+/**
+ * The information we received from a peer along the route of a payment we originated. This is
+ * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
+ * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
+ */
+typedef enum LDKHTLCFailChannelUpdate_Tag {
/**
- * 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.
+ * We received an error which included a full ChannelUpdate message.
*/
- struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
+ LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
/**
- * Create a signature for a holder's commitment transaction. This will only ever be called with
- * the same 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.
+ * We received an error which indicated only that a channel has been closed
*/
- struct LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
+ LDKHTLCFailChannelUpdate_ChannelClosed,
/**
- * Create a signature for each HTLC transaction spending a holder's commitment transaction.
- *
- * Unlike sign_holder_commitment, this may be called multiple times with *different*
- * commitment_tx values. While this will never be called with a revoked
- * commitment_tx, it is possible that it is called with the second-latest
- * 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.
- *
- * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
- * commitment_tx.
+ * We received an error which indicated only that a node has failed
*/
- struct LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
+ LDKHTLCFailChannelUpdate_NodeFailure,
/**
- * Create a signature for the given input in a transaction spending an HTLC or commitment
- * transaction output when our counterparty broadcasts an old state.
- *
- * A justice transaction may claim multiples outputs at the same time if timelocks are
- * similar, but only a signature for the input at index `input` should be signed for here.
- * It may be called multiples time for same output(s) if a fee-bump is needed with regards
- * to an upcoming timelock expiration.
- *
- * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
- *
- * per_commitment_key is revocation secret which was provided by our counterparty when they
- * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
- * not allow the spending of any funds by itself (you need our holder revocation_secret to do
- * so).
- *
- * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
- * changing the format of the witness script (which is committed to in the BIP 143
- * signatures).
+ * Must be last for serialization purposes
*/
- struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
- /**
- * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
- * transaction, either offered or received.
- *
- * Such a transaction may claim multiples offered outputs at same time if we know the
- * preimage for each when we create it, but only the input at index `input` should be
- * signed for here. It may be called multiple times for same output(s) if a fee-bump is
- * needed with regards to an upcoming timelock expiration.
- *
- * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
- * outputs.
- *
- * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
- *
- * Per_commitment_point is the dynamic point corresponding to the channel state
- * detected onchain. It has been generated by our counterparty and is used to derive
- * channel state keys, which are then included in the witness script and committed to in the
- * BIP 143 signature.
- */
- struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
- /**
- * Create a signature for a (proposed) closing transaction.
- *
- * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
- * chosen to forgo their output as dust.
- */
- struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
- /**
- * Signs a channel announcement message with our funding key, proving it comes from one
- * of the channel participants.
- *
- * Note that if this fails or is rejected, the channel will not be publicly announced and
- * our counterparty may (though likely will not) close the channel on us for violating the
- * protocol.
- */
- struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
- /**
- * Set the counterparty static channel data, including basepoints,
- * counterparty_selected/holder_selected_contest_delay and funding outpoint.
- * This is done as soon as the funding outpoint is known. Since these are static channel data,
- * they MUST NOT be allowed to change to different values once set.
- *
- * channel_parameters.is_populated() MUST be true.
- *
- * We bind holder_selected_contest_delay late here for API convenience.
- *
- * Will be called before any signatures are applied.
- */
- void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
- void *(*clone)(const void *this_arg);
- LDKCVec_u8Z (*write)(const void *this_arg);
- void (*free)(void *this_arg);
-} LDKChannelKeys;
-
-
-
-/**
- * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
- * on-chain transactions to ensure no loss of funds occurs.
- *
- * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
- * information and are actively monitoring the chain.
- *
- * Pending Events or updated HTLCs which have not yet been read out by
- * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
- * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
- * gotten are fully handled before re-serializing the new state.
- *
- * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
- * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
- * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
- * returned block hash and the the current chain and then reconnecting blocks to get to the
- * best chain) upon deserializing the object!
- */
-typedef struct MUST_USE_STRUCT LDKChannelMonitor {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeChannelMonitor *inner;
- bool is_owned;
-} LDKChannelMonitor;
-
-typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor {
- struct LDKThirtyTwoBytes a;
- struct LDKChannelMonitor b;
-} LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor;
-
-typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor LDKC2Tuple_BlockHashChannelMonitorZ;
-
-typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
- struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor *result;
- struct LDKDecodeError *err;
-} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
-
-typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
- union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
-
-/**
- * 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:
- * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
- *
- * 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:
- * <BIP 143 signature> <payment key>
- *
- * 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;
- LDKC2Tuple_u64u64Z key_derivation_params;
- struct LDKPublicKey revocation_pubkey;
-} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
-
-typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
- struct LDKOutPoint outpoint;
- struct LDKTxOut output;
- 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 union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
- struct LDKSpendableOutputDescriptor *result;
- struct LDKDecodeError *err;
-} LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
-
-typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
- union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
-
-typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ;
-
-typedef struct LDKCVecTempl_Signature LDKCVec_SignatureZ;
-
-typedef union LDKCResult_ChanKeySignerDecodeErrorZPtr {
- struct LDKChannelKeys *result;
- struct LDKDecodeError *err;
-} LDKCResult_ChanKeySignerDecodeErrorZPtr;
-
-typedef struct LDKCResult_ChanKeySignerDecodeErrorZ {
- union LDKCResult_ChanKeySignerDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_ChanKeySignerDecodeErrorZ;
-
-
-
-/**
- * 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;
-
-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 {
- LDKCVec_u8Z err;
-} LDKAPIError_LDKAPIMisuseError_Body;
+ LDKHTLCFailChannelUpdate_Sentinel,
+} LDKHTLCFailChannelUpdate_Tag;
-typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
- LDKCVec_u8Z err;
- uint32_t feerate;
-} LDKAPIError_LDKFeeRateTooHigh_Body;
+typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
+ struct LDKChannelUpdate msg;
+} LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
-typedef struct LDKAPIError_LDKRouteError_Body {
- struct LDKStr err;
-} LDKAPIError_LDKRouteError_Body;
+typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
+ uint64_t short_channel_id;
+ bool is_permanent;
+} LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
-typedef struct LDKAPIError_LDKChannelUnavailable_Body {
- LDKCVec_u8Z err;
-} LDKAPIError_LDKChannelUnavailable_Body;
+typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
+ struct LDKPublicKey node_id;
+ bool is_permanent;
+} LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
-typedef struct MUST_USE_STRUCT LDKAPIError {
- LDKAPIError_Tag tag;
+typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
+ LDKHTLCFailChannelUpdate_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;
+ LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
+ LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
+ LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
};
-} LDKAPIError;
-
-typedef union LDKCResult_NoneAPIErrorZPtr {
- /**
- * Note that this value is always NULL, as there are no contents in the OK variant
- */
- void *result;
- struct LDKAPIError *err;
-} LDKCResult_NoneAPIErrorZPtr;
-
-typedef struct LDKCResult_NoneAPIErrorZ {
- union LDKCResult_NoneAPIErrorZPtr contents;
- bool result_ok;
-} LDKCResult_NoneAPIErrorZ;
+} LDKHTLCFailChannelUpdate;
/**
- * 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.
+ * 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 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.
- */
- LDKnativePaymentSendFailure *inner;
- bool is_owned;
-} LDKPaymentSendFailure;
-
-typedef union LDKCResult_NonePaymentSendFailureZPtr {
- /**
- * Note that this value is always NULL, as there are no contents in the OK variant
- */
- void *result;
- struct LDKPaymentSendFailure *err;
-} LDKCResult_NonePaymentSendFailureZPtr;
-
-typedef struct LDKCResult_NonePaymentSendFailureZ {
- union LDKCResult_NonePaymentSendFailureZPtr contents;
- bool result_ok;
-} LDKCResult_NonePaymentSendFailureZ;
+typedef struct 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;
/**
- * An event to be processed by the ChannelManager.
+ * 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 LDKMonitorEvent {
+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.
*/
- LDKnativeMonitorEvent *inner;
+ LDKnativeQueryShortChannelIds *inner;
bool is_owned;
-} LDKMonitorEvent;
-
-typedef struct LDKCVecTempl_MonitorEvent {
- struct LDKMonitorEvent *data;
- uintptr_t datalen;
-} LDKCVecTempl_MonitorEvent;
-
-typedef struct LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
+} LDKQueryShortChannelIds;
/**
- * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
- * blocks are connected and disconnected.
- *
- * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
- * responsible for maintaining a set of monitors such that they can be updated accordingly as
- * channel state changes and HTLCs are resolved. See method documentation for specific
- * requirements.
- *
- * Implementations **must** ensure that updates are successfully applied and persisted upon method
- * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
- * without taking any further action such as persisting the current state.
- *
- * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
- * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
- * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
- * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
- * multiple instances.
- *
- * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
- * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
- * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
+ * An event generated by ChannelManager which indicates a message should be sent to a peer (or
+ * broadcast to most peers).
+ * These events are handled by PeerManager::process_events if you are using a PeerManager.
*/
-typedef struct LDKWatch {
- void *this_arg;
+typedef enum LDKMessageSendEvent_Tag {
/**
- * Watches a channel identified by `funding_txo` using `monitor`.
- *
- * Implementations are responsible for watching the chain for the funding transaction along
- * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
- * calling [`block_connected`] and [`block_disconnected`] on the monitor.
- *
- * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
- * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
- * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
+ * Used to indicate that we've accepted a channel open and should send the accept_channel
+ * message provided to the given peer.
*/
- struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
+ LDKMessageSendEvent_SendAcceptChannel,
/**
- * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
- *
- * Implementations must call [`update_monitor`] with the given update. See
- * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
- *
- * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
- * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+ * Used to indicate that we've initiated a channel open and should send the open_channel
+ * message provided to the given peer.
*/
- struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
+ LDKMessageSendEvent_SendOpenChannel,
/**
- * Returns any monitor events since the last call. Subsequent calls must only return new
- * events.
+ * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
*/
- LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
- void (*free)(void *this_arg);
-} LDKWatch;
-
-/**
- * An interface to send a transaction to the Bitcoin network.
- */
-typedef struct LDKBroadcasterInterface {
- void *this_arg;
+ LDKMessageSendEvent_SendFundingCreated,
/**
- * Sends a transaction out to (hopefully) be mined.
+ * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
*/
- void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
- void (*free)(void *this_arg);
-} LDKBroadcasterInterface;
-
-typedef struct LDKSecretKey {
- uint8_t bytes[32];
-} LDKSecretKey;
-
-typedef struct LDKu8slice {
- const uint8_t *data;
- uintptr_t datalen;
-} LDKu8slice;
-
-/**
- * A trait to describe an object which can get user secrets and key material.
- */
-typedef struct LDKKeysInterface {
- void *this_arg;
+ LDKMessageSendEvent_SendFundingSigned,
/**
- * Get node secret key (aka node_id or network_key)
+ * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
*/
- struct LDKSecretKey (*get_node_secret)(const void *this_arg);
+ LDKMessageSendEvent_SendFundingLocked,
/**
- * Get destination redeemScript to encumber static protocol exit points.
+ * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
*/
- LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
+ LDKMessageSendEvent_SendAnnouncementSignatures,
/**
- * Get shutdown_pubkey to use as PublicKey at channel closure
+ * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
+ * message should be sent to the peer with the given node_id.
*/
- struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
+ LDKMessageSendEvent_UpdateHTLCs,
/**
- * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
- * restarted with some stale data!
+ * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
*/
- struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
+ LDKMessageSendEvent_SendRevokeAndACK,
/**
- * 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.
+ * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
*/
- struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
+ LDKMessageSendEvent_SendClosingSigned,
/**
- * 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 `<Self::ChanKeySigner as Writeable>::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.
+ * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
*/
- struct LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
- void (*free)(void *this_arg);
-} LDKKeysInterface;
-
-/**
- * A trait which should be implemented to provide feerate information on a number of time
- * horizons.
- *
- * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
- * called from inside the library in response to chain events, P2P events, or timer events).
- */
-typedef struct LDKFeeEstimator {
- void *this_arg;
+ LDKMessageSendEvent_SendShutdown,
/**
- * Gets estimated satoshis of fee required per 1000 Weight-Units.
- *
- * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
- * don't put us below 1 satoshi-per-byte).
+ * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendChannelReestablish,
+ /**
+ * Used to indicate that a channel_announcement and channel_update should be broadcast to all
+ * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
*
- * This translates to:
- * * satoshis-per-byte * 250
- * * ceil(satoshis-per-kbyte / 4)
+ * Note that after doing so, you very likely (unless you did so very recently) want to call
+ * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
+ * This ensures that any nodes which see our channel_announcement also have a relevant
+ * node_announcement, including relevant feature flags which may be important for routing
+ * through or to us.
*/
- uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
- void (*free)(void *this_arg);
-} LDKFeeEstimator;
+ LDKMessageSendEvent_BroadcastChannelAnnouncement,
+ /**
+ * Used to indicate that a node_announcement should be broadcast to all peers.
+ */
+ LDKMessageSendEvent_BroadcastNodeAnnouncement,
+ /**
+ * Used to indicate that a channel_update should be broadcast to all peers.
+ */
+ LDKMessageSendEvent_BroadcastChannelUpdate,
+ /**
+ * Broadcast an error downstream to be handled
+ */
+ LDKMessageSendEvent_HandleError,
+ /**
+ * When a payment fails we may receive updates back from the hop where it failed. In such
+ * cases this event is generated so that we can inform the network graph of this information.
+ */
+ 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
+ */
+ LDKMessageSendEvent_Sentinel,
+} LDKMessageSendEvent_Tag;
+
+typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
+ struct LDKPublicKey node_id;
+ struct LDKAcceptChannel msg;
+} LDKMessageSendEvent_LDKSendAcceptChannel_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
+ struct LDKPublicKey node_id;
+ struct LDKOpenChannel msg;
+} LDKMessageSendEvent_LDKSendOpenChannel_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
+ struct LDKPublicKey node_id;
+ struct LDKFundingCreated msg;
+} LDKMessageSendEvent_LDKSendFundingCreated_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
+ struct LDKPublicKey node_id;
+ struct LDKFundingSigned msg;
+} LDKMessageSendEvent_LDKSendFundingSigned_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
+ struct LDKPublicKey node_id;
+ struct LDKFundingLocked msg;
+} LDKMessageSendEvent_LDKSendFundingLocked_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
+ struct LDKPublicKey node_id;
+ struct LDKAnnouncementSignatures msg;
+} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
+
+typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
+ struct LDKPublicKey node_id;
+ struct LDKCommitmentUpdate updates;
+} LDKMessageSendEvent_LDKUpdateHTLCs_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
+ struct LDKPublicKey node_id;
+ struct LDKRevokeAndACK msg;
+} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
+ struct LDKPublicKey node_id;
+ struct LDKClosingSigned msg;
+} LDKMessageSendEvent_LDKSendClosingSigned_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
+ struct LDKPublicKey node_id;
+ struct LDKShutdown msg;
+} LDKMessageSendEvent_LDKSendShutdown_Body;
-/**
- * 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 struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
+ struct LDKPublicKey node_id;
+ struct LDKChannelReestablish msg;
+} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
+typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
+ struct LDKChannelAnnouncement msg;
+ struct LDKChannelUpdate update_msg;
+} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
+typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
+ struct LDKNodeAnnouncement msg;
+} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
-/**
- * Manager which keeps track of a number of channels and sends messages to the appropriate
- * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
- *
- * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
- * to individual Channels.
- *
- * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
- * all peers during write/read (though does not modify this instance, only the instance being
- * serialized). This will result in any channels which have not yet exchanged funding_created (ie
- * called funding_transaction_generated for outbound channels).
- *
- * Note that you can be a bit lazier about writing out ChannelManager than you can be with
- * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
- * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
- * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
- * the serialization process). If the deserialized version is out-of-date compared to the
- * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
- * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
- *
- * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
- * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
- * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
- * block_connected() to step towards your best block) upon deserialization before using the
- * object!
- *
- * Note that ChannelManager is responsible for tracking liveness of its channels and generating
- * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
- * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
- * offline for a full minute. In order to track this, you must call
- * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
- *
- * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
- * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
- * essentially you should default to using a SimpleRefChannelManager, and use a
- * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
- * you're using lightning-net-tokio.
- */
-typedef struct MUST_USE_STRUCT LDKChannelManager {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeChannelManager *inner;
- bool is_owned;
-} LDKChannelManager;
+typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
+ struct LDKChannelUpdate msg;
+} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
-typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager {
- struct LDKThirtyTwoBytes a;
- struct LDKChannelManager b;
-} LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager;
+typedef struct LDKMessageSendEvent_LDKHandleError_Body {
+ struct LDKPublicKey node_id;
+ struct LDKErrorAction action;
+} LDKMessageSendEvent_LDKHandleError_Body;
-typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager LDKC2Tuple_BlockHashChannelManagerZ;
+typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
+ struct LDKHTLCFailChannelUpdate update;
+} LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
-typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
- struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager *result;
- struct LDKDecodeError *err;
-} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
+typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
+ struct LDKPublicKey node_id;
+ struct LDKQueryChannelRange msg;
+} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
-typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
- union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
+typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
+ struct LDKPublicKey node_id;
+ struct LDKQueryShortChannelIds msg;
+} LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
-typedef struct LDKFourBytes {
- uint8_t data[4];
-} LDKFourBytes;
+typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
+ LDKMessageSendEvent_Tag tag;
+ union {
+ LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
+ LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
+ LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
+ LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
+ LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
+ LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
+ LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
+ LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
+ LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
+ LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
+ LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
+ LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
+ LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
+ LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
+ LDKMessageSendEvent_LDKHandleError_Body handle_error;
+ LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
+ LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
+ LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
+ };
+} LDKMessageSendEvent;
-typedef struct LDKSixteenBytes {
- uint8_t data[16];
-} LDKSixteenBytes;
+typedef struct LDKCVec_MessageSendEventZ {
+ struct LDKMessageSendEvent *data;
+ uintptr_t datalen;
+} LDKCVec_MessageSendEventZ;
-typedef struct LDKTenBytes {
- uint8_t data[10];
-} LDKTenBytes;
+/**
+ * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
+ * look up the corresponding function in rust-lightning's docs.
+ */
+typedef struct LDKThirtyTwoBytes {
+ uint8_t data[32];
+} LDKThirtyTwoBytes;
/**
- * An address which can be used to connect to a remote peer
+ * 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 LDKNetAddress_Tag {
+typedef enum LDKEvent_Tag {
/**
- * An IPv4 address/port on which the peer is listening.
+ * 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!
*/
- LDKNetAddress_IPv4,
+ LDKEvent_FundingGenerationReady,
/**
- * An IPv6 address/port on which the peer is listening.
+ * 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!
*/
- LDKNetAddress_IPv6,
+ LDKEvent_FundingBroadcastSafe,
/**
- * An old-style Tor onion address/port on which the peer is listening.
+ * 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.
*/
- LDKNetAddress_OnionV2,
+ LDKEvent_PaymentReceived,
/**
- * 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\".
+ * 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)!
*/
- LDKNetAddress_OnionV3,
+ 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
*/
- LDKNetAddress_Sentinel,
-} LDKNetAddress_Tag;
+ LDKEvent_Sentinel,
+} LDKEvent_Tag;
-typedef struct LDKNetAddress_LDKIPv4_Body {
- struct LDKFourBytes addr;
- uint16_t port;
-} LDKNetAddress_LDKIPv4_Body;
+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 LDKNetAddress_LDKIPv6_Body {
- struct LDKSixteenBytes addr;
- uint16_t port;
-} LDKNetAddress_LDKIPv6_Body;
+typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
+ struct LDKOutPoint funding_txo;
+ uint64_t user_channel_id;
+} LDKEvent_LDKFundingBroadcastSafe_Body;
-typedef struct LDKNetAddress_LDKOnionV2_Body {
- struct LDKTenBytes addr;
- uint16_t port;
-} LDKNetAddress_LDKOnionV2_Body;
+typedef struct LDKEvent_LDKPaymentReceived_Body {
+ struct LDKThirtyTwoBytes payment_hash;
+ struct LDKThirtyTwoBytes payment_secret;
+ uint64_t amt;
+} LDKEvent_LDKPaymentReceived_Body;
-typedef struct LDKNetAddress_LDKOnionV3_Body {
- struct LDKThirtyTwoBytes ed25519_pubkey;
- uint16_t checksum;
- uint8_t version;
- uint16_t port;
-} LDKNetAddress_LDKOnionV3_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 LDKNetAddress {
- LDKNetAddress_Tag tag;
+typedef struct MUST_USE_STRUCT LDKEvent {
+ LDKEvent_Tag tag;
union {
- LDKNetAddress_LDKIPv4_Body i_pv4;
- LDKNetAddress_LDKIPv6_Body i_pv6;
- LDKNetAddress_LDKOnionV2_Body onion_v2;
- LDKNetAddress_LDKOnionV3_Body onion_v3;
+ 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;
};
-} LDKNetAddress;
-
-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;
+} LDKEvent;
-typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
- struct LDKCResult_NetAddressu8Z *result;
- struct LDKDecodeError *err;
-} LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
+typedef struct LDKCVec_EventZ {
+ struct LDKEvent *data;
+ uintptr_t datalen;
+} LDKCVec_EventZ;
-typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
- union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
+typedef struct LDKC2TupleTempl_usize__Transaction {
+ uintptr_t a;
+ struct LDKTransaction b;
+} LDKC2TupleTempl_usize__Transaction;
+typedef struct LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ;
+typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
+ struct LDKC2TupleTempl_usize__Transaction *data;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_usizeTransactionZZ;
-/**
- * An Err type for failure to process messages.
- */
-typedef struct MUST_USE_STRUCT LDKLightningError {
+typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
/**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- LDKnativeLightningError *inner;
- bool is_owned;
-} LDKLightningError;
-
-typedef union LDKCResult_boolLightningErrorZPtr {
- bool *result;
- struct LDKLightningError *err;
-} LDKCResult_boolLightningErrorZPtr;
+ void *result;
+ enum LDKChannelMonitorUpdateErr *err;
+} LDKCResult_NoneChannelMonitorUpdateErrZPtr;
-typedef struct LDKCResult_boolLightningErrorZ {
- union LDKCResult_boolLightningErrorZPtr contents;
+typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
+ union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
bool result_ok;
-} LDKCResult_boolLightningErrorZ;
+} LDKCResult_NoneChannelMonitorUpdateErrZ;
/**
- * A channel_announcement message to be sent or received from a peer
+ * An event to be processed by the ChannelManager.
*/
-typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
+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.
*/
- LDKnativeChannelAnnouncement *inner;
+ LDKnativeMonitorEvent *inner;
bool is_owned;
-} LDKChannelAnnouncement;
+} LDKMonitorEvent;
+
+typedef struct LDKCVec_MonitorEventZ {
+ struct LDKMonitorEvent *data;
+ uintptr_t datalen;
+} LDKCVec_MonitorEventZ;
/**
- * A channel_update message to be sent or received from a peer
+ * 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 LDKChannelUpdate {
+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.
*/
- LDKnativeChannelUpdate *inner;
+ LDKnativeChannelMonitorUpdate *inner;
bool is_owned;
-} LDKChannelUpdate;
-
-typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
- struct LDKChannelAnnouncement a;
- struct LDKChannelUpdate b;
- struct LDKChannelUpdate c;
-} LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
-
-typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
-
-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 LDKCResult_NoneLightningErrorZ {
- union LDKCResult_NoneLightningErrorZPtr contents;
- bool result_ok;
-} LDKCResult_NoneLightningErrorZ;
+} LDKChannelMonitorUpdate;
/**
- * A channel_reestablish message to be sent or received from a peer
+ * An error in decoding a message or struct.
*/
-typedef struct MUST_USE_STRUCT LDKChannelReestablish {
+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.
*/
- LDKnativeChannelReestablish *inner;
+ LDKnativeDecodeError *inner;
bool is_owned;
-} LDKChannelReestablish;
+} LDKDecodeError;
-typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
- struct LDKChannelReestablish *result;
+typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
+ struct LDKChannelMonitorUpdate *result;
struct LDKDecodeError *err;
-} LDKCResult_ChannelReestablishDecodeErrorZPtr;
+} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
-typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
- union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
+typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
+ union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
bool result_ok;
-} LDKCResult_ChannelReestablishDecodeErrorZ;
+} LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
/**
- * An init message to be sent or received from a peer
+ * 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 LDKInit {
+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.
*/
- LDKnativeInit *inner;
+ LDKnativeMonitorUpdateError *inner;
bool is_owned;
-} LDKInit;
+} LDKMonitorUpdateError;
-typedef union LDKCResult_InitDecodeErrorZPtr {
- struct LDKInit *result;
- struct LDKDecodeError *err;
-} LDKCResult_InitDecodeErrorZPtr;
+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_InitDecodeErrorZ {
- union LDKCResult_InitDecodeErrorZPtr contents;
+typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
+ union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
bool result_ok;
-} LDKCResult_InitDecodeErrorZ;
+} LDKCResult_NoneMonitorUpdateErrorZ;
+
+typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
+ struct LDKOutPoint a;
+ struct LDKCVec_u8Z b;
+} LDKC2TupleTempl_OutPoint__CVec_u8Z;
+typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
+typedef struct LDKCVec_TransactionZ {
+ struct LDKTransaction *data;
+ uintptr_t datalen;
+} LDKCVec_TransactionZ;
-/**
- * A ping message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKPing {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativePing *inner;
- bool is_owned;
-} LDKPing;
+typedef struct LDKC2TupleTempl_u32__TxOut {
+ uint32_t a;
+ struct LDKTxOut b;
+} LDKC2TupleTempl_u32__TxOut;
-typedef union LDKCResult_PingDecodeErrorZPtr {
- struct LDKPing *result;
- struct LDKDecodeError *err;
-} LDKCResult_PingDecodeErrorZPtr;
+typedef struct LDKC2TupleTempl_u32__TxOut LDKC2Tuple_u32TxOutZ;
-typedef struct LDKCResult_PingDecodeErrorZ {
- union LDKCResult_PingDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_PingDecodeErrorZ;
+typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
+ struct LDKC2TupleTempl_u32__TxOut *data;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_u32TxOutZZ;
+
+typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVec_C2Tuple_u32TxOutZZ {
+ struct LDKThirtyTwoBytes a;
+ struct LDKCVec_C2Tuple_u32TxOutZZ b;
+} LDKC2TupleTempl_ThirtyTwoBytes__CVec_C2Tuple_u32TxOutZZ;
+
+typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVec_C2Tuple_u32TxOutZZ LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
+
+typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
+ struct LDKC2TupleTempl_ThirtyTwoBytes__CVec_C2Tuple_u32TxOutZZ *data;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
/**
- * A pong message to be sent or received from a peer
+ * One counterparty's public keys which do not change over the life of a channel.
*/
-typedef struct MUST_USE_STRUCT LDKPong {
+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.
*/
- LDKnativePong *inner;
+ LDKnativeChannelPublicKeys *inner;
bool is_owned;
-} LDKPong;
+} LDKChannelPublicKeys;
-typedef union LDKCResult_PongDecodeErrorZPtr {
- struct LDKPong *result;
- struct LDKDecodeError *err;
-} LDKCResult_PongDecodeErrorZPtr;
+typedef struct LDKSignature {
+ uint8_t compact_form[64];
+} LDKSignature;
-typedef struct LDKCResult_PongDecodeErrorZ {
- union LDKCResult_PongDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_PongDecodeErrorZ;
+typedef struct LDKCVec_SignatureZ {
+ struct LDKSignature *data;
+ uintptr_t datalen;
+} LDKCVec_SignatureZ;
-typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
- struct LDKUnsignedChannelAnnouncement *result;
- struct LDKDecodeError *err;
-} LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
+typedef struct LDKC2TupleTempl_Signature__CVec_SignatureZ {
+ struct LDKSignature a;
+ struct LDKCVec_SignatureZ b;
+} LDKC2TupleTempl_Signature__CVec_SignatureZ;
-typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
- union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
+typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
+ struct LDKC2TupleTempl_Signature__CVec_SignatureZ *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_UnsignedChannelAnnouncementDecodeErrorZ;
+} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
/**
- * The unsigned part of a channel_update
+ * 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 struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
+typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
/**
* Nearly everywhere, 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;
+ LDKnativeCommitmentTransaction *inner;
bool is_owned;
-} LDKUnsignedChannelUpdate;
+} LDKCommitmentTransaction;
-typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
- struct LDKUnsignedChannelUpdate *result;
- struct LDKDecodeError *err;
-} LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
+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_UnsignedChannelUpdateDecodeErrorZ {
- union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
+typedef struct LDKCResult_SignatureNoneZ {
+ union LDKCResult_SignatureNoneZPtr contents;
bool result_ok;
-} LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
+} LDKCResult_SignatureNoneZ;
/**
- * An error message to be sent or received from a peer
+ * 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 LDKErrorMessage {
+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.
*/
- LDKnativeErrorMessage *inner;
+ LDKnativeHolderCommitmentTransaction *inner;
bool is_owned;
-} LDKErrorMessage;
+} LDKHolderCommitmentTransaction;
-typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
- struct LDKErrorMessage *result;
- struct LDKDecodeError *err;
-} LDKCResult_ErrorMessageDecodeErrorZPtr;
+typedef union LDKCResult_CVec_SignatureZNoneZPtr {
+ struct LDKCVec_SignatureZ *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_CVec_SignatureZNoneZPtr;
-typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
- union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
+typedef struct LDKCResult_CVec_SignatureZNoneZ {
+ union LDKCResult_CVec_SignatureZNoneZPtr contents;
bool result_ok;
-} LDKCResult_ErrorMessageDecodeErrorZ;
+} LDKCResult_CVec_SignatureZNoneZ;
/**
- * The unsigned part of a node_announcement
+ * Information about an HTLC as it appears in a commitment transaction
*/
-typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
+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.
*/
- LDKnativeUnsignedNodeAnnouncement *inner;
+ LDKnativeHTLCOutputInCommitment *inner;
bool is_owned;
-} 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;
+} LDKHTLCOutputInCommitment;
/**
- * 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.
+ * The unsigned part of a channel_announcement
*/
-typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
+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.
*/
- LDKnativeQueryShortChannelIds *inner;
+ LDKnativeUnsignedChannelAnnouncement *inner;
bool is_owned;
-} LDKQueryShortChannelIds;
-
-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;
+} LDKUnsignedChannelAnnouncement;
/**
- * 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.
+ * 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 LDKReplyShortChannelIdsEnd {
+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.
*/
- LDKnativeReplyShortChannelIdsEnd *inner;
+ LDKnativeChannelTransactionParameters *inner;
bool is_owned;
-} LDKReplyShortChannelIdsEnd;
-
-typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
- struct LDKReplyShortChannelIdsEnd *result;
- struct LDKDecodeError *err;
-} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
+} LDKChannelTransactionParameters;
-typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
- union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
+/**
+ * Set of lightning keys needed to operate a channel as described in BOLT 3.
+ *
+ * Signing services could be implemented on a hardware wallet. In this case,
+ * the current ChannelKeys would be a front-end on top of a communication
+ * channel connected to your secure device and lightning key material wouldn't
+ * reside on a hot server. Nevertheless, a this deployment would still need
+ * to trust the ChannelManager to avoid loss of funds as this latest component
+ * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
+ *
+ * A more secure iteration would be to use hashlock (or payment points) to pair
+ * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
+ * at the price of more state and computation on the hardware wallet side. In the future,
+ * we are looking forward to design such interface.
+ *
+ * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
+ * to act, as liveness and breach reply correctness are always going to be hard requirements
+ * of LN security model, orthogonal of key management issues.
+ *
+ * If you're implementing a custom signer, you almost certainly want to implement
+ * Readable/Writable to serialize out a unique reference to this set of keys so
+ * that you can serialize the full ChannelManager object.
+ *
+ */
+typedef struct LDKChannelKeys {
+ void *this_arg;
+ /**
+ * Gets the per-commitment point for a specific commitment number
+ *
+ * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
+ */
+ struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
+ /**
+ * Gets the commitment secret for a specific commitment number as part of the revocation process
+ *
+ * An external signer implementation should error here if the commitment was already signed
+ * and should refuse to sign it in the future.
+ *
+ * May be called more than once for the same index.
+ *
+ * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
+ * TODO: return a Result so we can signal a validation error
+ */
+ struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
+ /**
+ * Gets the holder's channel public keys and basepoints
+ */
+ struct LDKChannelPublicKeys pubkeys;
+ /**
+ * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
+ * Note that this takes a pointer to this object, not the this_ptr like other methods do
+ * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
+ */
+ void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
+ /**
+ * Gets arbitrary identifiers describing the set of keys which are provided back to you in
+ * some SpendableOutputDescriptor types. These should be sufficient to identify this
+ * ChannelKeys object uniquely and lookup or re-derive its keys.
+ */
+ LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
+ /**
+ * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
+ *
+ * Note that if signing fails or is rejected, the channel will be force-closed.
+ */
+ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
+ /**
+ * Create a signature for a holder's commitment transaction. This will only ever be called with
+ * the same 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.
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
+ /**
+ * Create a signature for each HTLC transaction spending a holder's commitment transaction.
+ *
+ * Unlike sign_holder_commitment, this may be called multiple times with *different*
+ * commitment_tx values. While this will never be called with a revoked
+ * commitment_tx, it is possible that it is called with the second-latest
+ * 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.
+ *
+ * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
+ * commitment_tx.
+ */
+ struct LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
+ /**
+ * Create a signature for the given input in a transaction spending an HTLC or commitment
+ * transaction output when our counterparty broadcasts an old state.
+ *
+ * A justice transaction may claim multiples outputs at the same time if timelocks are
+ * similar, but only a signature for the input at index `input` should be signed for here.
+ * It may be called multiples time for same output(s) if a fee-bump is needed with regards
+ * to an upcoming timelock expiration.
+ *
+ * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
+ *
+ * per_commitment_key is revocation secret which was provided by our counterparty when they
+ * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
+ * not allow the spending of any funds by itself (you need our holder revocation_secret to do
+ * so).
+ *
+ * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
+ * changing the format of the witness script (which is committed to in the BIP 143
+ * signatures).
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
+ /**
+ * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
+ * transaction, either offered or received.
+ *
+ * Such a transaction may claim multiples offered outputs at same time if we know the
+ * preimage for each when we create it, but only the input at index `input` should be
+ * signed for here. It may be called multiple times for same output(s) if a fee-bump is
+ * needed with regards to an upcoming timelock expiration.
+ *
+ * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
+ * outputs.
+ *
+ * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
+ *
+ * Per_commitment_point is the dynamic point corresponding to the channel state
+ * detected onchain. It has been generated by our counterparty and is used to derive
+ * channel state keys, which are then included in the witness script and committed to in the
+ * BIP 143 signature.
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
+ /**
+ * Create a signature for a (proposed) closing transaction.
+ *
+ * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
+ * chosen to forgo their output as dust.
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
+ /**
+ * Signs a channel announcement message with our funding key, proving it comes from one
+ * of the channel participants.
+ *
+ * Note that if this fails or is rejected, the channel will not be publicly announced and
+ * our counterparty may (though likely will not) close the channel on us for violating the
+ * protocol.
+ */
+ struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
+ /**
+ * Set the counterparty static channel data, including basepoints,
+ * counterparty_selected/holder_selected_contest_delay and funding outpoint.
+ * This is done as soon as the funding outpoint is known. Since these are static channel data,
+ * they MUST NOT be allowed to change to different values once set.
+ *
+ * channel_parameters.is_populated() MUST be true.
+ *
+ * We bind holder_selected_contest_delay late here for API convenience.
+ *
+ * Will be called before any signatures are applied.
+ */
+ void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
+ void *(*clone)(const void *this_arg);
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
+ void (*free)(void *this_arg);
+} LDKChannelKeys;
/**
- * 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.
+ * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
+ * on-chain transactions to ensure no loss of funds occurs.
+ *
+ * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
+ * information and are actively monitoring the chain.
+ *
+ * Pending Events or updated HTLCs which have not yet been read out by
+ * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
+ * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
+ * gotten are fully handled before re-serializing the new state.
+ *
+ * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
+ * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
+ * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
+ * returned block hash and the the current chain and then reconnecting blocks to get to the
+ * best chain) upon deserializing the object!
*/
-typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
+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.
*/
- LDKnativeQueryChannelRange *inner;
+ LDKnativeChannelMonitor *inner;
bool is_owned;
-} LDKQueryChannelRange;
+} LDKChannelMonitor;
-typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
- struct LDKQueryChannelRange *result;
+typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor {
+ struct LDKThirtyTwoBytes a;
+ struct LDKChannelMonitor b;
+} LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor;
+
+typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor LDKC2Tuple_BlockHashChannelMonitorZ;
+
+typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
+ struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor *result;
struct LDKDecodeError *err;
-} LDKCResult_QueryChannelRangeDecodeErrorZPtr;
+} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
-typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
- union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
+typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+ union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
bool result_ok;
-} LDKCResult_QueryChannelRangeDecodeErrorZ;
+} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
+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 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;
+typedef struct LDKC2TupleTempl_Signature__CVec_SignatureZ LDKC2Tuple_SignatureCVec_SignatureZZ;
-typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
- struct LDKReplyChannelRange *result;
+typedef union LDKCResult_ChanKeySignerDecodeErrorZPtr {
+ struct LDKChannelKeys *result;
struct LDKDecodeError *err;
-} LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
+} LDKCResult_ChanKeySignerDecodeErrorZPtr;
-typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
- union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
+typedef struct LDKCResult_ChanKeySignerDecodeErrorZ {
+ union LDKCResult_ChanKeySignerDecodeErrorZPtr contents;
bool result_ok;
-} LDKCResult_ReplyChannelRangeDecodeErrorZ;
+} LDKCResult_ChanKeySignerDecodeErrorZ;
/**
- * 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.
+ * 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 LDKGossipTimestampFilter {
+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.
*/
- LDKnativeGossipTimestampFilter *inner;
+ LDKnativeInMemoryChannelKeys *inner;
bool is_owned;
-} LDKGossipTimestampFilter;
+} LDKInMemoryChannelKeys;
-typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
- struct LDKGossipTimestampFilter *result;
+typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr {
+ struct LDKInMemoryChannelKeys *result;
struct LDKDecodeError *err;
-} LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
+} LDKCResult_InMemoryChannelKeysDecodeErrorZPtr;
-typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
- union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
+typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ {
+ union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents;
bool result_ok;
-} LDKCResult_GossipTimestampFilterDecodeErrorZ;
+} LDKCResult_InMemoryChannelKeysDecodeErrorZ;
+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;
/**
- * 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 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 MUST_USE_STRUCT LDKPeerHandleError {
+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 {
/**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * Indicates 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.
*/
- LDKnativePeerHandleError *inner;
- bool is_owned;
-} LDKPeerHandleError;
-
-typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
- struct LDKCVecTempl_u8 *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 {
+ LDKAPIError_APIMisuseError,
/**
- * Note that this value is always NULL, as there are no contents in the OK variant
+ * 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.
*/
- void *result;
- struct LDKPeerHandleError *err;
-} LDKCResult_NonePeerHandleErrorZPtr;
-
-typedef struct LDKCResult_NonePeerHandleErrorZ {
- union LDKCResult_NonePeerHandleErrorZPtr contents;
- bool result_ok;
-} LDKCResult_NonePeerHandleErrorZ;
-
-typedef union LDKCResult_boolPeerHandleErrorZPtr {
- bool *result;
- struct LDKPeerHandleError *err;
-} LDKCResult_boolPeerHandleErrorZPtr;
-
-typedef struct LDKCResult_boolPeerHandleErrorZ {
- union LDKCResult_boolPeerHandleErrorZPtr contents;
- bool result_ok;
-} LDKCResult_boolPeerHandleErrorZ;
+ 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 union LDKCResult_SecretKeySecpErrorZPtr {
- struct LDKSecretKey *result;
- enum LDKSecp256k1Error *err;
-} LDKCResult_SecretKeySecpErrorZPtr;
+typedef struct LDKAPIError_LDKAPIMisuseError_Body {
+ struct LDKCVec_u8Z err;
+} LDKAPIError_LDKAPIMisuseError_Body;
-typedef struct LDKCResult_SecretKeySecpErrorZ {
- union LDKCResult_SecretKeySecpErrorZPtr contents;
- bool result_ok;
-} LDKCResult_SecretKeySecpErrorZ;
+typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
+ struct LDKCVec_u8Z err;
+ uint32_t feerate;
+} LDKAPIError_LDKFeeRateTooHigh_Body;
-typedef union LDKCResult_PublicKeySecpErrorZPtr {
- struct LDKPublicKey *result;
- enum LDKSecp256k1Error *err;
-} LDKCResult_PublicKeySecpErrorZPtr;
+typedef struct LDKAPIError_LDKRouteError_Body {
+ struct LDKStr err;
+} LDKAPIError_LDKRouteError_Body;
-typedef struct LDKCResult_PublicKeySecpErrorZ {
- union LDKCResult_PublicKeySecpErrorZPtr contents;
- bool result_ok;
-} LDKCResult_PublicKeySecpErrorZ;
+typedef struct LDKAPIError_LDKChannelUnavailable_Body {
+ struct LDKCVec_u8Z err;
+} LDKAPIError_LDKChannelUnavailable_Body;
+typedef struct MUST_USE_STRUCT LDKAPIError {
+ LDKAPIError_Tag tag;
+ union {
+ LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
+ LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
+ LDKAPIError_LDKRouteError_Body route_error;
+ LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
+ };
+} LDKAPIError;
+typedef union LDKCResult_NoneAPIErrorZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ struct LDKAPIError *err;
+} LDKCResult_NoneAPIErrorZPtr;
-/**
- * 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 LDKCResult_NoneAPIErrorZ {
+ union LDKCResult_NoneAPIErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NoneAPIErrorZ;
+
+
+
+/**
+ * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
*/
-typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
+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.
*/
- LDKnativeTxCreationKeys *inner;
+ LDKnativeChannelDetails *inner;
bool is_owned;
-} LDKTxCreationKeys;
-
-typedef union LDKCResult_TxCreationKeysSecpErrorZPtr {
- struct LDKTxCreationKeys *result;
- enum LDKSecp256k1Error *err;
-} LDKCResult_TxCreationKeysSecpErrorZPtr;
+} LDKChannelDetails;
-typedef struct LDKCResult_TxCreationKeysSecpErrorZ {
- union LDKCResult_TxCreationKeysSecpErrorZPtr contents;
- bool result_ok;
-} LDKCResult_TxCreationKeysSecpErrorZ;
+typedef struct LDKCVec_ChannelDetailsZ {
+ struct LDKChannelDetails *data;
+ uintptr_t datalen;
+} LDKCVec_ChannelDetailsZ;
/**
- * 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.
+ * 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 LDKTrustedCommitmentTransaction {
+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.
*/
- LDKnativeTrustedCommitmentTransaction *inner;
+ LDKnativePaymentSendFailure *inner;
bool is_owned;
-} LDKTrustedCommitmentTransaction;
+} LDKPaymentSendFailure;
-typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
- struct LDKTrustedCommitmentTransaction *result;
+typedef union LDKCResult_NonePaymentSendFailureZPtr {
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * Note that this value is always NULL, as there are no contents in the OK variant
*/
- void *err;
-} LDKCResult_TrustedCommitmentTransactionNoneZPtr;
+ void *result;
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_NonePaymentSendFailureZPtr;
-typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
- union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
+typedef struct LDKCResult_NonePaymentSendFailureZ {
+ union LDKCResult_NonePaymentSendFailureZPtr contents;
bool result_ok;
-} LDKCResult_TrustedCommitmentTransactionNoneZ;
+} LDKCResult_NonePaymentSendFailureZ;
+
+typedef struct LDKFourBytes {
+ uint8_t data[4];
+} LDKFourBytes;
+typedef struct LDKSixteenBytes {
+ uint8_t data[16];
+} LDKSixteenBytes;
+typedef struct LDKTenBytes {
+ uint8_t data[10];
+} LDKTenBytes;
/**
- * 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.
+ * An address which can be used to connect to a remote peer
*/
-typedef struct MUST_USE_STRUCT LDKRoute {
+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.
*/
- LDKnativeRoute *inner;
- bool is_owned;
-} LDKRoute;
+ 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 union LDKCResult_RouteDecodeErrorZPtr {
- struct LDKRoute *result;
- struct LDKDecodeError *err;
-} LDKCResult_RouteDecodeErrorZPtr;
+typedef struct LDKNetAddress_LDKIPv4_Body {
+ struct LDKFourBytes addr;
+ uint16_t port;
+} LDKNetAddress_LDKIPv4_Body;
-typedef struct LDKCResult_RouteDecodeErrorZ {
- union LDKCResult_RouteDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_RouteDecodeErrorZ;
+typedef struct LDKNetAddress_LDKIPv6_Body {
+ struct LDKSixteenBytes addr;
+ uint16_t port;
+} LDKNetAddress_LDKIPv6_Body;
-typedef union LDKCResult_RouteLightningErrorZPtr {
- struct LDKRoute *result;
- struct LDKLightningError *err;
-} LDKCResult_RouteLightningErrorZPtr;
+typedef struct LDKNetAddress_LDKOnionV2_Body {
+ struct LDKTenBytes addr;
+ uint16_t port;
+} LDKNetAddress_LDKOnionV2_Body;
-typedef struct LDKCResult_RouteLightningErrorZ {
- union LDKCResult_RouteLightningErrorZPtr contents;
- bool result_ok;
-} LDKCResult_RouteLightningErrorZ;
+typedef struct LDKNetAddress_LDKOnionV3_Body {
+ struct LDKThirtyTwoBytes ed25519_pubkey;
+ uint16_t checksum;
+ uint8_t version;
+ uint16_t port;
+} LDKNetAddress_LDKOnionV3_Body;
+
+typedef struct MUST_USE_STRUCT LDKNetAddress {
+ LDKNetAddress_Tag tag;
+ union {
+ LDKNetAddress_LDKIPv4_Body i_pv4;
+ LDKNetAddress_LDKIPv6_Body i_pv6;
+ LDKNetAddress_LDKOnionV2_Body onion_v2;
+ LDKNetAddress_LDKOnionV3_Body onion_v3;
+ };
+} LDKNetAddress;
+
+typedef struct LDKCVec_NetAddressZ {
+ struct LDKNetAddress *data;
+ uintptr_t datalen;
+} LDKCVec_NetAddressZ;
+
+typedef struct LDKCVec_ChannelMonitorZ {
+ struct LDKChannelMonitor *data;
+ uintptr_t datalen;
+} LDKCVec_ChannelMonitorZ;
+
+/**
+ * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
+ * blocks are connected and disconnected.
+ *
+ * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
+ * responsible for maintaining a set of monitors such that they can be updated accordingly as
+ * channel state changes and HTLCs are resolved. See method documentation for specific
+ * requirements.
+ *
+ * Implementations **must** ensure that updates are successfully applied and persisted upon method
+ * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
+ * without taking any further action such as persisting the current state.
+ *
+ * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
+ * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
+ * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
+ * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
+ * multiple instances.
+ *
+ * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
+ * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+ * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
+ */
+typedef struct LDKWatch {
+ void *this_arg;
+ /**
+ * Watches a channel identified by `funding_txo` using `monitor`.
+ *
+ * Implementations are responsible for watching the chain for the funding transaction along
+ * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
+ * calling [`block_connected`] and [`block_disconnected`] on the monitor.
+ *
+ * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
+ * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
+ * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
+ */
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
+ /**
+ * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
+ *
+ * Implementations must call [`update_monitor`] with the given update. See
+ * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
+ *
+ * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
+ * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
+ */
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
+ /**
+ * Returns any monitor events since the last call. Subsequent calls must only return new
+ * events.
+ */
+ struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
+ void (*free)(void *this_arg);
+} LDKWatch;
+
+/**
+ * An interface to send a transaction to the Bitcoin network.
+ */
+typedef struct LDKBroadcasterInterface {
+ void *this_arg;
+ /**
+ * Sends a transaction out to (hopefully) be mined.
+ */
+ void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
+ void (*free)(void *this_arg);
+} LDKBroadcasterInterface;
+
+typedef struct LDKSecretKey {
+ uint8_t bytes[32];
+} LDKSecretKey;
+typedef struct LDKu8slice {
+ const uint8_t *data;
+ uintptr_t datalen;
+} LDKu8slice;
+/**
+ * A trait to describe an object which can get user secrets and key material.
+ */
+typedef struct LDKKeysInterface {
+ void *this_arg;
+ /**
+ * Get node secret key (aka node_id or network_key)
+ */
+ 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.
+ */
+ 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 `<Self::ChanKeySigner as Writeable>::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_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
+ void (*free)(void *this_arg);
+} LDKKeysInterface;
/**
- * Fees for routing via a given channel or a node
+ * A trait which should be implemented to provide feerate information on a number of time
+ * horizons.
+ *
+ * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
+ * called from inside the library in response to chain events, P2P events, or timer events).
*/
-typedef struct MUST_USE_STRUCT LDKRoutingFees {
+typedef struct LDKFeeEstimator {
+ 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.
+ * Gets estimated satoshis of fee required per 1000 Weight-Units.
+ *
+ * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
+ * don't put us below 1 satoshi-per-byte).
+ *
+ * This translates to:
+ * * satoshis-per-byte * 250
+ * * ceil(satoshis-per-kbyte / 4)
*/
- LDKnativeRoutingFees *inner;
- bool is_owned;
-} LDKRoutingFees;
-
-typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
- struct LDKRoutingFees *result;
- struct LDKDecodeError *err;
-} LDKCResult_RoutingFeesDecodeErrorZPtr;
+ uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
+ void (*free)(void *this_arg);
+} LDKFeeEstimator;
-typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
- union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_RoutingFeesDecodeErrorZ;
+/**
+ * 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;
/**
- * Information received in the latest node_announcement from this node.
+ * 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 LDKNodeAnnouncementInfo {
+typedef struct MUST_USE_STRUCT LDKChannelManager {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeNodeAnnouncementInfo *inner;
+ LDKnativeChannelManager *inner;
bool is_owned;
-} LDKNodeAnnouncementInfo;
+} LDKChannelManager;
-typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
- struct LDKNodeAnnouncementInfo *result;
+typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager {
+ struct LDKThirtyTwoBytes a;
+ struct LDKChannelManager b;
+} LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager;
+
+typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager LDKC2Tuple_BlockHashChannelManagerZ;
+
+typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
+ struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager *result;
struct LDKDecodeError *err;
-} LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
+} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
-typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
- union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
+typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+ union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
bool result_ok;
-} LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
-
+} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
+typedef union LDKCResult_NetAddressu8ZPtr {
+ struct LDKNetAddress *result;
+ uint8_t *err;
+} LDKCResult_NetAddressu8ZPtr;
-/**
- * Details about a node in the network, known from the network announcement.
- */
-typedef struct MUST_USE_STRUCT LDKNodeInfo {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeNodeInfo *inner;
- bool is_owned;
-} LDKNodeInfo;
+typedef struct LDKCResult_NetAddressu8Z {
+ union LDKCResult_NetAddressu8ZPtr contents;
+ bool result_ok;
+} LDKCResult_NetAddressu8Z;
-typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
- struct LDKNodeInfo *result;
+typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
+ struct LDKCResult_NetAddressu8Z *result;
struct LDKDecodeError *err;
-} LDKCResult_NodeInfoDecodeErrorZPtr;
+} LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
-typedef struct LDKCResult_NodeInfoDecodeErrorZ {
- union LDKCResult_NodeInfoDecodeErrorZPtr contents;
+typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
+ union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
bool result_ok;
-} LDKCResult_NodeInfoDecodeErrorZ;
+} LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
+
+typedef struct LDKCVec_u64Z {
+ uint64_t *data;
+ uintptr_t datalen;
+} LDKCVec_u64Z;
/**
- * Represents the network as nodes and channels between them
+ * An update_add_htlc message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKNetworkGraph {
+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.
*/
- LDKnativeNetworkGraph *inner;
+ LDKnativeUpdateAddHTLC *inner;
bool is_owned;
-} LDKNetworkGraph;
-
-typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
- struct LDKNetworkGraph *result;
- struct LDKDecodeError *err;
-} LDKCResult_NetworkGraphDecodeErrorZPtr;
-
-typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
- union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_NetworkGraphDecodeErrorZ;
+} LDKUpdateAddHTLC;
-typedef struct LDKCVecTempl_SpendableOutputDescriptor {
- struct LDKSpendableOutputDescriptor *data;
+typedef struct LDKCVec_UpdateAddHTLCZ {
+ struct LDKUpdateAddHTLC *data;
uintptr_t datalen;
-} LDKCVecTempl_SpendableOutputDescriptor;
+} LDKCVec_UpdateAddHTLCZ;
+
-typedef struct 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).
+ * An update_fulfill_htlc message to be sent or received from a peer
*/
-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,
+typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
/**
- * 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.
*/
- LDKEvent_Sentinel,
-} LDKEvent_Tag;
-
-typedef struct LDKEvent_LDKFundingGenerationReady_Body {
- struct LDKThirtyTwoBytes temporary_channel_id;
- uint64_t channel_value_satoshis;
- LDKCVec_u8Z output_script;
- uint64_t user_channel_id;
-} LDKEvent_LDKFundingGenerationReady_Body;
-
-typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
- struct LDKOutPoint funding_txo;
- uint64_t user_channel_id;
-} LDKEvent_LDKFundingBroadcastSafe_Body;
-
-typedef struct LDKEvent_LDKPaymentReceived_Body {
- struct LDKThirtyTwoBytes payment_hash;
- struct LDKThirtyTwoBytes payment_secret;
- uint64_t amt;
-} LDKEvent_LDKPaymentReceived_Body;
-
-typedef struct LDKEvent_LDKPaymentSent_Body {
- struct LDKThirtyTwoBytes payment_preimage;
-} LDKEvent_LDKPaymentSent_Body;
+ LDKnativeUpdateFulfillHTLC *inner;
+ bool is_owned;
+} LDKUpdateFulfillHTLC;
-typedef struct LDKEvent_LDKPaymentFailed_Body {
- struct LDKThirtyTwoBytes payment_hash;
- bool rejected_by_dest;
-} LDKEvent_LDKPaymentFailed_Body;
+typedef struct LDKCVec_UpdateFulfillHTLCZ {
+ struct LDKUpdateFulfillHTLC *data;
+ uintptr_t datalen;
+} LDKCVec_UpdateFulfillHTLCZ;
-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 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;
+/**
+ * An update_fail_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
+ /**
+ * Nearly everywhere, 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;
+
+typedef struct LDKCVec_UpdateFailHTLCZ {
+ struct LDKUpdateFailHTLC *data;
+ uintptr_t datalen;
+} LDKCVec_UpdateFailHTLCZ;
/**
- * An accept_channel message to be sent or received from a peer
+ * An update_fail_malformed_htlc message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKAcceptChannel {
+typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeAcceptChannel *inner;
+ LDKnativeUpdateFailMalformedHTLC *inner;
bool is_owned;
-} LDKAcceptChannel;
+} LDKUpdateFailMalformedHTLC;
+
+typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
+ struct LDKUpdateFailMalformedHTLC *data;
+ uintptr_t datalen;
+} LDKCVec_UpdateFailMalformedHTLCZ;
/**
- * An open_channel message to be sent or received from a peer
+ * An Err type for failure to process messages.
*/
-typedef struct MUST_USE_STRUCT LDKOpenChannel {
+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.
*/
- LDKnativeOpenChannel *inner;
+ LDKnativeLightningError *inner;
bool is_owned;
-} LDKOpenChannel;
+} LDKLightningError;
+
+typedef union LDKCResult_boolLightningErrorZPtr {
+ bool *result;
+ struct LDKLightningError *err;
+} LDKCResult_boolLightningErrorZPtr;
+
+typedef struct LDKCResult_boolLightningErrorZ {
+ union LDKCResult_boolLightningErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_boolLightningErrorZ;
+
+typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
+ struct LDKChannelAnnouncement a;
+ struct LDKChannelUpdate b;
+ struct LDKChannelUpdate c;
+} LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
+
+typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
+
+typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
+ uintptr_t datalen;
+} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
+
+typedef struct LDKCVec_NodeAnnouncementZ {
+ struct LDKNodeAnnouncement *data;
+ uintptr_t datalen;
+} LDKCVec_NodeAnnouncementZ;
+
+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 LDKCResult_NoneLightningErrorZ {
+ union LDKCResult_NoneLightningErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NoneLightningErrorZ;
+
+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;
/**
- * A funding_created message to be sent or received from a peer
+ * An init message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKFundingCreated {
+typedef struct MUST_USE_STRUCT LDKInit {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeFundingCreated *inner;
+ LDKnativeInit *inner;
bool is_owned;
-} LDKFundingCreated;
+} 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;
/**
- * A funding_signed message to be sent or received from a peer
+ * A ping message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKFundingSigned {
+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.
*/
- LDKnativeFundingSigned *inner;
+ LDKnativePing *inner;
bool is_owned;
-} LDKFundingSigned;
+} 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;
/**
- * A funding_locked message to be sent or received from a peer
+ * A pong message to be sent or received from a peer
*/
-typedef struct MUST_USE_STRUCT LDKFundingLocked {
+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.
*/
- LDKnativeFundingLocked *inner;
+ LDKnativePong *inner;
bool is_owned;
-} LDKFundingLocked;
+} 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;
/**
- * An announcement_signatures message to be sent or received from a peer
+ * The unsigned part of a channel_update
*/
-typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
+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.
*/
- LDKnativeAnnouncementSignatures *inner;
+ LDKnativeUnsignedChannelUpdate *inner;
bool is_owned;
-} LDKAnnouncementSignatures;
+} 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_ErrorMessageDecodeErrorZPtr {
+ struct LDKErrorMessage *result;
+ struct LDKDecodeError *err;
+} LDKCResult_ErrorMessageDecodeErrorZPtr;
+
+typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
+ union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_ErrorMessageDecodeErrorZ;
/**
- * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
- * transaction updates if they were pending.
+ * The unsigned part of a node_announcement
*/
-typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
+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.
*/
- LDKnativeCommitmentUpdate *inner;
+ LDKnativeUnsignedNodeAnnouncement *inner;
bool is_owned;
-} LDKCommitmentUpdate;
+} 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_QueryShortChannelIdsDecodeErrorZPtr {
+ struct LDKQueryShortChannelIds *result;
+ struct LDKDecodeError *err;
+} LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
+
+typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
+ union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_QueryShortChannelIdsDecodeErrorZ;
/**
- * A revoke_and_ack message to be sent or received from a peer
+ * 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 LDKRevokeAndACK {
+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.
*/
- LDKnativeRevokeAndACK *inner;
+ LDKnativeReplyShortChannelIdsEnd *inner;
bool is_owned;
-} LDKRevokeAndACK;
+} LDKReplyShortChannelIdsEnd;
+
+typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
+ struct LDKReplyShortChannelIdsEnd *result;
+ struct LDKDecodeError *err;
+} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
+
+typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
+ union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
+
+typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
+ struct LDKQueryChannelRange *result;
+ struct LDKDecodeError *err;
+} LDKCResult_QueryChannelRangeDecodeErrorZPtr;
+
+typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
+ union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_QueryChannelRangeDecodeErrorZ;
/**
- * A closing_signed message to be sent or received from a peer
+ * 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 LDKClosingSigned {
+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.
*/
- LDKnativeClosingSigned *inner;
+ LDKnativeReplyChannelRange *inner;
bool is_owned;
-} LDKClosingSigned;
+} LDKReplyChannelRange;
+
+typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
+ struct LDKReplyChannelRange *result;
+ struct LDKDecodeError *err;
+} LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
+
+typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
+ union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_ReplyChannelRangeDecodeErrorZ;
/**
- * A shutdown message to be sent or received from a 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 struct MUST_USE_STRUCT LDKShutdown {
+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.
*/
- LDKnativeShutdown *inner;
+ LDKnativeGossipTimestampFilter *inner;
bool is_owned;
-} LDKShutdown;
+} LDKGossipTimestampFilter;
+
+typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
+ struct LDKGossipTimestampFilter *result;
+ struct LDKDecodeError *err;
+} LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
+
+typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
+ union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_GossipTimestampFilterDecodeErrorZ;
+
+typedef struct LDKCVec_PublicKeyZ {
+ struct LDKPublicKey *data;
+ uintptr_t datalen;
+} LDKCVec_PublicKeyZ;
/**
- * A node_announcement message to be sent or received from a peer
+ * 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).
*/
-typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
+typedef struct MUST_USE_STRUCT LDKPeerHandleError {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeNodeAnnouncement *inner;
+ LDKnativePeerHandleError *inner;
bool is_owned;
-} LDKNodeAnnouncement;
+} LDKPeerHandleError;
-/**
- * Used to put an error message in a LightningError
- */
-typedef enum LDKErrorAction_Tag {
- /**
- * The peer took some action which made us think they were useless. Disconnect them.
- */
- LDKErrorAction_DisconnectPeer,
- /**
- * The peer did something harmless that we weren't able to process, just log and ignore
- */
- LDKErrorAction_IgnoreError,
- /**
- * The peer did something incorrect. Tell them.
- */
- LDKErrorAction_SendErrorMessage,
+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
*/
- LDKErrorAction_Sentinel,
-} LDKErrorAction_Tag;
+ void *result;
+ struct LDKPeerHandleError *err;
+} LDKCResult_NonePeerHandleErrorZPtr;
-typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
- struct LDKErrorMessage msg;
-} LDKErrorAction_LDKDisconnectPeer_Body;
+typedef struct LDKCResult_NonePeerHandleErrorZ {
+ union LDKCResult_NonePeerHandleErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NonePeerHandleErrorZ;
-typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
- struct LDKErrorMessage msg;
-} LDKErrorAction_LDKSendErrorMessage_Body;
+typedef union LDKCResult_boolPeerHandleErrorZPtr {
+ bool *result;
+ struct LDKPeerHandleError *err;
+} LDKCResult_boolPeerHandleErrorZPtr;
-typedef struct MUST_USE_STRUCT LDKErrorAction {
- LDKErrorAction_Tag tag;
- union {
- LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
- LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
- };
-} LDKErrorAction;
+typedef struct LDKCResult_boolPeerHandleErrorZ {
+ union LDKCResult_boolPeerHandleErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_boolPeerHandleErrorZ;
-/**
- * The information we received from a peer along the route of a payment we originated. This is
- * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
- * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
- */
-typedef enum LDKHTLCFailChannelUpdate_Tag {
- /**
- * We received an error which included a full ChannelUpdate message.
- */
- LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
- /**
- * We received an error which indicated only that a channel has been closed
- */
- LDKHTLCFailChannelUpdate_ChannelClosed,
- /**
- * We received an error which indicated only that a node has failed
- */
- LDKHTLCFailChannelUpdate_NodeFailure,
- /**
- * Must be last for serialization purposes
- */
- LDKHTLCFailChannelUpdate_Sentinel,
-} LDKHTLCFailChannelUpdate_Tag;
+typedef union LDKCResult_SecretKeySecpErrorZPtr {
+ struct LDKSecretKey *result;
+ enum LDKSecp256k1Error *err;
+} LDKCResult_SecretKeySecpErrorZPtr;
-typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
- struct LDKChannelUpdate msg;
-} LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
+typedef struct LDKCResult_SecretKeySecpErrorZ {
+ union LDKCResult_SecretKeySecpErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_SecretKeySecpErrorZ;
-typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
- uint64_t short_channel_id;
- bool is_permanent;
-} LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
+typedef union LDKCResult_PublicKeySecpErrorZPtr {
+ struct LDKPublicKey *result;
+ enum LDKSecp256k1Error *err;
+} LDKCResult_PublicKeySecpErrorZPtr;
+
+typedef struct LDKCResult_PublicKeySecpErrorZ {
+ union LDKCResult_PublicKeySecpErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_PublicKeySecpErrorZ;
-typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
- struct LDKPublicKey node_id;
- bool is_permanent;
-} LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
-typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
- LDKHTLCFailChannelUpdate_Tag tag;
- union {
- LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
- LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
- LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
- };
-} 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.
- */
-typedef enum LDKMessageSendEvent_Tag {
- /**
- * Used to indicate that we've accepted a channel open and should send the accept_channel
- * message provided to the given peer.
- */
- LDKMessageSendEvent_SendAcceptChannel,
- /**
- * Used to indicate that we've initiated a channel open and should send the open_channel
- * message provided to the given peer.
- */
- LDKMessageSendEvent_SendOpenChannel,
- /**
- * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendFundingCreated,
- /**
- * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendFundingSigned,
- /**
- * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendFundingLocked,
- /**
- * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendAnnouncementSignatures,
- /**
- * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
- * message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_UpdateHTLCs,
- /**
- * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendRevokeAndACK,
- /**
- * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendClosingSigned,
- /**
- * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendShutdown,
- /**
- * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
- */
- LDKMessageSendEvent_SendChannelReestablish,
- /**
- * Used to indicate that a channel_announcement and channel_update should be broadcast to all
- * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
- *
- * Note that after doing so, you very likely (unless you did so very recently) want to call
- * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
- * This ensures that any nodes which see our channel_announcement also have a relevant
- * node_announcement, including relevant feature flags which may be important for routing
- * through or to us.
- */
- LDKMessageSendEvent_BroadcastChannelAnnouncement,
- /**
- * Used to indicate that a node_announcement should be broadcast to all peers.
- */
- LDKMessageSendEvent_BroadcastNodeAnnouncement,
- /**
- * Used to indicate that a channel_update should be broadcast to all peers.
- */
- LDKMessageSendEvent_BroadcastChannelUpdate,
+ * 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 {
/**
- * Broadcast an error downstream to be handled
+ * Nearly everywhere, 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_HandleError,
+ LDKnativeTxCreationKeys *inner;
+ bool is_owned;
+} LDKTxCreationKeys;
+
+typedef union LDKCResult_TxCreationKeysSecpErrorZPtr {
+ struct LDKTxCreationKeys *result;
+ enum LDKSecp256k1Error *err;
+} LDKCResult_TxCreationKeysSecpErrorZPtr;
+
+typedef struct LDKCResult_TxCreationKeysSecpErrorZ {
+ union LDKCResult_TxCreationKeysSecpErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_TxCreationKeysSecpErrorZ;
+
+
+
+/**
+ * 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 {
/**
- * When a payment fails we may receive updates back from the hop where it failed. In such
- * cases this event is generated so that we can inform the network graph of this information.
+ * Nearly everywhere, 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_PaymentFailureNetworkUpdate,
+ LDKnativeTrustedCommitmentTransaction *inner;
+ bool is_owned;
+} LDKTrustedCommitmentTransaction;
+
+typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
+ struct LDKTrustedCommitmentTransaction *result;
/**
- * Query a peer for channels with funding transaction UTXOs in a block range.
+ * Note that this value is always NULL, as there are no contents in the Err variant
*/
- LDKMessageSendEvent_SendChannelRangeQuery,
+ void *err;
+} LDKCResult_TrustedCommitmentTransactionNoneZPtr;
+
+typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
+ union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
+ bool result_ok;
+} LDKCResult_TrustedCommitmentTransactionNoneZ;
+
+
+
+/**
+ * A hop in a route
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHop {
/**
- * Request routing gossip messages from a peer for a list of channels identified by
- * their short_channel_ids.
+ * Nearly everywhere, 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_SendShortIdsQuery,
+ 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;
+
+
+
+/**
+ * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
+ * it can take multiple paths. Each path is composed of one or more hops through the network.
+ */
+typedef struct MUST_USE_STRUCT LDKRoute {
/**
- * Must be last for serialization purposes
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKMessageSendEvent_Sentinel,
-} LDKMessageSendEvent_Tag;
+ LDKnativeRoute *inner;
+ bool is_owned;
+} LDKRoute;
-typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
- struct LDKPublicKey node_id;
- struct LDKAcceptChannel msg;
-} LDKMessageSendEvent_LDKSendAcceptChannel_Body;
+typedef union LDKCResult_RouteDecodeErrorZPtr {
+ struct LDKRoute *result;
+ struct LDKDecodeError *err;
+} LDKCResult_RouteDecodeErrorZPtr;
-typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
- struct LDKPublicKey node_id;
- struct LDKOpenChannel msg;
-} LDKMessageSendEvent_LDKSendOpenChannel_Body;
+typedef struct LDKCResult_RouteDecodeErrorZ {
+ union LDKCResult_RouteDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_RouteDecodeErrorZ;
-typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
- struct LDKPublicKey node_id;
- struct LDKFundingCreated msg;
-} LDKMessageSendEvent_LDKSendFundingCreated_Body;
-typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
- struct LDKPublicKey node_id;
- struct LDKFundingSigned msg;
-} LDKMessageSendEvent_LDKSendFundingSigned_Body;
-typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
- struct LDKPublicKey node_id;
- struct LDKFundingLocked msg;
-} LDKMessageSendEvent_LDKSendFundingLocked_Body;
+/**
+ * A channel descriptor which provides a last-hop route to get_route
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHint {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRouteHint *inner;
+ bool is_owned;
+} LDKRouteHint;
-typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
- struct LDKPublicKey node_id;
- struct LDKAnnouncementSignatures msg;
-} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
+typedef struct LDKCVec_RouteHintZ {
+ struct LDKRouteHint *data;
+ uintptr_t datalen;
+} LDKCVec_RouteHintZ;
-typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
- struct LDKPublicKey node_id;
- struct LDKCommitmentUpdate updates;
-} LDKMessageSendEvent_LDKUpdateHTLCs_Body;
+typedef union LDKCResult_RouteLightningErrorZPtr {
+ struct LDKRoute *result;
+ struct LDKLightningError *err;
+} LDKCResult_RouteLightningErrorZPtr;
-typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
- struct LDKPublicKey node_id;
- struct LDKRevokeAndACK msg;
-} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
+typedef struct LDKCResult_RouteLightningErrorZ {
+ union LDKCResult_RouteLightningErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_RouteLightningErrorZ;
-typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
- struct LDKPublicKey node_id;
- struct LDKClosingSigned msg;
-} LDKMessageSendEvent_LDKSendClosingSigned_Body;
-typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
- struct LDKPublicKey node_id;
- struct LDKShutdown msg;
-} LDKMessageSendEvent_LDKSendShutdown_Body;
-typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
- struct LDKPublicKey node_id;
- struct LDKChannelReestablish msg;
-} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
+/**
+ * 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;
-typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
- struct LDKChannelAnnouncement msg;
- struct LDKChannelUpdate update_msg;
-} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
+typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
+ struct LDKRoutingFees *result;
+ struct LDKDecodeError *err;
+} LDKCResult_RoutingFeesDecodeErrorZPtr;
-typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
- struct LDKNodeAnnouncement msg;
-} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
+typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
+ union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_RoutingFeesDecodeErrorZ;
-typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
- struct LDKChannelUpdate msg;
-} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
-typedef struct LDKMessageSendEvent_LDKHandleError_Body {
- struct LDKPublicKey node_id;
- struct LDKErrorAction action;
-} LDKMessageSendEvent_LDKHandleError_Body;
-typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
- struct LDKHTLCFailChannelUpdate update;
-} LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
+/**
+ * Information received in the latest node_announcement from this node.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeNodeAnnouncementInfo *inner;
+ bool is_owned;
+} LDKNodeAnnouncementInfo;
-typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
- struct LDKPublicKey node_id;
- struct LDKQueryChannelRange msg;
-} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
+typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
+ struct LDKNodeAnnouncementInfo *result;
+ struct LDKDecodeError *err;
+} LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
-typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
- struct LDKPublicKey node_id;
- struct LDKQueryShortChannelIds msg;
-} LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
+typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
+ union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
-typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
- LDKMessageSendEvent_Tag tag;
- union {
- LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
- LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
- LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
- LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
- LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
- LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
- LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
- LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
- LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
- LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
- LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
- LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
- LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
- LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
- LDKMessageSendEvent_LDKHandleError_Body handle_error;
- LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
- LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
- LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
- };
-} LDKMessageSendEvent;
-typedef struct LDKCVecTempl_MessageSendEvent {
- struct LDKMessageSendEvent *data;
- uintptr_t datalen;
-} LDKCVecTempl_MessageSendEvent;
-typedef struct LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ;
+/**
+ * Details about a node in the network, known from the network announcement.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeInfo {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeNodeInfo *inner;
+ bool is_owned;
+} LDKNodeInfo;
+
+typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
+ struct LDKNodeInfo *result;
+ struct LDKDecodeError *err;
+} LDKCResult_NodeInfoDecodeErrorZPtr;
+
+typedef struct LDKCResult_NodeInfoDecodeErrorZ {
+ union LDKCResult_NodeInfoDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NodeInfoDecodeErrorZ;
+
+
+
+/**
+ * Represents the network as nodes and channels between them
+ */
+typedef struct MUST_USE_STRUCT LDKNetworkGraph {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeNetworkGraph *inner;
+ bool is_owned;
+} LDKNetworkGraph;
+
+typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
+ struct LDKNetworkGraph *result;
+ struct LDKDecodeError *err;
+} LDKCResult_NetworkGraphDecodeErrorZPtr;
+
+typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
+ union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NetworkGraphDecodeErrorZ;
/**
* A trait indicating an object may generate message send events
* 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);
+ struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
void (*free)(void *this_arg);
} LDKMessageSendEventsProvider;
-typedef struct LDKCVecTempl_Event {
- struct LDKEvent *data;
- uintptr_t datalen;
-} LDKCVecTempl_Event;
-
-typedef struct LDKCVecTempl_Event LDKCVec_EventZ;
-
/**
* A trait indicating an object may generate events
*/
* Gets the list of pending events which were generated by previous actions, clearing the list
* in the process.
*/
- LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
+ struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
void (*free)(void *this_arg);
} LDKEventsProvider;
bool is_owned;
} LDKChainMonitor;
-typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction {
- struct LDKC2TupleTempl_usize__Transaction *data;
- uintptr_t datalen;
-} LDKCVecTempl_C2TupleTempl_usize__Transaction;
-
-typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ;
-
/**
bool is_owned;
} LDKHTLCUpdate;
-typedef struct LDKCVecTempl_Transaction {
- struct LDKTransaction *data;
- uintptr_t datalen;
-} LDKCVecTempl_Transaction;
-
-typedef struct LDKCVecTempl_Transaction LDKCVec_TransactionZ;
-
-typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
- struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut *data;
- uintptr_t datalen;
-} LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
-
-typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
-
/**
-/**
- * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
- */
-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.
- */
- LDKnativeChannelDetails *inner;
- bool is_owned;
-} LDKChannelDetails;
-
-
-
/**
* Features used within an `init` message.
*/
bool is_owned;
} LDKInitFeatures;
-typedef struct LDKCVecTempl_ChannelDetails {
- struct LDKChannelDetails *data;
- uintptr_t datalen;
-} LDKCVecTempl_ChannelDetails;
-
-typedef struct LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ;
-
typedef struct LDKThreeBytes {
uint8_t data[3];
} LDKThreeBytes;
-typedef struct LDKCVecTempl_NetAddress {
- struct LDKNetAddress *data;
- uintptr_t datalen;
-} LDKCVecTempl_NetAddress;
-
-typedef struct LDKCVecTempl_NetAddress LDKCVec_NetAddressZ;
-
-
-
-/**
- * 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;
-
-
-
-/**
- * An update_fulfill_htlc message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
- /**
- * Nearly everywhere, 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;
- bool is_owned;
-} LDKUpdateFulfillHTLC;
-
-
-
-/**
- * An update_fail_htlc message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
- /**
- * Nearly everywhere, 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;
-
-
-
-/**
- * An update_fail_malformed_htlc message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeUpdateFailMalformedHTLC *inner;
- bool is_owned;
-} LDKUpdateFailMalformedHTLC;
-
/**
bool is_owned;
} LDKChannelManagerReadArgs;
-typedef struct LDKCVecTempl_ChannelMonitor {
- struct LDKChannelMonitor *data;
- uintptr_t datalen;
-} LDKCVecTempl_ChannelMonitor;
-
-typedef struct LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
-
/**
bool is_owned;
} LDKChannelFeatures;
-typedef struct LDKCVecTempl_u64 {
- uint64_t *data;
- uintptr_t datalen;
-} LDKCVecTempl_u64;
-
-typedef struct LDKCVecTempl_u64 LDKCVec_u64Z;
-
-typedef struct LDKCVecTempl_UpdateAddHTLC {
- struct LDKUpdateAddHTLC *data;
- uintptr_t datalen;
-} LDKCVecTempl_UpdateAddHTLC;
-
-typedef struct LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ;
-
-typedef struct LDKCVecTempl_UpdateFulfillHTLC {
- struct LDKUpdateFulfillHTLC *data;
- uintptr_t datalen;
-} LDKCVecTempl_UpdateFulfillHTLC;
-
-typedef struct LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ;
-
-typedef struct LDKCVecTempl_UpdateFailHTLC {
- struct LDKUpdateFailHTLC *data;
- uintptr_t datalen;
-} LDKCVecTempl_UpdateFailHTLC;
-
-typedef struct LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ;
-
-typedef struct LDKCVecTempl_UpdateFailMalformedHTLC {
- struct LDKUpdateFailMalformedHTLC *data;
- uintptr_t datalen;
-} LDKCVecTempl_UpdateFailMalformedHTLC;
-
-typedef struct LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ;
-
-typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
- struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
- uintptr_t datalen;
-} LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
-
-typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
-
-typedef struct LDKCVecTempl_NodeAnnouncement {
- struct LDKNodeAnnouncement *data;
- uintptr_t datalen;
-} LDKCVecTempl_NodeAnnouncement;
-
-typedef struct LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ;
-
/**
* A trait to describe an object which can receive routing messages.
*
* 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);
+ 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 <PublicKey as Ord>::cmp) than starting_point.
* If None is provided for starting_point, we start at the first node.
*/
- LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
+ 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
bool is_owned;
} LDKPeerManager;
-typedef struct LDKCVecTempl_PublicKey {
- struct LDKPublicKey *data;
- uintptr_t datalen;
-} LDKCVecTempl_PublicKey;
-
-typedef struct LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ;
-
/**
-/**
- * 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 LDKCVecTempl_RouteHop {
- struct LDKRouteHop *data;
- uintptr_t datalen;
-} LDKCVecTempl_RouteHop;
-
-typedef struct LDKCVecTempl_CVecTempl_RouteHop {
- struct LDKCVecTempl_RouteHop *data;
- uintptr_t datalen;
-} LDKCVecTempl_CVecTempl_RouteHop;
-
-typedef struct LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ;
-
-
-
-/**
- * A channel descriptor which provides a last-hop route to get_route
- */
-typedef struct MUST_USE_STRUCT LDKRouteHint {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeRouteHint *inner;
- bool is_owned;
-} LDKRouteHint;
-
-typedef struct LDKCVecTempl_RouteHint {
- struct LDKRouteHint *data;
- uintptr_t datalen;
-} LDKCVecTempl_RouteHint;
-
-typedef struct LDKCVecTempl_RouteHint LDKCVec_RouteHintZ;
-
-
-
/**
* A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
* This exists only to make accessing a RwLock<NetworkGraph> possible from
bool is_owned;
} LDKChannelInfo;
-typedef struct LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
-
-extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
-
-extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ);
-
-extern const void (*CVec_EventZ_free)(LDKCVec_EventZ);
-
extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ);
-extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ);
-
-extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ);
-
extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
-extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
-
extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ);
-extern const void (*CVec_C2Tuple_u32TxOutZZ_free)(LDKCVec_C2Tuple_u32TxOutZZ);
-
extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ);
-extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ);
-
extern const void (*C2Tuple_BlockHashChannelMonitorZ_free)(LDKC2Tuple_BlockHashChannelMonitorZ);
extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
-extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ);
-
extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
-extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ);
-
-extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ);
-
-extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ);
-
extern const void (*C2Tuple_BlockHashChannelManagerZ_free)(LDKC2Tuple_BlockHashChannelManagerZ);
-extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
-
-extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
-
-extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ);
-
-extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
-
-extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ);
-
extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
-extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
-
-extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ);
-
-extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ);
-
-extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
-
-extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ);
-
-extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
-
-extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ);
-
extern const uintptr_t MAX_BUF_SIZE;
extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
void TxOut_free(struct LDKTxOut _res);
+void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
+
+void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
+
+void CVec_EventZ_free(struct LDKCVec_EventZ _res);
+
LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
+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);
+void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
+
struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
-LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, LDKCVec_u8Z b);
+LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
+
+void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
-LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b);
+void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
+
+LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
+
+void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
-LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, LDKCVec_SignatureZ b);
+void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
-struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2TupleTempl_Signature__CVecTempl_Signature o);
+LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
+
+struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2TupleTempl_Signature__CVec_SignatureZ o);
struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
-struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVecTempl_Signature o);
+struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
+void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
+
struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
+void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
+
+void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
+
LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager o);
void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
+void CVec_u64Z_free(struct LDKCVec_u64Z _res);
+
+void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
+
+void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
+
+void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
+
+void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
+
struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
+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_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
-struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVecTempl_u8 o);
+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_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
+void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
+
+void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
+
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);
+void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
+
struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
-LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
+struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
-LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser);
* [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
* [`chain::Filter`]: ../trait.Filter.html
*/
-void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
+void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
/**
* Dispatches to per-channel monitors, which are responsible for updating their on-chain view
*/
void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
-LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
-LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
+struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser);
void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
-LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
/**
* Updates a ChannelMonitor on the basis of some new information provided by the Channel
*
* [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
*/
-MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
/**
* Gets the list of pending events which were generated by previous actions, clearing the list
* EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
* no internal locking in ChannelMonitors.
*/
-MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
/**
* Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
* out-of-band the other node operator to coordinate with him if option is available to you.
* In any-case, choice is up to the user.
*/
-MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
+MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
/**
* Processes transactions in a newly connected block, which may result in any of the following:
*
* [`get_outputs_to_watch`]: #method.get_outputs_to_watch
*/
-MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
+MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
/**
* Determines if the disconnected block contained any transactions of interest and updates
*/
MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
-LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
+struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
struct LDKOutPoint OutPoint_read(struct LDKu8slice ser);
struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
-LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
+struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
-LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
+struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser);
* Gets the list of open channels, in random order. See ChannelDetail field documentation for
* more information.
*/
-MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
* Gets the list of usable channels, in random order. Useful as an argument to
* These are guaranteed to have their is_live value set to true, see the documentation for
* ChannelDetails::is_live for more info on exactly what the criteria are.
*/
-MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
* Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
*
* Panics if addresses is absurdly large (more than 500).
*/
-void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses);
+void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
/**
* Processes HTLCs which are pending waiting on random forward delay.
/**
* Updates channel state based on transactions seen in a connected block.
*/
-void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
+void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
/**
* Updates channel state based on a disconnected block.
struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
-LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr);
* HashMap for you. This is primarily useful for C bindings where it is not practical to
* populate a HashMap directly from C.
*/
-MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, LDKCVec_ChannelMonitorZ channel_monitors);
+MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors);
struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
* or printed to stdout). Otherwise, a well crafted error message may trigger a security
* vulnerability in the terminal emulator or the logging subsystem.
*/
-void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
+void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
-MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg);
+MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
void Ping_free(struct LDKPing this_ptr);
* The destination of this peer's funds on closing.
* Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
*/
-void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
+void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
-MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg);
+MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
void ClosingSigned_free(struct LDKClosingSigned this_ptr);
/**
* Signatures on the HTLC transactions
*/
-void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val);
+void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
-MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
+MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr);
struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
-LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
+struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
/**
* List of addresses on which this node is reachable
*/
-void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val);
+void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr);
/**
* The short_channel_ids in the channel range
*/
-void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
+void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
-MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, LDKCVec_u64Z short_channel_ids_arg);
+MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, struct LDKCVec_u64Z short_channel_ids_arg);
void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr);
/**
* The short_channel_ids that are being queried
*/
-void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
+void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
-MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg);
+MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr);
/**
* A human-readable message describing the error
*/
-void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
+void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
/**
* The action which should be taken against the offending peer.
*/
void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
-MUST_USE_RES struct LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
+MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr);
/**
* update_add_htlc messages which should be sent
*/
-void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateAddHTLCZ val);
+void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
/**
* update_fulfill_htlc messages which should be sent
*/
-void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFulfillHTLCZ val);
+void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
/**
* update_fail_htlc messages which should be sent
*/
-void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailHTLCZ val);
+void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
/**
* update_fail_malformed_htlc messages which should be sent
*/
-void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val);
+void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
/**
* An update_fee message which should be sent
*/
void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
-MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg);
+MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg);
void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
*/
void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
-LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
+struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser);
-LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
+struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser);
-LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
-LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
+struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser);
-LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
+struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser);
-LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
+struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser);
-LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
+struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser);
-LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
+struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser);
-LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
+struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
-LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
+struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser);
-LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
+struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser);
-LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
+struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
struct LDKShutdown Shutdown_read(struct LDKu8slice ser);
-LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
+struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser);
-LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
+struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
-LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
+struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser);
-LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
+struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser);
-LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
+struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser);
-LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
+struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
-LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
+struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
-LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
+struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
-LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser);
-LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
+struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
-LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser);
-LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
+struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
-LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
+struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
-LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
+struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser);
struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
-LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
+struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
-LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
+struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
-LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
+struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
-LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
+struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
-LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
+struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
void MessageHandler_free(struct LDKMessageHandler this_ptr);
* new_outbound_connection, however entries will only appear once the initial handshake has
* completed and we are sure the remote peer has the private key for the given node_id.
*/
-MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
/**
* Indicates a new outbound connection has been established to a node with the given node_id.
MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg);
-LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
+struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser);
MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg);
-LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser);
* key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
* Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
*/
-LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
+struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr);
*/
void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
-LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
+struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser);
* Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
* does not need to have its previous_output_index filled.
*/
-LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
+struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
/**
* Gets the redeemscript for a funding output from the two funding public keys.
* Note that the order of funding public keys does not matter.
*/
-LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
+struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
/**
* panics if htlc.transaction_output_index.is_none()!
*/
MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
-LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
+struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
-LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser);
/**
* All non-dust counterparty HTLC signatures, in the order they appear in the transaction
*/
-void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val);
+void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
-LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
+struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser);
* Create a new holder transaction with the given counterparty signatures.
* The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
*/
-MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
+MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr);
MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
-LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
+struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser);
struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
-LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
+struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser);
* given path is variable, keeping the length of any path to less than 20 should currently
* ensure it is viable.
*/
-void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, LDKCVec_CVec_RouteHopZZ val);
+void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
-MUST_USE_RES struct LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg);
+MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
-LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
+struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
* 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.
*/
-struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, LDKCVec_ChannelDetailsZ *first_hops, LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
+struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
*/
void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
-LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
+struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser);
*/
void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
-LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
+struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser);
struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
-LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
+struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr);
/**
* Internet-level addresses via which one can connect to the node
*/
-void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val);
+void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
/**
* An initial announcement of the node
*/
void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
-MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
+MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
-LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
+struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
/**
* All valid channels a node has announced
*/
-void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
+void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
/**
* Lowest fees enabling routing via any of the enabled, known channels to a node.
*/
void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
-MUST_USE_RES struct LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
+MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
-LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
+struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
-LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
+struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);