#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
-#include <stdlib.h>
+
/**
* An error when accessing the chain via [`Access`].
LDKNetwork_Bitcoin,
LDKNetwork_Testnet,
LDKNetwork_Regtest,
+ LDKNetwork_Signet,
/**
* Must be last for serialization purposes
*/
LDKSecp256k1Error_InvalidSecretKey,
LDKSecp256k1Error_InvalidRecoveryId,
LDKSecp256k1Error_InvalidTweak,
+ LDKSecp256k1Error_TweakCheckFailed,
LDKSecp256k1Error_NotEnoughMemory,
- LDKSecp256k1Error_CallbackPanicked,
/**
* Must be last for serialization purposes
*/
bool result_ok;
} LDKCResult_CVec_SignatureZNoneZ;
-typedef struct LDKCVec_PublicKeyZ {
- struct LDKPublicKey *data;
- uintptr_t datalen;
-} LDKCVec_PublicKeyZ;
-
-
-
-/**
- * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
- * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
- * descriptor.
- */
-typedef struct MUST_USE_STRUCT LDKPeerHandleError {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativePeerHandleError *inner;
- bool is_owned;
-} LDKPeerHandleError;
-
-typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
- struct LDKCVec_u8Z *result;
- struct LDKPeerHandleError *err;
-} LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
-
-typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
- union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
- bool result_ok;
-} LDKCResult_CVec_u8ZPeerHandleErrorZ;
-
-typedef union LDKCResult_NonePeerHandleErrorZPtr {
- /**
- * Note that this value is always NULL, as there are no contents in the OK variant
- */
- void *result;
- struct LDKPeerHandleError *err;
-} LDKCResult_NonePeerHandleErrorZPtr;
-
-typedef struct LDKCResult_NonePeerHandleErrorZ {
- union LDKCResult_NonePeerHandleErrorZPtr contents;
- bool result_ok;
-} LDKCResult_NonePeerHandleErrorZ;
-
-typedef union LDKCResult_boolPeerHandleErrorZPtr {
- bool *result;
- struct LDKPeerHandleError *err;
-} LDKCResult_boolPeerHandleErrorZPtr;
-
-typedef struct LDKCResult_boolPeerHandleErrorZ {
- union LDKCResult_boolPeerHandleErrorZPtr contents;
- bool result_ok;
-} LDKCResult_boolPeerHandleErrorZ;
-
-
-
-/**
- * Features used within an `init` message.
- */
-typedef struct MUST_USE_STRUCT LDKInitFeatures {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeInitFeatures *inner;
- bool is_owned;
-} LDKInitFeatures;
-
-typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
- struct LDKInitFeatures *result;
- struct LDKDecodeError *err;
-} LDKCResult_InitFeaturesDecodeErrorZPtr;
-
-typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
- union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_InitFeaturesDecodeErrorZ;
-
-
-
-/**
- * Features used within a `node_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKNodeFeatures {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeNodeFeatures *inner;
- bool is_owned;
-} LDKNodeFeatures;
-
-typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
- struct LDKNodeFeatures *result;
- struct LDKDecodeError *err;
-} LDKCResult_NodeFeaturesDecodeErrorZPtr;
-
-typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
- union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_NodeFeaturesDecodeErrorZ;
-
-
-
-/**
- * Features used within a `channel_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKChannelFeatures {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeChannelFeatures *inner;
- bool is_owned;
-} LDKChannelFeatures;
-
-typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
- struct LDKChannelFeatures *result;
- struct LDKDecodeError *err;
-} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
-
-typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
- union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_ChannelFeaturesDecodeErrorZ;
-
-
-
-/**
- * Options which apply on a per-channel basis and may change at runtime or based on negotiation
- * with our counterparty.
- */
-typedef struct MUST_USE_STRUCT LDKChannelConfig {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeChannelConfig *inner;
- bool is_owned;
-} LDKChannelConfig;
-
-typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
- struct LDKChannelConfig *result;
- struct LDKDecodeError *err;
-} LDKCResult_ChannelConfigDecodeErrorZPtr;
-
-typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
- union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
- bool result_ok;
-} LDKCResult_ChannelConfigDecodeErrorZ;
-
-
-
-/**
- * An Err type for failure to process messages.
- */
-typedef struct MUST_USE_STRUCT LDKLightningError {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeLightningError *inner;
- bool is_owned;
-} LDKLightningError;
-
-typedef union LDKCResult_boolLightningErrorZPtr {
- bool *result;
- struct LDKLightningError *err;
-} LDKCResult_boolLightningErrorZPtr;
-
-typedef struct LDKCResult_boolLightningErrorZ {
- union LDKCResult_boolLightningErrorZPtr contents;
- bool result_ok;
-} LDKCResult_boolLightningErrorZ;
-
-
-
-/**
- * A channel_announcement message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeChannelAnnouncement *inner;
- bool is_owned;
-} LDKChannelAnnouncement;
-
-
-
-/**
- * A channel_update message to be sent or received from a peer
- */
-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.
- */
- LDKnativeChannelUpdate *inner;
- bool is_owned;
-} LDKChannelUpdate;
-
-typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- struct LDKChannelAnnouncement a;
- struct LDKChannelUpdate b;
- struct LDKChannelUpdate c;
-} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
-
-typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
- uintptr_t datalen;
-} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
-
-
-
-/**
- * A node_announcement message to be sent or received from a peer
- */
-typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeNodeAnnouncement *inner;
- bool is_owned;
-} LDKNodeAnnouncement;
-
-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;
-
/**
+/**
+ * A channel_announcement message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelAnnouncement *inner;
+ bool is_owned;
+} LDKChannelAnnouncement;
+
+
+
+/**
+ * A channel_update message to be sent or received from a peer
+ */
+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.
+ */
+ LDKnativeChannelUpdate *inner;
+ bool is_owned;
+} LDKChannelUpdate;
+
+
+
+/**
+ * A node_announcement message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeNodeAnnouncement *inner;
+ bool is_owned;
+} LDKNodeAnnouncement;
+
+
+
/**
* An error message to be sent or received from a peer
*/
struct LDKCommitmentUpdate updates;
} LDKMessageSendEvent_LDKUpdateHTLCs_Body;
-typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
- struct LDKPublicKey node_id;
- struct LDKRevokeAndACK msg;
-} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
+typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
+ struct LDKPublicKey node_id;
+ struct LDKRevokeAndACK msg;
+} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
+ struct LDKPublicKey node_id;
+ struct LDKClosingSigned msg;
+} LDKMessageSendEvent_LDKSendClosingSigned_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
+ struct LDKPublicKey node_id;
+ struct LDKShutdown msg;
+} LDKMessageSendEvent_LDKSendShutdown_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
+ struct LDKPublicKey node_id;
+ struct LDKChannelReestablish msg;
+} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
+
+typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
+ struct LDKChannelAnnouncement msg;
+ struct LDKChannelUpdate update_msg;
+} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
+
+typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
+ struct LDKNodeAnnouncement msg;
+} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
+
+typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
+ struct LDKChannelUpdate msg;
+} 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;
+
+typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
+ struct LDKPublicKey node_id;
+ struct LDKQueryChannelRange msg;
+} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
+ struct LDKPublicKey node_id;
+ struct LDKQueryShortChannelIds msg;
+} LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
+
+typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
+ LDKMessageSendEvent_Tag tag;
+ union {
+ LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
+ 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 LDKCVec_MessageSendEventZ {
+ struct LDKMessageSendEvent *data;
+ uintptr_t datalen;
+} LDKCVec_MessageSendEventZ;
+
+
+
+/**
+ * An Err type for failure to process messages.
+ */
+typedef struct MUST_USE_STRUCT LDKLightningError {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeLightningError *inner;
+ bool is_owned;
+} LDKLightningError;
+
+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 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ struct LDKChannelAnnouncement a;
+ struct LDKChannelUpdate b;
+ struct LDKChannelUpdate c;
+} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
+
+typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
+ uintptr_t datalen;
+} 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 struct LDKCVec_PublicKeyZ {
+ struct LDKPublicKey *data;
+ uintptr_t datalen;
+} LDKCVec_PublicKeyZ;
+
+
+
+/**
+ * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
+ * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
+ * descriptor.
+ */
+typedef struct MUST_USE_STRUCT LDKPeerHandleError {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativePeerHandleError *inner;
+ bool is_owned;
+} LDKPeerHandleError;
+
+typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
+ struct LDKCVec_u8Z *result;
+ struct LDKPeerHandleError *err;
+} LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
+
+typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
+ union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_CVec_u8ZPeerHandleErrorZ;
+
+typedef union LDKCResult_NonePeerHandleErrorZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ struct LDKPeerHandleError *err;
+} LDKCResult_NonePeerHandleErrorZPtr;
+
+typedef struct LDKCResult_NonePeerHandleErrorZ {
+ union LDKCResult_NonePeerHandleErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NonePeerHandleErrorZ;
+
+typedef union LDKCResult_boolPeerHandleErrorZPtr {
+ bool *result;
+ struct LDKPeerHandleError *err;
+} LDKCResult_boolPeerHandleErrorZPtr;
+
+typedef struct LDKCResult_boolPeerHandleErrorZ {
+ union LDKCResult_boolPeerHandleErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_boolPeerHandleErrorZ;
+
+
+
+/**
+ * Features used within an `init` message.
+ */
+typedef struct MUST_USE_STRUCT LDKInitFeatures {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeInitFeatures *inner;
+ bool is_owned;
+} LDKInitFeatures;
+
+typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
+ struct LDKInitFeatures *result;
+ struct LDKDecodeError *err;
+} LDKCResult_InitFeaturesDecodeErrorZPtr;
+
+typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
+ union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_InitFeaturesDecodeErrorZ;
+
-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;
+/**
+ * Features used within a `node_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeFeatures {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeNodeFeatures *inner;
+ bool is_owned;
+} LDKNodeFeatures;
-typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
- struct LDKPublicKey node_id;
- struct LDKChannelReestablish msg;
-} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
+typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
+ struct LDKNodeFeatures *result;
+ struct LDKDecodeError *err;
+} LDKCResult_NodeFeaturesDecodeErrorZPtr;
-typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
- struct LDKChannelAnnouncement msg;
- struct LDKChannelUpdate update_msg;
-} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
+typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
+ union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NodeFeaturesDecodeErrorZ;
-typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
- struct LDKNodeAnnouncement msg;
-} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
-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;
+/**
+ * Features used within a `channel_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelFeatures {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelFeatures *inner;
+ bool is_owned;
+} LDKChannelFeatures;
-typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
- struct LDKHTLCFailChannelUpdate update;
-} LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
+typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
+ struct LDKChannelFeatures *result;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
-typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
- struct LDKPublicKey node_id;
- struct LDKQueryChannelRange msg;
-} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
+typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
+ union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_ChannelFeaturesDecodeErrorZ;
-typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
- struct LDKPublicKey node_id;
- struct LDKQueryShortChannelIds msg;
-} LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
-typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
- LDKMessageSendEvent_Tag tag;
- union {
- LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
- LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
- LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
- LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
- LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
- LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
- LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
- LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
- LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
- LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
- LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
- LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
- LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
- LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
- LDKMessageSendEvent_LDKHandleError_Body handle_error;
- LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
- LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
- LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
- };
-} LDKMessageSendEvent;
-typedef struct LDKCVec_MessageSendEventZ {
- struct LDKMessageSendEvent *data;
- uintptr_t datalen;
-} LDKCVec_MessageSendEventZ;
+/**
+ * Options which apply on a per-channel basis and may change at runtime or based on negotiation
+ * with our counterparty.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelConfig {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelConfig *inner;
+ bool is_owned;
+} LDKChannelConfig;
+
+typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
+ struct LDKChannelConfig *result;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelConfigDecodeErrorZPtr;
+
+typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
+ union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_ChannelConfigDecodeErrorZ;
/**
- * An event to be processed by the ChannelManager.
+ * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
+ * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
+ * preimage claim backward will lead to loss of funds.
+ *
+ * [`chain::Watch`]: ../trait.Watch.html
*/
-typedef struct MUST_USE_STRUCT LDKMonitorEvent {
+typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeMonitorEvent *inner;
+ LDKnativeHTLCUpdate *inner;
bool is_owned;
-} LDKMonitorEvent;
-
-typedef struct LDKCVec_MonitorEventZ {
- struct LDKMonitorEvent *data;
- uintptr_t datalen;
-} LDKCVec_MonitorEventZ;
+} LDKHTLCUpdate;
bool is_owned;
} LDKOutPoint;
+/**
+ * An event to be processed by the ChannelManager.
+ */
+typedef enum LDKMonitorEvent_Tag {
+ /**
+ * A monitor event containing an HTLCUpdate.
+ */
+ LDKMonitorEvent_HTLCEvent,
+ /**
+ * A monitor event that the Channel's commitment transaction was broadcasted.
+ */
+ LDKMonitorEvent_CommitmentTxBroadcasted,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKMonitorEvent_Sentinel,
+} LDKMonitorEvent_Tag;
+
+typedef struct MUST_USE_STRUCT LDKMonitorEvent {
+ LDKMonitorEvent_Tag tag;
+ union {
+ struct {
+ struct LDKHTLCUpdate htlc_event;
+ };
+ struct {
+ struct LDKOutPoint commitment_tx_broadcasted;
+ };
+ };
+} LDKMonitorEvent;
+
+typedef struct LDKCVec_MonitorEventZ {
+ struct LDKMonitorEvent *data;
+ uintptr_t datalen;
+} LDKCVec_MonitorEventZ;
+
+
+
+/**
+ * Information about a spendable output to a P2WSH script. See
+ * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
+ */
+typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeDelayedPaymentOutputDescriptor *inner;
+ bool is_owned;
+} LDKDelayedPaymentOutputDescriptor;
+
+
+
+/**
+ * Information about a spendable output to our \"payment key\". See
+ * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
+ */
+typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeStaticPaymentOutputDescriptor *inner;
+ bool is_owned;
+} LDKStaticPaymentOutputDescriptor;
+
/**
* When on-chain outputs are created by rust-lightning (which our counterparty is not able to
* claim at any point in the future) an event is generated which you must track and be able to
*
* To derive the delayed_payment key which is used to sign for this input, you must pass the
* holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
- * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
+ * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
* chan_utils::derive_private_key. The public key can be generated without the secret key
* using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
- * ChannelKeys::pubkeys().
+ * Sign::pubkeys().
*
* To derive the revocation_pubkey provided here (which is used in the witness
* script generation), you must pass the counterparty revocation_basepoint (which appears in the
- * call to ChannelKeys::ready_channel) and the provided per_commitment point
+ * call to Sign::ready_channel) and the provided per_commitment point
* to chan_utils::derive_public_revocation_key.
*
* The witness script which is hashed and included in the output script_pubkey may be
* (derived as above), and the to_self_delay contained here to
* chan_utils::get_revokeable_redeemscript.
*/
- LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
+ LDKSpendableOutputDescriptor_DelayedPaymentOutput,
/**
* An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
- * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
+ * corresponds to the public key in Sign::pubkeys().payment_point).
* The witness in the spending input, is, thus, simply:
* <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,
+ LDKSpendableOutputDescriptor_StaticPaymentOutput,
/**
* Must be last for serialization purposes
*/
struct LDKTxOut output;
} LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
-typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
- struct LDKOutPoint outpoint;
- struct LDKPublicKey per_commitment_point;
- uint16_t to_self_delay;
- struct LDKTxOut output;
- struct LDKPublicKey revocation_pubkey;
- struct LDKThirtyTwoBytes channel_keys_id;
- uint64_t channel_value_satoshis;
-} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
-
-typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
- struct LDKOutPoint outpoint;
- struct LDKTxOut output;
- struct LDKThirtyTwoBytes channel_keys_id;
- uint64_t channel_value_satoshis;
-} LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
-
typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
LDKSpendableOutputDescriptor_Tag tag;
union {
LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
- LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
- LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
+ struct {
+ struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
+ };
+ struct {
+ struct LDKStaticPaymentOutputDescriptor static_payment_output;
+ };
};
} LDKSpendableOutputDescriptor;
bool result_ok;
} LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
-
-
-/**
- * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
- * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
- * preimage claim backward will lead to loss of funds.
- *
- * [`chain::Watch`]: ../trait.Watch.html
- */
-typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
- /**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
- */
- LDKnativeHTLCUpdate *inner;
- bool is_owned;
-} LDKHTLCUpdate;
-
typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
struct LDKHTLCUpdate *result;
struct LDKDecodeError *err;
} LDKUnsignedChannelAnnouncement;
/**
- * Set of lightning keys needed to operate a channel as described in BOLT 3.
+ * A trait to sign lightning channel transactions as described in BOLT 3.
*
* Signing services could be implemented on a hardware wallet. In this case,
- * the current ChannelKeys would be a front-end on top of a communication
+ * the current Sign would be a front-end on top of a communication
* channel connected to your secure device and lightning key material wouldn't
* reside on a hot server. Nevertheless, a this deployment would still need
* to trust the ChannelManager to avoid loss of funds as this latest component
* In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
* to act, as liveness and breach reply correctness are always going to be hard requirements
* of LN security model, orthogonal of key management issues.
- *
- * If you're implementing a custom signer, you almost certainly want to implement
- * Readable/Writable to serialize out a unique reference to this set of keys so
- * that you can serialize the full ChannelManager object.
- *
*/
-typedef struct LDKChannelKeys {
+typedef struct LDKSign {
void *this_arg;
/**
* Gets the per-commitment point for a specific commitment number
* 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);
/**
* Note that this takes a pointer to this object, not the this_ptr like other methods do
* This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
*/
- void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
+ void (*set_pubkeys)(const struct LDKSign*NONNULL_PTR );
/**
* Gets an arbitrary identifier describing the set of keys which are provided back to you in
* some SpendableOutputDescriptor types. This should be sufficient to identify this
- * ChannelKeys object uniquely and lookup or re-derive its keys.
+ * Sign object uniquely and lookup or re-derive its keys.
*/
struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
/**
void *(*clone)(const void *this_arg);
struct LDKCVec_u8Z (*write)(const void *this_arg);
void (*free)(void *this_arg);
-} LDKChannelKeys;
+} LDKSign;
* 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
+ * Note that the deserializer is only implemented for (BlockHash, 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
bool result_ok;
} LDKCResult_NoneAPIErrorZ;
+typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
+ struct LDKCResult_NoneAPIErrorZ *data;
+ uintptr_t datalen;
+} LDKCVec_CResult_NoneAPIErrorZZ;
+
+typedef struct LDKCVec_APIErrorZ {
+ struct LDKAPIError *data;
+ uintptr_t datalen;
+} LDKCVec_APIErrorZ;
+
/**
uintptr_t datalen;
} LDKCVec_ChannelDetailsZ;
-
-
/**
* If a payment fails to send, it can be in one of several states. This enum is returned as the
* Err() type describing which state the payment is in, see the description of individual enum
* states for more.
*/
-typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
+typedef enum LDKPaymentSendFailure_Tag {
/**
- * Nearly everywhere, inner must be non-null, however in places where
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ * A parameter which was passed to send_payment was invalid, preventing us from attempting to
+ * send the payment at all. No channel state has been changed or messages sent to peers, and
+ * once you've changed the parameter at error, you can freely retry the payment in full.
*/
- LDKnativePaymentSendFailure *inner;
- bool is_owned;
+ LDKPaymentSendFailure_ParameterError,
+ /**
+ * A parameter in a single path which was passed to send_payment was invalid, preventing us
+ * from attempting to send the payment at all. No channel state has been changed or messages
+ * sent to peers, and once you've changed the parameter at error, you can freely retry the
+ * payment in full.
+ *
+ * The results here are ordered the same as the paths in the route object which was passed to
+ * send_payment.
+ */
+ LDKPaymentSendFailure_PathParameterError,
+ /**
+ * All paths which were attempted failed to send, with no channel state change taking place.
+ * You can freely retry the payment in full (though you probably want to do so over different
+ * paths than the ones selected).
+ */
+ LDKPaymentSendFailure_AllFailedRetrySafe,
+ /**
+ * Some paths which were attempted failed to send, though possibly not all. At least some
+ * paths have irrevocably committed to the HTLC and retrying the payment in full would result
+ * in over-/re-payment.
+ *
+ * The results here are ordered the same as the paths in the route object which was passed to
+ * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
+ * retried (though there is currently no API with which to do so).
+ *
+ * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
+ * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
+ * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
+ * with the latest update_id.
+ */
+ LDKPaymentSendFailure_PartialFailure,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPaymentSendFailure_Sentinel,
+} LDKPaymentSendFailure_Tag;
+
+typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
+ LDKPaymentSendFailure_Tag tag;
+ union {
+ struct {
+ struct LDKAPIError parameter_error;
+ };
+ struct {
+ struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
+ };
+ struct {
+ struct LDKCVec_APIErrorZ all_failed_retry_safe;
+ };
+ struct {
+ struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
+ };
+ };
} LDKPaymentSendFailure;
typedef union LDKCResult_NonePaymentSendFailureZPtr {
void (*free)(void *this_arg);
} LDKBroadcasterInterface;
-typedef union LDKCResult_ChannelKeysDecodeErrorZPtr {
- struct LDKChannelKeys *result;
+typedef union LDKCResult_SignDecodeErrorZPtr {
+ struct LDKSign *result;
struct LDKDecodeError *err;
-} LDKCResult_ChannelKeysDecodeErrorZPtr;
+} LDKCResult_SignDecodeErrorZPtr;
-typedef struct LDKCResult_ChannelKeysDecodeErrorZ {
- union LDKCResult_ChannelKeysDecodeErrorZPtr contents;
+typedef struct LDKCResult_SignDecodeErrorZ {
+ union LDKCResult_SignDecodeErrorZPtr contents;
bool result_ok;
-} LDKCResult_ChannelKeysDecodeErrorZ;
+} LDKCResult_SignDecodeErrorZ;
typedef struct LDKu8slice {
const uint8_t *data;
*/
struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
/**
- * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
+ * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
* restarted with some stale data!
*
* This method must return a different value each time it is called.
*/
- struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
+ struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
/**
* Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
* onion packets and for temporary channel IDs. There is no requirement that these be
*/
struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
/**
- * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream.
+ * Reads a `Signer` for this `KeysInterface` from the given input stream.
* This is only called during deserialization of other objects which contain
- * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
- * The bytes are exactly those which `<Self::ChanKeySigner as Writeable>::write()` writes, and
+ * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
+ * The bytes are exactly those which `<Self::Signer 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_ChannelKeysDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
+ struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
void (*free)(void *this_arg);
} LDKKeysInterface;
* 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
+ * Note that the deserializer is only implemented for (BlockHash, 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
bool result_ok;
} LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
+typedef struct LDKCVec_CVec_u8ZZ {
+ struct LDKCVec_u8Z *data;
+ uintptr_t datalen;
+} LDKCVec_CVec_u8ZZ;
+
+typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
+ struct LDKCVec_CVec_u8ZZ *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_CVec_CVec_u8ZZNoneZPtr;
+
+typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
+ union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
+ bool result_ok;
+} LDKCResult_CVec_CVec_u8ZZNoneZ;
+
/**
- * A simple implementation of ChannelKeys that just keeps the private keys in memory.
+ * A simple implementation of Sign that just keeps the private keys in memory.
*
* This implementation performs no policy checks and is insufficient by itself as
* a secure external signer.
*/
-typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
+typedef struct MUST_USE_STRUCT LDKInMemorySigner {
/**
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeInMemoryChannelKeys *inner;
+ LDKnativeInMemorySigner *inner;
bool is_owned;
-} LDKInMemoryChannelKeys;
+} LDKInMemorySigner;
-typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr {
- struct LDKInMemoryChannelKeys *result;
+typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
+ struct LDKInMemorySigner *result;
struct LDKDecodeError *err;
-} LDKCResult_InMemoryChannelKeysDecodeErrorZPtr;
+} LDKCResult_InMemorySignerDecodeErrorZPtr;
+
+typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
+ union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_InMemorySignerDecodeErrorZ;
+
+typedef struct LDKCVec_TxOutZ {
+ struct LDKTxOut *data;
+ uintptr_t datalen;
+} LDKCVec_TxOutZ;
+
+typedef union LDKCResult_TransactionNoneZPtr {
+ struct LDKTransaction *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_TransactionNoneZPtr;
-typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ {
- union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents;
+typedef struct LDKCResult_TransactionNoneZ {
+ union LDKCResult_TransactionNoneZPtr contents;
bool result_ok;
-} LDKCResult_InMemoryChannelKeysDecodeErrorZ;
+} LDKCResult_TransactionNoneZ;
void (*free)(void *this_arg);
} LDKAccess;
+/**
+ * The `Listen` trait is used to be notified of when blocks have been connected or disconnected
+ * from the chain.
+ *
+ * Useful when needing to replay chain data upon startup or as new chain events occur.
+ */
+typedef struct LDKListen {
+ void *this_arg;
+ /**
+ * Notifies the listener that a block was added at the given height.
+ */
+ void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
+ /**
+ * Notifies the listener that a block was removed at the given height.
+ */
+ void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
+ void (*free)(void *this_arg);
+} LDKListen;
+
/**
* The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
* channels.
bool is_owned;
} LDKKeysManager;
+
+
+/**
+ * Chain-related parameters used to construct a new `ChannelManager`.
+ *
+ * Typically, the block-specific parameters are derived from the best block hash for the network,
+ * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
+ * are not needed when deserializing a previously constructed `ChannelManager`.
+ */
+typedef struct MUST_USE_STRUCT LDKChainParameters {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChainParameters *inner;
+ bool is_owned;
+} LDKChainParameters;
+
typedef struct LDKThreeBytes {
uint8_t data[3];
} LDKThreeBytes;
/**
* Handle an incoming shutdown message from the given peer.
*/
- void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
+ void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg);
/**
* Handle an incoming closing_signed message from the given peer.
*/
* At a high-level, the process for deserializing a ChannelManager and resuming normal operation
* is:
* 1) Deserialize all stored ChannelMonitors.
- * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
- * ChannelManager)>::read(reader, args).
+ * 2) Deserialize the ChannelManager by filling in this struct and calling:
+ * <(BlockHash, ChannelManager)>::read(reader, args)
* This may result in closing some Channels if the ChannelMonitor is newer than the stored
* ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
- * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
- * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
+ * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
+ * way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
+ * ChannelMonitor::get_funding_txo().
* 4) Reconnect blocks on your ChannelMonitors.
- * 5) Move the ChannelMonitors into your local chain::Watch.
- * 6) Disconnect/connect blocks on the ChannelManager.
+ * 5) Disconnect/connect blocks on the ChannelManager.
+ * 6) Move the ChannelMonitors into your local chain::Watch.
+ *
+ * Note that the ordering of #4-6 is not of importance, however all three must occur before you
+ * call any other methods on the newly-deserialized ChannelManager.
+ *
+ * Note that because some channels may be closed during deserialization, it is critical that you
+ * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
+ * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
+ * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
+ * not force-close the same channels but consider them live), you may end up revoking a state for
+ * which you've already broadcasted the transaction.
*/
typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
/**
+/**
+ * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
+ * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
+ */
+typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeIgnoringMessageHandler *inner;
+ bool is_owned;
+} LDKIgnoringMessageHandler;
+
+
+
+/**
+ * A dummy struct which implements `ChannelMessageHandler` without having any channels.
+ * You can provide one of these as the route_handler in a MessageHandler.
+ */
+typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
+ /**
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeErroringMessageHandler *inner;
+ bool is_owned;
+} LDKErroringMessageHandler;
+
+
+
/**
* Provides references to trait impls which handle different types of messages.
*/
extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
+extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
+
void Transaction_free(struct LDKTransaction _res);
void TxOut_free(struct LDKTxOut _res);
struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
+void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
+
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
+
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
+
+void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
+
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
+
+struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
+
+struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
+
+void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
+
+void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
+
+void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
+
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
+
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
+
+void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
+
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
+
void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
void CVec_u8Z_free(struct LDKCVec_u8Z _res);
struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
-struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
-
-struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
-
-void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
-
-struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
-
-struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
-
-struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
-
-void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
-
-void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
-
-void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
-
-struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
-
-struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
-
-void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
-
-struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
-
-void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
-
struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
+struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
+
struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
+
struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
+void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
+
+void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
+
void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
-struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_ok(struct LDKChannelKeys o);
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
+
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
+
+void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
+
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
+
+void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
+
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
+
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
+
+void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
-struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
-void CResult_ChannelKeysDecodeErrorZ_free(struct LDKCResult_ChannelKeysDecodeErrorZ _res);
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
-struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelKeysDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
-struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o);
+void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
-struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
-void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res);
+void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
-struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_clone(const struct LDKCResult_InMemoryChannelKeysDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
+
+struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
+
+void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
*/
void Access_free(struct LDKAccess this_ptr);
+/**
+ * Calls the free function if one is set
+ */
+void Listen_free(struct LDKListen this_ptr);
+
/**
* Calls the free function if one is set
*/
*
* panics if the given update is not the next update by update_id.
*/
-MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
+MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
/**
* Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
*
* [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
*/
-MUST_USE_RES struct 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(const 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 struct 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(const 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 struct 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(const 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 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);
+MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
/**
* Determines if the disconnected block contained any transactions of interest and updates
* appropriately.
*/
-void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
+void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
/**
* Calls the free function if one is set
struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
+void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_ptr);
+
+/**
+ * The outpoint which is spendable
+ */
+struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The outpoint which is spendable
+ */
+void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
+
+/**
+ * Per commitment point to derive delayed_payment_key by key holder
+ */
+struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * Per commitment point to derive delayed_payment_key by key holder
+ */
+void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+
+/**
+ * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
+ * the witness_script.
+ */
+uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
+ * the witness_script.
+ */
+void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
+
+/**
+ * The output which is referenced by the given outpoint
+ */
+void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
+
+/**
+ * The revocation point specific to the commitment transaction which was broadcast. Used to
+ * derive the witnessScript for this output.
+ */
+struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The revocation point specific to the commitment transaction which was broadcast. Used to
+ * derive the witnessScript for this output.
+ */
+void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+
+/**
+ * Arbitrary identification information returned by a call to
+ * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
+ * the channel to spend the output.
+ */
+const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
+
+/**
+ * Arbitrary identification information returned by a call to
+ * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
+ * the channel to spend the output.
+ */
+void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+
+/**
+ * The value of the channel which this output originated from, possibly indirectly.
+ */
+uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The value of the channel which this output originated from, possibly indirectly.
+ */
+void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
+
+MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg);
+
+struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
+
+void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_ptr);
+
+/**
+ * The outpoint which is spendable
+ */
+struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The outpoint which is spendable
+ */
+void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
+
+/**
+ * The output which is referenced by the given outpoint
+ */
+void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
+
+/**
+ * Arbitrary identification information returned by a call to
+ * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
+ * the channel to spend the output.
+ */
+const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
+
+/**
+ * Arbitrary identification information returned by a call to
+ * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
+ * the channel to spend the output.
+ */
+void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+
+/**
+ * The value of the channel which this transactions spends.
+ */
+uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
+
+/**
+ * The value of the channel which this transactions spends.
+ */
+void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
+
+MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg);
+
+struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
+
void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
-struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig);
+struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
/**
* Calls the free function if one is set
*/
-void ChannelKeys_free(struct LDKChannelKeys this_ptr);
+void Sign_free(struct LDKSign this_ptr);
/**
* Calls the free function if one is set
*/
void KeysInterface_free(struct LDKKeysInterface this_ptr);
-void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr);
+void InMemorySigner_free(struct LDKInMemorySigner this_ptr);
/**
* Private key of anchor tx
*/
-const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
+const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
/**
* Private key of anchor tx
*/
-void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
+void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
/**
* Holder secret key for blinded revocation pubkey
*/
-const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
+const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
/**
* Holder secret key for blinded revocation pubkey
*/
-void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
+void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
/**
* Holder secret key used for our balance in counterparty-broadcasted commitment transactions
*/
-const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
+const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
/**
* Holder secret key used for our balance in counterparty-broadcasted commitment transactions
*/
-void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
+void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
/**
* Holder secret key used in HTLC tx
*/
-const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
+const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
/**
* Holder secret key used in HTLC tx
*/
-void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
+void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
/**
* Holder htlc secret key used in commitment tx htlc outputs
*/
-const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
+const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
/**
* Holder htlc secret key used in commitment tx htlc outputs
*/
-void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
+void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
/**
* Commitment seed
*/
-const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
+const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
/**
* Commitment seed
*/
-void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
-struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig);
+struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
/**
- * Create a new InMemoryChannelKeys
+ * Create a new InMemorySigner
*/
-MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
+MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
/**
* Counterparty pubkeys.
* Will panic if ready_channel wasn't called.
*/
-MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
/**
* The contest_delay value specified by our counterparty and applied on holder-broadcastable
* broadcast a transaction.
* Will panic if ready_channel wasn't called.
*/
-MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
+MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
/**
* The contest_delay value specified by us and applied on transactions broadcastable
* if they broadcast a transaction.
* Will panic if ready_channel wasn't called.
*/
-MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
+MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
/**
* Whether the holder is the initiator
* Will panic if ready_channel wasn't called.
*/
-MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
+MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
/**
* Funding outpoint
* Will panic if ready_channel wasn't called.
*/
-MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
/**
* Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
*
* Will panic if ready_channel wasn't called.
*/
-MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
+
+/**
+ * Sign the single input of spend_tx at index `input_idx` which spends the output
+ * described by descriptor, returning the witness stack for the input.
+ *
+ * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
+ * or is not spending the outpoint described by `descriptor.outpoint`.
+ */
+MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor);
+
+/**
+ * Sign the single input of spend_tx at index `input_idx` which spends the output
+ * described by descriptor, returning the witness stack for the input.
+ *
+ * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
+ * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
+ * sequence set to `descriptor.to_self_delay`.
+ */
+MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor);
-struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
+struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
-struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
+struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
-struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser);
+struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
void KeysManager_free(struct LDKKeysManager this_ptr);
* versions. Once the library is more fully supported, the docs will be updated to include a
* detailed description of the guarantee.
*/
-MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
+MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
/**
- * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
- * parameters.
+ * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
+ *
* Key derivation parameters are accessible through a per-channel secrets
- * ChannelKeys::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
+ * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
* onchain output detection for which a corresponding delayed_payment_key must be derived.
*/
-MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]);
+MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]);
+
+/**
+ * Creates a Transaction which spends the given descriptors to the given outputs, plus an
+ * output to the given change destination (if sufficient change value remains). The
+ * transaction will have a feerate, at least, of the given value.
+ *
+ * Returns `Err(())` if the output value is greater than the input value minus required fee or
+ * if a descriptor was duplicated.
+ *
+ * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
+ *
+ * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
+ * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
+ */
+MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight);
struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
void ChannelManager_free(struct LDKChannelManager this_ptr);
+void ChainParameters_free(struct LDKChainParameters this_ptr);
+
+/**
+ * The network for determining the `chain_hash` in Lightning messages.
+ */
+enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The network for determining the `chain_hash` in Lightning messages.
+ */
+void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
+
+/**
+ * The hash of the latest block successfully connected.
+ */
+const uint8_t (*ChainParameters_get_latest_hash(const struct LDKChainParameters *NONNULL_PTR this_ptr))[32];
+
+/**
+ * The hash of the latest block successfully connected.
+ */
+void ChainParameters_set_latest_hash(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+
+/**
+ * The height of the latest block successfully connected.
+ *
+ * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
+ */
+uintptr_t ChainParameters_get_latest_height(const struct LDKChainParameters *NONNULL_PTR this_ptr);
+
+/**
+ * The height of the latest block successfully connected.
+ *
+ * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
+ */
+void ChainParameters_set_latest_height(struct LDKChainParameters *NONNULL_PTR this_ptr, uintptr_t val);
+
+MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKThirtyTwoBytes latest_hash_arg, uintptr_t latest_height_arg);
+
void ChannelDetails_free(struct LDKChannelDetails this_ptr);
/**
*
* panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
*
- * Users must provide the current blockchain height from which to track onchain channel
- * funding outpoints and send payments with reliable timelocks.
- *
* Users need to notify the new ChannelManager when a new block is connected or
- * disconnected using its `block_connected` and `block_disconnected` methods.
+ * disconnected using its `block_connected` and `block_disconnected` methods, starting
+ * from after `params.latest_hash`.
*/
-MUST_USE_RES struct LDKChannelManager ChannelManager_new(enum LDKNetwork network, struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, uintptr_t current_blockchain_height);
+MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params);
/**
* Creates a new outbound channel to the given remote node and with the given value.
* to inform the network about the uselessness of these channels.
*
* This method handles all the details, and must be called roughly once per minute.
+ *
+ * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
*/
void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
+struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
+
/**
* Updates channel state based on transactions seen in a connected block.
*/
*/
void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
+/**
+ * Blocks until ChannelManager needs to be persisted. Only one listener on
+ * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
+ * up.
+ */
+void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
+
struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
void Init_free(struct LDKInit this_ptr);
+/**
+ * The relevant features which the sender supports
+ */
+struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
+
+/**
+ * The relevant features which the sender supports
+ */
+void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
+
+MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
+
struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
void ErrorMessage_free(struct LDKErrorMessage this_ptr);
struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
+void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_ptr);
+
+MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
+
+struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
+
+struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
+
+void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_ptr);
+
+/**
+ * Constructs a new ErroringMessageHandler
+ */
+MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
+
+struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
+
+struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
+
void MessageHandler_free(struct LDKMessageHandler this_ptr);
/**
* A message handler which handles messages specific to channels. Usually this is just a
- * ChannelManager object.
+ * ChannelManager object or a ErroringMessageHandler.
*/
const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
/**
* A message handler which handles messages specific to channels. Usually this is just a
- * ChannelManager object.
+ * ChannelManager object or a ErroringMessageHandler.
*/
void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
/**
* A message handler which handles messages updating our knowledge of the network channel
- * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
+ * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
*/
const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
/**
* A message handler which handles messages updating our knowledge of the network channel
- * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
+ * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
*/
void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
/**
- * The fee taken on this hop. For the last hop, this should be the full value of the payment.
+ * The fee taken on this hop (for paying for the use of the *next* channel in the path).
+ * For the last hop, this should be the full value of the payment (might be more than
+ * requested if we had to match htlc_minimum_msat).
*/
uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
/**
- * The fee taken on this hop. For the last hop, this should be the full value of the payment.
+ * The fee taken on this hop (for paying for the use of the *next* channel in the path).
+ * For the last hop, this should be the full value of the payment (might be more than
+ * requested if we had to match htlc_minimum_msat).
*/
void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
*/
void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
-/**
- * The minimum value, in msat, which must be relayed to the next hop.
- */
-uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
-
-/**
- * The minimum value, in msat, which must be relayed to the next hop.
- */
-void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
-
-MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg);
-
struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
/**
- * Gets a route from us to the given target node.
+ * Gets a route from us (payer) to the given target node (payee).
*
* Extra routing hops between known nodes and the target will be used if they are included in
* last_hops.
*
* If some channels aren't announced, it may be useful to fill in a first_hops with the
* results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
- * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
- * will be used.
+ * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
+ * in first_hops will be used.
*
* Panics if first_hops contains channels without short_channel_ids
* (ChannelManager::list_usable_channels will never include such channels).
*
* The fees on channels from us to next-hops are ignored (as they are assumed to all be
- * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
- * *is* checked as they may change based on the receiving node.
+ * equal), however the enabled/disabled bit on such channels as well as the
+ * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
*/
-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);
+struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
+struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
+
void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
*/
MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
+/**
+ * Adds a provider used to check new announcements. Does not affect
+ * existing announcements unless they are updated.
+ * Add, update or remove the provider would replace the current one.
+ */
+void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
+
/**
* Take a read lock on the network_graph and return it in the C-bindings
* newtype helper. This is likely only useful when called via the C
*/
void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
+struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
+
struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);