LDKNetwork_Bitcoin,
LDKNetwork_Testnet,
LDKNetwork_Regtest,
+ LDKNetwork_Signet,
/**
* 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 LDKRevokeAndACK msg;
} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
-typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
- struct LDKPublicKey node_id;
- struct LDKClosingSigned msg;
-} LDKMessageSendEvent_LDKSendClosingSigned_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;
+
+
+
+/**
+ * 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_LDKSendShutdown_Body {
- struct LDKPublicKey node_id;
- struct LDKShutdown msg;
-} LDKMessageSendEvent_LDKSendShutdown_Body;
+typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
+ struct LDKNodeFeatures *result;
+ struct LDKDecodeError *err;
+} LDKCResult_NodeFeaturesDecodeErrorZPtr;
-typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
- struct LDKPublicKey node_id;
- struct LDKChannelReestablish msg;
-} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
+typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
+ union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_NodeFeaturesDecodeErrorZ;
-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;
+/**
+ * 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_LDKHandleError_Body {
- struct LDKPublicKey node_id;
- struct LDKErrorAction action;
-} LDKMessageSendEvent_LDKHandleError_Body;
+typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
+ struct LDKChannelFeatures *result;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
-typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
- struct LDKHTLCFailChannelUpdate update;
-} LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
+typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
+ union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
+ bool result_ok;
+} LDKCResult_ChannelFeaturesDecodeErrorZ;
-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;
+/**
+ * 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 struct LDKCVec_MessageSendEventZ {
- struct LDKMessageSendEvent *data;
- uintptr_t datalen;
-} LDKCVec_MessageSendEventZ;
+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;
* 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
* 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 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;
* 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.
*/
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);
*
* 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
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);
void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
/**
- * Blocks until ChannelManager needs to be persisted. Only one listener on `wait` is
- * guaranteed to be woken up.
+ * 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 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);
*/
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
const LDKTrustedCommitmentTransaction* operator &() const { return &self; }
const LDKTrustedCommitmentTransaction* operator ->() const { return &self; }
};
+class IgnoringMessageHandler {
+private:
+ LDKIgnoringMessageHandler self;
+public:
+ IgnoringMessageHandler(const IgnoringMessageHandler&) = delete;
+ IgnoringMessageHandler(IgnoringMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(IgnoringMessageHandler)); }
+ IgnoringMessageHandler(LDKIgnoringMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKIgnoringMessageHandler)); }
+ operator LDKIgnoringMessageHandler() && { LDKIgnoringMessageHandler res = self; memset(&self, 0, sizeof(LDKIgnoringMessageHandler)); return res; }
+ ~IgnoringMessageHandler() { IgnoringMessageHandler_free(self); }
+ IgnoringMessageHandler& operator=(IgnoringMessageHandler&& o) { IgnoringMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(IgnoringMessageHandler)); return *this; }
+ LDKIgnoringMessageHandler* operator &() { return &self; }
+ LDKIgnoringMessageHandler* operator ->() { return &self; }
+ const LDKIgnoringMessageHandler* operator &() const { return &self; }
+ const LDKIgnoringMessageHandler* operator ->() const { return &self; }
+};
+class ErroringMessageHandler {
+private:
+ LDKErroringMessageHandler self;
+public:
+ ErroringMessageHandler(const ErroringMessageHandler&) = delete;
+ ErroringMessageHandler(ErroringMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(ErroringMessageHandler)); }
+ ErroringMessageHandler(LDKErroringMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKErroringMessageHandler)); }
+ operator LDKErroringMessageHandler() && { LDKErroringMessageHandler res = self; memset(&self, 0, sizeof(LDKErroringMessageHandler)); return res; }
+ ~ErroringMessageHandler() { ErroringMessageHandler_free(self); }
+ ErroringMessageHandler& operator=(ErroringMessageHandler&& o) { ErroringMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(ErroringMessageHandler)); return *this; }
+ LDKErroringMessageHandler* operator &() { return &self; }
+ LDKErroringMessageHandler* operator ->() { return &self; }
+ const LDKErroringMessageHandler* operator &() const { return &self; }
+ const LDKErroringMessageHandler* operator ->() const { return &self; }
+};
class MessageHandler {
private:
LDKMessageHandler self;
const LDKChannelManager* operator &() const { return &self; }
const LDKChannelManager* operator ->() const { return &self; }
};
+class ChainParameters {
+private:
+ LDKChainParameters self;
+public:
+ ChainParameters(const ChainParameters&) = delete;
+ ChainParameters(ChainParameters&& o) : self(o.self) { memset(&o, 0, sizeof(ChainParameters)); }
+ ChainParameters(LDKChainParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainParameters)); }
+ operator LDKChainParameters() && { LDKChainParameters res = self; memset(&self, 0, sizeof(LDKChainParameters)); return res; }
+ ~ChainParameters() { ChainParameters_free(self); }
+ ChainParameters& operator=(ChainParameters&& o) { ChainParameters_free(self); self = o.self; memset(&o, 0, sizeof(ChainParameters)); return *this; }
+ LDKChainParameters* operator &() { return &self; }
+ LDKChainParameters* operator ->() { return &self; }
+ const LDKChainParameters* operator &() const { return &self; }
+ const LDKChainParameters* operator ->() const { return &self; }
+};
class ChannelDetails {
private:
LDKChannelDetails self;
const LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() const { return &self; }
const LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() const { return &self; }
};
-class CResult_NonePeerHandleErrorZ {
-private:
- LDKCResult_NonePeerHandleErrorZ self;
-public:
- CResult_NonePeerHandleErrorZ(const CResult_NonePeerHandleErrorZ&) = delete;
- CResult_NonePeerHandleErrorZ(CResult_NonePeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); }
- CResult_NonePeerHandleErrorZ(LDKCResult_NonePeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); }
- operator LDKCResult_NonePeerHandleErrorZ() && { LDKCResult_NonePeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); return res; }
- ~CResult_NonePeerHandleErrorZ() { CResult_NonePeerHandleErrorZ_free(self); }
- CResult_NonePeerHandleErrorZ& operator=(CResult_NonePeerHandleErrorZ&& o) { CResult_NonePeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); return *this; }
- LDKCResult_NonePeerHandleErrorZ* operator &() { return &self; }
- LDKCResult_NonePeerHandleErrorZ* operator ->() { return &self; }
- const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; }
- const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; }
-};
class CResult_NoneLightningErrorZ {
private:
LDKCResult_NoneLightningErrorZ self;
const LDKCResult_NoneLightningErrorZ* operator &() const { return &self; }
const LDKCResult_NoneLightningErrorZ* operator ->() const { return &self; }
};
+class CResult_NonePeerHandleErrorZ {
+private:
+ LDKCResult_NonePeerHandleErrorZ self;
+public:
+ CResult_NonePeerHandleErrorZ(const CResult_NonePeerHandleErrorZ&) = delete;
+ CResult_NonePeerHandleErrorZ(CResult_NonePeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); }
+ CResult_NonePeerHandleErrorZ(LDKCResult_NonePeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); }
+ operator LDKCResult_NonePeerHandleErrorZ() && { LDKCResult_NonePeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); return res; }
+ ~CResult_NonePeerHandleErrorZ() { CResult_NonePeerHandleErrorZ_free(self); }
+ CResult_NonePeerHandleErrorZ& operator=(CResult_NonePeerHandleErrorZ&& o) { CResult_NonePeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); return *this; }
+ LDKCResult_NonePeerHandleErrorZ* operator &() { return &self; }
+ LDKCResult_NonePeerHandleErrorZ* operator ->() { return &self; }
+ const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; }
+ const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; }
+};
class CResult_CVec_SignatureZNoneZ {
private:
LDKCResult_CVec_SignatureZNoneZ self;
typedef struct nativeCommitmentTransactionOpaque LDKnativeCommitmentTransaction;
struct nativeTrustedCommitmentTransactionOpaque;
typedef struct nativeTrustedCommitmentTransactionOpaque LDKnativeTrustedCommitmentTransaction;
+struct nativeIgnoringMessageHandlerOpaque;
+typedef struct nativeIgnoringMessageHandlerOpaque LDKnativeIgnoringMessageHandler;
+struct nativeErroringMessageHandlerOpaque;
+typedef struct nativeErroringMessageHandlerOpaque LDKnativeErroringMessageHandler;
struct nativeMessageHandlerOpaque;
typedef struct nativeMessageHandlerOpaque LDKnativeMessageHandler;
typedef struct LDKSocketDescriptor LDKSocketDescriptor;
typedef struct nativeChannelMonitorOpaque LDKnativeChannelMonitor;
struct nativeChannelManagerOpaque;
typedef struct nativeChannelManagerOpaque LDKnativeChannelManager;
+struct nativeChainParametersOpaque;
+typedef struct nativeChainParametersOpaque LDKnativeChainParameters;
struct nativeChannelDetailsOpaque;
typedef struct nativeChannelDetailsOpaque LDKnativeChannelDetails;
struct nativeChannelManagerReadArgsOpaque;
#[no_mangle]
pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
#[repr(C)]
-pub struct CVec_PublicKeyZ {
- pub data: *mut crate::c_types::PublicKey,
- pub datalen: usize
-}
-impl CVec_PublicKeyZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
- if self.datalen == 0 { return Vec::new(); }
- let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
- self.data = std::ptr::null_mut();
- self.datalen = 0;
- ret
- }
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
- unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
- fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
-}
-#[no_mangle]
-pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
-impl Drop for CVec_PublicKeyZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-#[repr(C)]
-pub struct CVec_u8Z {
- pub data: *mut u8,
+pub struct CVec_MessageSendEventZ {
+ pub data: *mut crate::util::events::MessageSendEvent,
pub datalen: usize
}
-impl CVec_u8Z {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
+impl CVec_MessageSendEventZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::MessageSendEvent> {
if self.datalen == 0 { return Vec::new(); }
let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
self.data = std::ptr::null_mut();
self.datalen = 0;
ret
}
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::MessageSendEvent] {
unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<u8>> for CVec_u8Z {
- fn from(v: Vec<u8>) -> Self {
+impl From<Vec<crate::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
+ fn from(v: Vec<crate::util::events::MessageSendEvent>) -> Self {
let datalen = v.len();
let data = Box::into_raw(v.into_boxed_slice());
Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
}
#[no_mangle]
-pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
-impl Drop for CVec_u8Z {
+pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
+impl Drop for CVec_MessageSendEventZ {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl Clone for CVec_u8Z {
+impl Clone for CVec_MessageSendEventZ {
fn clone(&self) -> Self {
let mut res = Vec::new();
if self.datalen == 0 { return Self::from(res); }
}
}
#[repr(C)]
-pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
- pub result: *mut crate::c_types::derived::CVec_u8Z,
- pub err: *mut crate::ln::peer_handler::PeerHandleError,
+pub union CResult_boolLightningErrorZPtr {
+ pub result: *mut bool,
+ pub err: *mut crate::ln::msgs::LightningError,
}
#[repr(C)]
-pub struct CResult_CVec_u8ZPeerHandleErrorZ {
- pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
+pub struct CResult_boolLightningErrorZ {
+ pub contents: CResult_boolLightningErrorZPtr,
pub result_ok: bool,
}
#[no_mangle]
-pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
- CResult_CVec_u8ZPeerHandleErrorZ {
- contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
+ CResult_boolLightningErrorZ {
+ contents: CResult_boolLightningErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
- CResult_CVec_u8ZPeerHandleErrorZ {
- contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
+ CResult_boolLightningErrorZ {
+ contents: CResult_boolLightningErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
}
#[no_mangle]
-pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
-impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
+pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
+impl Drop for CResult_boolLightningErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
+impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_CVec_u8ZPeerHandleErrorZPtr { result }
+ CResult_boolLightningErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_CVec_u8ZPeerHandleErrorZPtr { err }
+ CResult_boolLightningErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
+impl Clone for CResult_boolLightningErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
- result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
+ result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
- err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
+pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
#[repr(C)]
-pub union CResult_NonePeerHandleErrorZPtr {
+pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ pub a: crate::ln::msgs::ChannelAnnouncement,
+ pub b: crate::ln::msgs::ChannelUpdate,
+ pub c: crate::ln::msgs::ChannelUpdate,
+}
+impl From<(crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ fn from (tup: (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)) -> Self {
+ Self {
+ a: tup.0,
+ b: tup.1,
+ c: tup.2,
+ }
+ }
+}
+impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate) {
+ (self.a, self.b, self.c)
+ }
+}
+impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ fn clone(&self) -> Self {
+ Self {
+ a: self.a.clone(),
+ b: self.b.clone(),
+ c: self.c.clone(),
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
+#[no_mangle]
+pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
+}
+
+#[no_mangle]
+pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
+#[repr(C)]
+pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
+ pub datalen: usize
+}
+impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
+ if self.datalen == 0 { return Vec::new(); }
+ let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
+ self.data = std::ptr::null_mut();
+ self.datalen = 0;
+ ret
+ }
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
+ unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+ }
+}
+#[no_mangle]
+pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
+impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ fn clone(&self) -> Self {
+ let mut res = Vec::new();
+ if self.datalen == 0 { return Self::from(res); }
+ res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
+ Self::from(res)
+ }
+}
+#[repr(C)]
+pub struct CVec_NodeAnnouncementZ {
+ pub data: *mut crate::ln::msgs::NodeAnnouncement,
+ pub datalen: usize
+}
+impl CVec_NodeAnnouncementZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
+ if self.datalen == 0 { return Vec::new(); }
+ let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
+ self.data = std::ptr::null_mut();
+ self.datalen = 0;
+ ret
+ }
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
+ unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
+ fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+ }
+}
+#[no_mangle]
+pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
+impl Drop for CVec_NodeAnnouncementZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_NodeAnnouncementZ {
+ fn clone(&self) -> Self {
+ let mut res = Vec::new();
+ if self.datalen == 0 { return Self::from(res); }
+ res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
+ Self::from(res)
+ }
+}
+#[repr(C)]
+pub union CResult_NoneLightningErrorZPtr {
/// Note that this value is always NULL, as there are no contents in the OK variant
pub result: *mut std::ffi::c_void,
- pub err: *mut crate::ln::peer_handler::PeerHandleError,
+ pub err: *mut crate::ln::msgs::LightningError,
}
#[repr(C)]
-pub struct CResult_NonePeerHandleErrorZ {
- pub contents: CResult_NonePeerHandleErrorZPtr,
+pub struct CResult_NoneLightningErrorZ {
+ pub contents: CResult_NoneLightningErrorZPtr,
pub result_ok: bool,
}
#[no_mangle]
-pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
- CResult_NonePeerHandleErrorZ {
- contents: CResult_NonePeerHandleErrorZPtr {
+pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
+ CResult_NoneLightningErrorZ {
+ contents: CResult_NoneLightningErrorZPtr {
result: std::ptr::null_mut(),
},
result_ok: true,
}
}
#[no_mangle]
-pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
- CResult_NonePeerHandleErrorZ {
- contents: CResult_NonePeerHandleErrorZPtr {
+pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
+ CResult_NoneLightningErrorZ {
+ contents: CResult_NoneLightningErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
}
#[no_mangle]
-pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
-impl Drop for CResult_NonePeerHandleErrorZ {
+pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
+impl Drop for CResult_NoneLightningErrorZ {
fn drop(&mut self) {
if self.result_ok {
} else {
}
}
}
-impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
+impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
let contents = if o.result_ok {
let _ = unsafe { Box::from_raw(o.contents.result) };
o.contents.result = std::ptr::null_mut();
- CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
+ CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_NonePeerHandleErrorZPtr { err }
+ CResult_NoneLightningErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_NonePeerHandleErrorZ {
+impl Clone for CResult_NoneLightningErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
+ Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
result: std::ptr::null_mut()
} }
} else {
- Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
- err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
+ Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
+#[repr(C)]
+pub struct CVec_PublicKeyZ {
+ pub data: *mut crate::c_types::PublicKey,
+ pub datalen: usize
+}
+impl CVec_PublicKeyZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
+ if self.datalen == 0 { return Vec::new(); }
+ let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
+ self.data = std::ptr::null_mut();
+ self.datalen = 0;
+ ret
+ }
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
+ unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
+ fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+ }
+}
+#[no_mangle]
+pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
+impl Drop for CVec_PublicKeyZ {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+#[repr(C)]
+pub struct CVec_u8Z {
+ pub data: *mut u8,
+ pub datalen: usize
+}
+impl CVec_u8Z {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
+ if self.datalen == 0 { return Vec::new(); }
+ let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
+ self.data = std::ptr::null_mut();
+ self.datalen = 0;
+ ret
+ }
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
+ unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
+ }
+}
+impl From<Vec<u8>> for CVec_u8Z {
+ fn from(v: Vec<u8>) -> Self {
+ let datalen = v.len();
+ let data = Box::into_raw(v.into_boxed_slice());
+ Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
+ }
+}
+#[no_mangle]
+pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
+impl Drop for CVec_u8Z {
+ fn drop(&mut self) {
+ if self.datalen == 0 { return; }
+ unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
+ }
+}
+impl Clone for CVec_u8Z {
+ fn clone(&self) -> Self {
+ let mut res = Vec::new();
+ if self.datalen == 0 { return Self::from(res); }
+ res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
+ Self::from(res)
+ }
+}
+#[repr(C)]
+pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
+ pub result: *mut crate::c_types::derived::CVec_u8Z,
+ pub err: *mut crate::ln::peer_handler::PeerHandleError,
+}
+#[repr(C)]
+pub struct CResult_CVec_u8ZPeerHandleErrorZ {
+ pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
+ pub result_ok: bool,
+}
+#[no_mangle]
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
+ CResult_CVec_u8ZPeerHandleErrorZ {
+ contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+ result: Box::into_raw(Box::new(o)),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
+ CResult_CVec_u8ZPeerHandleErrorZ {
+ contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
+ }
+}
+#[no_mangle]
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
+impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
+ fn drop(&mut self) {
+ if self.result_ok {
+ if unsafe { !(self.contents.result as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.result) };
+ }
+ } else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
+ }
+ }
+}
+impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
+ let contents = if o.result_ok {
+ let result = unsafe { o.contents.result };
+ unsafe { o.contents.result = std::ptr::null_mut() };
+ CResult_CVec_u8ZPeerHandleErrorZPtr { result }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = std::ptr::null_mut(); }
+ CResult_CVec_u8ZPeerHandleErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
+ } }
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
+#[repr(C)]
+pub union CResult_NonePeerHandleErrorZPtr {
+ /// Note that this value is always NULL, as there are no contents in the OK variant
+ pub result: *mut std::ffi::c_void,
+ pub err: *mut crate::ln::peer_handler::PeerHandleError,
+}
+#[repr(C)]
+pub struct CResult_NonePeerHandleErrorZ {
+ pub contents: CResult_NonePeerHandleErrorZPtr,
+ pub result_ok: bool,
+}
+#[no_mangle]
+pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
+ CResult_NonePeerHandleErrorZ {
+ contents: CResult_NonePeerHandleErrorZPtr {
+ result: std::ptr::null_mut(),
+ },
+ result_ok: true,
+ }
+}
+#[no_mangle]
+pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
+ CResult_NonePeerHandleErrorZ {
+ contents: CResult_NonePeerHandleErrorZPtr {
+ err: Box::into_raw(Box::new(e)),
+ },
+ result_ok: false,
+ }
+}
+#[no_mangle]
+pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
+impl Drop for CResult_NonePeerHandleErrorZ {
+ fn drop(&mut self) {
+ if self.result_ok {
+ } else {
+ if unsafe { !(self.contents.err as *mut ()).is_null() } {
+ let _ = unsafe { Box::from_raw(self.contents.err) };
+ }
+ }
+ }
+}
+impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
+ let contents = if o.result_ok {
+ let _ = unsafe { Box::from_raw(o.contents.result) };
+ o.contents.result = std::ptr::null_mut();
+ CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
+ } else {
+ let err = unsafe { o.contents.err };
+ unsafe { o.contents.err = std::ptr::null_mut(); }
+ CResult_NonePeerHandleErrorZPtr { err }
+ };
+ Self {
+ contents,
+ result_ok: o.result_ok,
+ }
+ }
+}
+impl Clone for CResult_NonePeerHandleErrorZ {
+ fn clone(&self) -> Self {
+ if self.result_ok {
+ Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
+ result: std::ptr::null_mut()
+ } }
+ } else {
+ Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
+ err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
} }
}
}
#[no_mangle]
pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
#[repr(C)]
-pub union CResult_boolLightningErrorZPtr {
- pub result: *mut bool,
- pub err: *mut crate::ln::msgs::LightningError,
-}
-#[repr(C)]
-pub struct CResult_boolLightningErrorZ {
- pub contents: CResult_boolLightningErrorZPtr,
- pub result_ok: bool,
-}
-#[no_mangle]
-pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
- CResult_boolLightningErrorZ {
- contents: CResult_boolLightningErrorZPtr {
- result: Box::into_raw(Box::new(o)),
- },
- result_ok: true,
- }
-}
-#[no_mangle]
-pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
- CResult_boolLightningErrorZ {
- contents: CResult_boolLightningErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
- }
-}
-#[no_mangle]
-pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
-impl Drop for CResult_boolLightningErrorZ {
- fn drop(&mut self) {
- if self.result_ok {
- if unsafe { !(self.contents.result as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.result) };
- }
- } else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
- }
- }
-}
-impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
- let contents = if o.result_ok {
- let result = unsafe { o.contents.result };
- unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_boolLightningErrorZPtr { result }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_boolLightningErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
- }
-}
-impl Clone for CResult_boolLightningErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
- result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
- } }
- } else {
- Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
- err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
-#[repr(C)]
-pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- pub a: crate::ln::msgs::ChannelAnnouncement,
- pub b: crate::ln::msgs::ChannelUpdate,
- pub c: crate::ln::msgs::ChannelUpdate,
-}
-impl From<(crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- fn from (tup: (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)) -> Self {
- Self {
- a: tup.0,
- b: tup.1,
- c: tup.2,
- }
- }
-}
-impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate) {
- (self.a, self.b, self.c)
- }
-}
-impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- fn clone(&self) -> Self {
- Self {
- a: self.a.clone(),
- b: self.b.clone(),
- c: self.c.clone(),
- }
- }
-}
-#[no_mangle]
-pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
-#[no_mangle]
-pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
- C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
-}
-
-#[no_mangle]
-pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
-#[repr(C)]
-pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
- pub datalen: usize
-}
-impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
- if self.datalen == 0 { return Vec::new(); }
- let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
- self.data = std::ptr::null_mut();
- self.datalen = 0;
- ret
- }
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
- unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
-}
-#[no_mangle]
-pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
-impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- fn clone(&self) -> Self {
- let mut res = Vec::new();
- if self.datalen == 0 { return Self::from(res); }
- res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
- Self::from(res)
- }
-}
-#[repr(C)]
-pub struct CVec_NodeAnnouncementZ {
- pub data: *mut crate::ln::msgs::NodeAnnouncement,
- pub datalen: usize
-}
-impl CVec_NodeAnnouncementZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
- if self.datalen == 0 { return Vec::new(); }
- let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
- self.data = std::ptr::null_mut();
- self.datalen = 0;
- ret
- }
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
- unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
- fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
-}
-#[no_mangle]
-pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
-impl Drop for CVec_NodeAnnouncementZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_NodeAnnouncementZ {
- fn clone(&self) -> Self {
- let mut res = Vec::new();
- if self.datalen == 0 { return Self::from(res); }
- res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
- Self::from(res)
- }
-}
-#[repr(C)]
-pub union CResult_NoneLightningErrorZPtr {
- /// Note that this value is always NULL, as there are no contents in the OK variant
- pub result: *mut std::ffi::c_void,
- pub err: *mut crate::ln::msgs::LightningError,
-}
-#[repr(C)]
-pub struct CResult_NoneLightningErrorZ {
- pub contents: CResult_NoneLightningErrorZPtr,
- pub result_ok: bool,
-}
-#[no_mangle]
-pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
- CResult_NoneLightningErrorZ {
- contents: CResult_NoneLightningErrorZPtr {
- result: std::ptr::null_mut(),
- },
- result_ok: true,
- }
-}
-#[no_mangle]
-pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
- CResult_NoneLightningErrorZ {
- contents: CResult_NoneLightningErrorZPtr {
- err: Box::into_raw(Box::new(e)),
- },
- result_ok: false,
- }
-}
-#[no_mangle]
-pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
-impl Drop for CResult_NoneLightningErrorZ {
- fn drop(&mut self) {
- if self.result_ok {
- } else {
- if unsafe { !(self.contents.err as *mut ()).is_null() } {
- let _ = unsafe { Box::from_raw(self.contents.err) };
- }
- }
- }
-}
-impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
- let contents = if o.result_ok {
- let _ = unsafe { Box::from_raw(o.contents.result) };
- o.contents.result = std::ptr::null_mut();
- CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
- } else {
- let err = unsafe { o.contents.err };
- unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_NoneLightningErrorZPtr { err }
- };
- Self {
- contents,
- result_ok: o.result_ok,
- }
- }
-}
-impl Clone for CResult_NoneLightningErrorZ {
- fn clone(&self) -> Self {
- if self.result_ok {
- Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
- result: std::ptr::null_mut()
- } }
- } else {
- Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
- err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
- } }
- }
- }
-}
-#[no_mangle]
-pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
-#[repr(C)]
-pub struct CVec_MessageSendEventZ {
- pub data: *mut crate::util::events::MessageSendEvent,
- pub datalen: usize
-}
-impl CVec_MessageSendEventZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::MessageSendEvent> {
- if self.datalen == 0 { return Vec::new(); }
- let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
- self.data = std::ptr::null_mut();
- self.datalen = 0;
- ret
- }
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::MessageSendEvent] {
- unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
- }
-}
-impl From<Vec<crate::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
- fn from(v: Vec<crate::util::events::MessageSendEvent>) -> Self {
- let datalen = v.len();
- let data = Box::into_raw(v.into_boxed_slice());
- Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
- }
-}
-#[no_mangle]
-pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
-impl Drop for CVec_MessageSendEventZ {
- fn drop(&mut self) {
- if self.datalen == 0 { return; }
- unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
- }
-}
-impl Clone for CVec_MessageSendEventZ {
- fn clone(&self) -> Self {
- let mut res = Vec::new();
- if self.datalen == 0 { return Self::from(res); }
- res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
- Self::from(res)
- }
-}
-#[repr(C)]
pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
pub result: *mut crate::routing::network_graph::DirectionalChannelInfo,
pub err: *mut crate::ln::msgs::DecodeError,
impl Drop for ChainMonitor {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChainMonitor>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
release_pending_monitor_events: ChainMonitor_Watch_release_pending_monitor_events,
}
}
-use lightning::chain::Watch as WatchTraitImport;
+
#[must_use]
extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut funding_outpoint: crate::chain::transaction::OutPoint, mut monitor: crate::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
- let mut ret = <nativeChainMonitor as WatchTraitImport<_>>::watch_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(funding_outpoint.take_inner()) }, *unsafe { Box::from_raw(monitor.take_inner()) });
+ let mut ret = <nativeChainMonitor as lightning::chain::Watch<_>>::watch_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(funding_outpoint.take_inner()) }, *unsafe { Box::from_raw(monitor.take_inner()) });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::chain::channelmonitor::ChannelMonitorUpdateErr::native_into(e) }).into() };
local_ret
}
#[must_use]
extern "C" fn ChainMonitor_Watch_update_channel(this_arg: *const c_void, mut funding_txo: crate::chain::transaction::OutPoint, mut update: crate::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CResult_NoneChannelMonitorUpdateErrZ {
- let mut ret = <nativeChainMonitor as WatchTraitImport<_>>::update_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, *unsafe { Box::from_raw(update.take_inner()) });
+ let mut ret = <nativeChainMonitor as lightning::chain::Watch<_>>::update_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, *unsafe { Box::from_raw(update.take_inner()) });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::chain::channelmonitor::ChannelMonitorUpdateErr::native_into(e) }).into() };
local_ret
}
#[must_use]
extern "C" fn ChainMonitor_Watch_release_pending_monitor_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MonitorEventZ {
- let mut ret = <nativeChainMonitor as WatchTraitImport<_>>::release_pending_monitor_events(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, );
+ let mut ret = <nativeChainMonitor as lightning::chain::Watch<_>>::release_pending_monitor_events(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, );
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::chain::channelmonitor::MonitorEvent::native_into(item) }); };
local_ret.into()
}
get_and_clear_pending_events: ChainMonitor_EventsProvider_get_and_clear_pending_events,
}
}
-use lightning::util::events::EventsProvider as EventsProviderTraitImport;
+
#[must_use]
extern "C" fn ChainMonitor_EventsProvider_get_and_clear_pending_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_EventZ {
- let mut ret = <nativeChainMonitor as EventsProviderTraitImport<>>::get_and_clear_pending_events(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, );
+ let mut ret = <nativeChainMonitor as lightning::util::events::EventsProvider<>>::get_and_clear_pending_events(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, );
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::Event::native_into(item) }); };
local_ret.into()
}
impl Drop for ChannelMonitorUpdate {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelMonitorUpdate>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelMonitorUpdate {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelMonitorUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for MonitorUpdateError {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeMonitorUpdateError>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for MonitorUpdateError {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeMonitorUpdateError>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for HTLCUpdate {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeHTLCUpdate>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for HTLCUpdate {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeHTLCUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
/// 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
impl Drop for ChannelMonitor {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelMonitor>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
/// panics if the given update is not the next update by update_id.
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &mut ChannelMonitor, updates: &crate::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::chain::chaininterface::FeeEstimator, logger: &crate::util::logger::Logger) -> crate::c_types::derived::CResult_NoneMonitorUpdateErrorZ {
- let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.update_monitor(unsafe { &*updates.inner }, broadcaster, fee_estimator, logger);
+pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &ChannelMonitor, updates: &crate::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::chain::chaininterface::FeeEstimator, logger: &crate::util::logger::Logger) -> crate::c_types::derived::CResult_NoneMonitorUpdateErrorZ {
+ let mut ret = unsafe { &*this_arg.inner }.update_monitor(unsafe { &*updates.inner }, broadcaster, fee_estimator, logger);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::chain::channelmonitor::MonitorUpdateError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
#[no_mangle]
pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &ChannelMonitor) -> crate::c_types::derived::C2Tuple_OutPointScriptZ {
let mut ret = unsafe { &*this_arg.inner }.get_funding_txo();
- let (ref orig_ret_0, ref orig_ret_1) = ret; let mut local_ret = (crate::chain::transaction::OutPoint { inner: unsafe { ( (&(*orig_ret_0) as *const _) as *mut _) }, is_owned: false }, orig_ret_1.clone().into_bytes().into()).into();
+ let (mut orig_ret_0, mut orig_ret_1) = ret; let mut local_ret = (crate::chain::transaction::OutPoint { inner: Box::into_raw(Box::new(orig_ret_0)), is_owned: true }, orig_ret_1.into_bytes().into()).into();
local_ret
}
/// [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &mut ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ {
- let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_and_clear_pending_monitor_events();
+pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ {
+ let mut ret = unsafe { &*this_arg.inner }.get_and_clear_pending_monitor_events();
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::chain::channelmonitor::MonitorEvent::native_into(item) }); };
local_ret.into()
}
/// no internal locking in ChannelMonitors.
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &mut ChannelMonitor) -> crate::c_types::derived::CVec_EventZ {
- let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_and_clear_pending_events();
+pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_EventZ {
+ let mut ret = unsafe { &*this_arg.inner }.get_and_clear_pending_events();
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::Event::native_into(item) }); };
local_ret.into()
}
/// In any-case, choice is up to the user.
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &mut ChannelMonitor, logger: &crate::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ {
- let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.get_latest_holder_commitment_txn(logger);
+pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &ChannelMonitor, logger: &crate::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ {
+ let mut ret = unsafe { &*this_arg.inner }.get_latest_holder_commitment_txn(logger);
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let mut local_ret_0 = ::bitcoin::consensus::encode::serialize(&item); crate::c_types::Transaction::from_vec(local_ret_0) }); };
local_ret.into()
}
/// [`get_outputs_to_watch`]: #method.get_outputs_to_watch
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelMonitor_block_connected(this_arg: &mut ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut logger: crate::util::logger::Logger) -> crate::c_types::derived::CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
+pub extern "C" fn ChannelMonitor_block_connected(this_arg: &ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut logger: crate::util::logger::Logger) -> crate::c_types::derived::CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
- let mut ret = unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height, broadcaster, fee_estimator, logger);
+ let mut ret = unsafe { &*this_arg.inner }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height, broadcaster, fee_estimator, logger);
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
local_ret.into()
}
/// Determines if the disconnected block contained any transactions of interest and updates
/// appropriately.
#[no_mangle]
-pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &mut ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut logger: crate::util::logger::Logger) {
- unsafe { &mut (*(this_arg.inner as *mut nativeChannelMonitor)) }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger)
+pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::chain::chaininterface::FeeEstimator, mut logger: crate::util::logger::Logger) {
+ unsafe { &*this_arg.inner }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger)
}
/// `Persist` defines behavior for persisting channel monitors: this could mean
impl Drop for DelayedPaymentOutputDescriptor {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeDelayedPaymentOutputDescriptor>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for DelayedPaymentOutputDescriptor {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeDelayedPaymentOutputDescriptor>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for StaticPaymentOutputDescriptor {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeStaticPaymentOutputDescriptor>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for StaticPaymentOutputDescriptor {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeStaticPaymentOutputDescriptor>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for InMemorySigner {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeInMemorySigner>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for InMemorySigner {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeInMemorySigner>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
write: InMemorySigner_write_void,
}
}
-use lightning::chain::keysinterface::Sign as SignTraitImport;
+
#[must_use]
extern "C" fn InMemorySigner_Sign_get_per_commitment_point(this_arg: *const c_void, mut idx: u64) -> crate::c_types::PublicKey {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::get_per_commitment_point(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, idx, secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::get_per_commitment_point(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, idx, secp256k1::SECP256K1);
crate::c_types::PublicKey::from_rust(&ret)
}
#[must_use]
extern "C" fn InMemorySigner_Sign_release_commitment_secret(this_arg: *const c_void, mut idx: u64) -> crate::c_types::ThirtyTwoBytes {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::release_commitment_secret(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, idx);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::release_commitment_secret(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, idx);
crate::c_types::ThirtyTwoBytes { data: ret }
}
#[must_use]
extern "C" fn InMemorySigner_Sign_pubkeys(this_arg: *const c_void) -> crate::ln::chan_utils::ChannelPublicKeys {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::pubkeys(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, );
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::pubkeys(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, );
crate::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ( (&(*ret) as *const _) as *mut _) }, is_owned: false }
}
extern "C" fn InMemorySigner_Sign_set_pubkeys(trait_self_arg: &Sign) {
}
#[must_use]
extern "C" fn InMemorySigner_Sign_channel_keys_id(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::channel_keys_id(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, );
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::channel_keys_id(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, );
crate::c_types::ThirtyTwoBytes { data: ret }
}
#[must_use]
extern "C" fn InMemorySigner_Sign_sign_counterparty_commitment(this_arg: *const c_void, commitment_tx: &crate::ln::chan_utils::CommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::sign_counterparty_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, unsafe { &*commitment_tx.inner }, secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::sign_counterparty_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, unsafe { &*commitment_tx.inner }, secp256k1::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::Signature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::Signature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_Sign_sign_holder_commitment_and_htlcs(this_arg: *const c_void, commitment_tx: &crate::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::sign_holder_commitment_and_htlcs(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, unsafe { &*commitment_tx.inner }, secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::sign_holder_commitment_and_htlcs(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, unsafe { &*commitment_tx.inner }, secp256k1::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::Signature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::Signature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_Sign_sign_justice_transaction(this_arg: *const c_void, mut justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ {
let mut local_htlc = if htlc.inner.is_null() { None } else { Some((* { unsafe { &*htlc.inner } }).clone()) };
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::sign_justice_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), &local_htlc, secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::sign_justice_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), &local_htlc, secp256k1::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_Sign_sign_counterparty_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: crate::c_types::PublicKey, htlc: &crate::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::sign_counterparty_htlc_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &htlc_tx.into_bitcoin(), input, amount, &per_commitment_point.into_rust(), unsafe { &*htlc.inner }, secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::sign_counterparty_htlc_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &htlc_tx.into_bitcoin(), input, amount, &per_commitment_point.into_rust(), unsafe { &*htlc.inner }, secp256k1::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_Sign_sign_closing_transaction(this_arg: *const c_void, mut closing_tx: crate::c_types::Transaction) -> crate::c_types::derived::CResult_SignatureNoneZ {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::sign_closing_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &closing_tx.into_bitcoin(), secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::sign_closing_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &closing_tx.into_bitcoin(), secp256k1::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }).into() };
local_ret
}
#[must_use]
extern "C" fn InMemorySigner_Sign_sign_channel_announcement(this_arg: *const c_void, msg: &crate::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_SignatureNoneZ {
- let mut ret = <nativeInMemorySigner as SignTraitImport<>>::sign_channel_announcement(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, unsafe { &*msg.inner }, secp256k1::SECP256K1);
+ let mut ret = <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::sign_channel_announcement(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, unsafe { &*msg.inner }, secp256k1::SECP256K1);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }).into() };
local_ret
}
extern "C" fn InMemorySigner_Sign_ready_channel(this_arg: *mut c_void, channel_parameters: &crate::ln::chan_utils::ChannelTransactionParameters) {
- <nativeInMemorySigner as SignTraitImport<>>::ready_channel(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, unsafe { &*channel_parameters.inner })
+ <nativeInMemorySigner as lightning::chain::keysinterface::Sign<>>::ready_channel(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, unsafe { &*channel_parameters.inner })
}
#[no_mangle]
impl Drop for KeysManager {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeKeysManager>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
read_chan_signer: KeysManager_KeysInterface_read_chan_signer,
}
}
-use lightning::chain::keysinterface::KeysInterface as KeysInterfaceTraitImport;
+
#[must_use]
extern "C" fn KeysManager_KeysInterface_get_node_secret(this_arg: *const c_void) -> crate::c_types::SecretKey {
- let mut ret = <nativeKeysManager as KeysInterfaceTraitImport<>>::get_node_secret(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
+ let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_node_secret(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
crate::c_types::SecretKey::from_rust(ret)
}
#[must_use]
extern "C" fn KeysManager_KeysInterface_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z {
- let mut ret = <nativeKeysManager as KeysInterfaceTraitImport<>>::get_destination_script(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
+ let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_destination_script(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
ret.into_bytes().into()
}
#[must_use]
extern "C" fn KeysManager_KeysInterface_get_shutdown_pubkey(this_arg: *const c_void) -> crate::c_types::PublicKey {
- let mut ret = <nativeKeysManager as KeysInterfaceTraitImport<>>::get_shutdown_pubkey(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
+ let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_shutdown_pubkey(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
crate::c_types::PublicKey::from_rust(&ret)
}
#[must_use]
extern "C" fn KeysManager_KeysInterface_get_channel_signer(this_arg: *const c_void, mut _inbound: bool, mut channel_value_satoshis: u64) -> crate::chain::keysinterface::Sign {
- let mut ret = <nativeKeysManager as KeysInterfaceTraitImport<>>::get_channel_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, _inbound, channel_value_satoshis);
+ let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_channel_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, _inbound, channel_value_satoshis);
ret.into()
}
#[must_use]
extern "C" fn KeysManager_KeysInterface_get_secure_random_bytes(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes {
- let mut ret = <nativeKeysManager as KeysInterfaceTraitImport<>>::get_secure_random_bytes(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
+ let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::get_secure_random_bytes(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, );
crate::c_types::ThirtyTwoBytes { data: ret }
}
#[must_use]
extern "C" fn KeysManager_KeysInterface_read_chan_signer(this_arg: *const c_void, mut reader: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SignDecodeErrorZ {
- let mut ret = <nativeKeysManager as KeysInterfaceTraitImport<>>::read_chan_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, reader.to_slice());
+ let mut ret = <nativeKeysManager as lightning::chain::keysinterface::KeysInterface<>>::read_chan_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, reader.to_slice());
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
impl Drop for OutPoint {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeOutPoint>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for OutPoint {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeOutPoint>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for TxCreationKeys {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeTxCreationKeys>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for TxCreationKeys {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeTxCreationKeys>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ChannelPublicKeys {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelPublicKeys>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelPublicKeys {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelPublicKeys>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for HTLCOutputInCommitment {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeHTLCOutputInCommitment>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for HTLCOutputInCommitment {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeHTLCOutputInCommitment>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ChannelTransactionParameters {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelTransactionParameters>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelTransactionParameters {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelTransactionParameters>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for CounterpartyChannelTransactionParameters {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeCounterpartyChannelTransactionParameters>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for CounterpartyChannelTransactionParameters {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeCounterpartyChannelTransactionParameters>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for DirectedChannelTransactionParameters {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeDirectedChannelTransactionParameters>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Drop for HolderCommitmentTransaction {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeHolderCommitmentTransaction>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for HolderCommitmentTransaction {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeHolderCommitmentTransaction>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for BuiltCommitmentTransaction {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeBuiltCommitmentTransaction>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for BuiltCommitmentTransaction {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeBuiltCommitmentTransaction>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for CommitmentTransaction {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeCommitmentTransaction>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for CommitmentTransaction {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeCommitmentTransaction>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for TrustedCommitmentTransaction {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeTrustedCommitmentTransaction>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
/// 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
impl Drop for ChannelManager {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelManager>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
}
}
+use lightning::ln::channelmanager::ChainParameters as nativeChainParametersImport;
+type nativeChainParameters = nativeChainParametersImport;
+
+/// 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`.
+#[must_use]
+#[repr(C)]
+pub struct ChainParameters {
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeChainParameters,
+ pub is_owned: bool,
+}
+
+impl Drop for ChainParameters {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeChainParameters>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn ChainParameters_free(this_ptr: ChainParameters) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn ChainParameters_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChainParameters); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl ChainParameters {
+ pub(crate) fn take_inner(mut self) -> *mut nativeChainParameters {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+/// The network for determining the `chain_hash` in Lightning messages.
+#[no_mangle]
+pub extern "C" fn ChainParameters_get_network(this_ptr: &ChainParameters) -> crate::bitcoin::network::Network {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.network;
+ crate::bitcoin::network::Network::from_bitcoin((*inner_val))
+}
+/// The network for determining the `chain_hash` in Lightning messages.
+#[no_mangle]
+pub extern "C" fn ChainParameters_set_network(this_ptr: &mut ChainParameters, mut val: crate::bitcoin::network::Network) {
+ unsafe { &mut *this_ptr.inner }.network = val.into_bitcoin();
+}
+/// The hash of the latest block successfully connected.
+#[no_mangle]
+pub extern "C" fn ChainParameters_get_latest_hash(this_ptr: &ChainParameters) -> *const [u8; 32] {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.latest_hash;
+ (*inner_val).as_inner()
+}
+/// The hash of the latest block successfully connected.
+#[no_mangle]
+pub extern "C" fn ChainParameters_set_latest_hash(this_ptr: &mut ChainParameters, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *this_ptr.inner }.latest_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+}
+/// The height of the latest block successfully connected.
+///
+/// Used to track on-chain channel funding outputs and send payments with reliable timelocks.
+#[no_mangle]
+pub extern "C" fn ChainParameters_get_latest_height(this_ptr: &ChainParameters) -> usize {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.latest_height;
+ (*inner_val)
+}
+/// The height of the latest block successfully connected.
+///
+/// Used to track on-chain channel funding outputs and send payments with reliable timelocks.
+#[no_mangle]
+pub extern "C" fn ChainParameters_set_latest_height(this_ptr: &mut ChainParameters, mut val: usize) {
+ unsafe { &mut *this_ptr.inner }.latest_height = val;
+}
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChainParameters_new(mut network_arg: crate::bitcoin::network::Network, mut latest_hash_arg: crate::c_types::ThirtyTwoBytes, mut latest_height_arg: usize) -> ChainParameters {
+ ChainParameters { inner: Box::into_raw(Box::new(nativeChainParameters {
+ network: network_arg.into_bitcoin(),
+ latest_hash: ::bitcoin::hash_types::BlockHash::from_slice(&latest_hash_arg.data[..]).unwrap(),
+ latest_height: latest_height_arg,
+ })), is_owned: true }
+}
+
use lightning::ln::channelmanager::ChannelDetails as nativeChannelDetailsImport;
type nativeChannelDetails = nativeChannelDetailsImport;
impl Drop for ChannelDetails {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelDetails>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelDetails {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelDetails>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
///
/// 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]
#[no_mangle]
-pub extern "C" fn ChannelManager_new(mut network: crate::bitcoin::network::Network, mut fee_est: crate::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::chain::Watch, mut tx_broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut keys_manager: crate::chain::keysinterface::KeysInterface, mut config: crate::util::config::UserConfig, mut current_blockchain_height: usize) -> ChannelManager {
- let mut ret = lightning::ln::channelmanager::ChannelManager::new(network.into_bitcoin(), fee_est, chain_monitor, tx_broadcaster, logger, keys_manager, *unsafe { Box::from_raw(config.take_inner()) }, current_blockchain_height);
+pub extern "C" fn ChannelManager_new(mut fee_est: crate::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::chain::Watch, mut tx_broadcaster: crate::chain::chaininterface::BroadcasterInterface, mut logger: crate::util::logger::Logger, mut keys_manager: crate::chain::keysinterface::KeysInterface, mut config: crate::util::config::UserConfig, mut params: crate::ln::channelmanager::ChainParameters) -> ChannelManager {
+ let mut ret = lightning::ln::channelmanager::ChannelManager::new(fee_est, chain_monitor, tx_broadcaster, logger, keys_manager, *unsafe { Box::from_raw(config.take_inner()) }, *unsafe { Box::from_raw(params.take_inner()) });
ChannelManager { inner: Box::into_raw(Box::new(ret)), is_owned: true }
}
/// 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.
#[no_mangle]
pub extern "C" fn ChannelManager_timer_chan_freshness_every_min(this_arg: &ChannelManager) {
unsafe { &*this_arg.inner }.timer_chan_freshness_every_min()
get_and_clear_pending_msg_events: ChannelManager_MessageSendEventsProvider_get_and_clear_pending_msg_events,
}
}
-use lightning::util::events::MessageSendEventsProvider as MessageSendEventsProviderTraitImport;
+
#[must_use]
extern "C" fn ChannelManager_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
- let mut ret = <nativeChannelManager as MessageSendEventsProviderTraitImport<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
+ let mut ret = <nativeChannelManager as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
local_ret.into()
}
get_and_clear_pending_events: ChannelManager_EventsProvider_get_and_clear_pending_events,
}
}
-use lightning::util::events::EventsProvider as EventsProviderTraitImport;
+
#[must_use]
extern "C" fn ChannelManager_EventsProvider_get_and_clear_pending_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_EventZ {
- let mut ret = <nativeChannelManager as EventsProviderTraitImport<>>::get_and_clear_pending_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
+ let mut ret = <nativeChannelManager as lightning::util::events::EventsProvider<>>::get_and_clear_pending_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::Event::native_into(item) }); };
local_ret.into()
}
block_disconnected: ChannelManager_Listen_block_disconnected,
}
}
-use lightning::chain::Listen as ListenTraitImport;
+
extern "C" fn ChannelManager_Listen_block_connected(this_arg: *const c_void, mut block: crate::c_types::u8slice, mut height: u32) {
- <nativeChannelManager as ListenTraitImport<>>::block_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height)
+ <nativeChannelManager as lightning::chain::Listen<>>::block_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height)
}
extern "C" fn ChannelManager_Listen_block_disconnected(this_arg: *const c_void, header: *const [u8; 80], mut _height: u32) {
- <nativeChannelManager as ListenTraitImport<>>::block_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), _height)
+ <nativeChannelManager as lightning::chain::Listen<>>::block_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), _height)
}
/// Updates channel state based on transactions seen in a connected block.
unsafe { &*this_arg.inner }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap())
}
-/// Blocks until ChannelManager needs to be persisted. Only one listener on `wait` is
-/// guaranteed to be woken up.
+/// 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.
#[no_mangle]
pub extern "C" fn ChannelManager_await_persistable_update(this_arg: &ChannelManager) {
unsafe { &*this_arg.inner }.await_persistable_update()
},
}
}
-use lightning::ln::msgs::ChannelMessageHandler as ChannelMessageHandlerTraitImport;
+
extern "C" fn ChannelManager_ChannelMessageHandler_handle_open_channel(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::OpenChannel) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_open_channel(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_inner()) }, unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_open_channel(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_inner()) }, unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_accept_channel(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::AcceptChannel) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_accept_channel(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_inner()) }, unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_accept_channel(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), *unsafe { Box::from_raw(their_features.take_inner()) }, unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_created(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingCreated) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_funding_created(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_created(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_signed(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingSigned) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_locked(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingLocked) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_funding_locked(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_locked(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, their_features: &crate::ln::features::InitFeatures, msg: &crate::ln::msgs::Shutdown) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*their_features.inner }, unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*their_features.inner }, unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_closing_signed(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ClosingSigned) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_closing_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_closing_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_add_htlc(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateAddHTLC) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFulfillHTLC) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_htlc(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailHTLC) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_malformed_htlc(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailMalformedHTLC) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_update_fail_malformed_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_fail_malformed_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_commitment_signed(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::CommitmentSigned) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_revoke_and_ack(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::RevokeAndACK) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fee(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFee) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_update_fee(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_fee(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::AnnouncementSignatures) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), no_connection_possible)
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), no_connection_possible)
}
extern "C" fn ChannelManager_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, init_msg: &crate::ln::msgs::Init) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*init_msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*init_msg.inner })
}
extern "C" fn ChannelManager_ChannelMessageHandler_handle_error(this_arg: *const c_void, mut counterparty_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ErrorMessage) {
- <nativeChannelManager as ChannelMessageHandlerTraitImport<>>::handle_error(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
+ <nativeChannelManager as lightning::ln::msgs::ChannelMessageHandler<>>::handle_error(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &counterparty_node_id.into_rust(), unsafe { &*msg.inner })
}
-use lightning::util::events::MessageSendEventsProvider as nativeMessageSendEventsProviderTrait;
#[must_use]
extern "C" fn ChannelManager_ChannelMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
- let mut ret = <nativeChannelManager as MessageSendEventsProviderTraitImport<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
+ let mut ret = <nativeChannelManager as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
local_ret.into()
}
/// 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.
#[must_use]
#[repr(C)]
pub struct ChannelManagerReadArgs {
impl Drop for ChannelManagerReadArgs {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelManagerReadArgs>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for InitFeatures {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeInitFeatures>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Clone for NodeFeatures {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeNodeFeatures>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Clone for ChannelFeatures {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelFeatures>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for InitFeatures {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeInitFeatures>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Drop for NodeFeatures {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeNodeFeatures>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Drop for ChannelFeatures {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelFeatures>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Drop for DecodeError {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeDecodeError>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for DecodeError {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeDecodeError>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for Init {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeInit>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for Init {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeInit>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ErrorMessage {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeErrorMessage>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ErrorMessage {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeErrorMessage>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for Ping {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativePing>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for Ping {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativePing>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for Pong {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativePong>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for Pong {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativePong>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for OpenChannel {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeOpenChannel>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for OpenChannel {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeOpenChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for AcceptChannel {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeAcceptChannel>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for AcceptChannel {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeAcceptChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for FundingCreated {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeFundingCreated>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for FundingCreated {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeFundingCreated>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for FundingSigned {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeFundingSigned>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for FundingSigned {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeFundingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for FundingLocked {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeFundingLocked>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for FundingLocked {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeFundingLocked>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for Shutdown {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeShutdown>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for Shutdown {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeShutdown>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ClosingSigned {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeClosingSigned>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ClosingSigned {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeClosingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UpdateAddHTLC {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUpdateAddHTLC>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UpdateAddHTLC {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUpdateAddHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UpdateFulfillHTLC {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUpdateFulfillHTLC>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UpdateFulfillHTLC {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UpdateFailHTLC {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUpdateFailHTLC>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UpdateFailHTLC {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUpdateFailHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UpdateFailMalformedHTLC {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UpdateFailMalformedHTLC {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for CommitmentSigned {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeCommitmentSigned>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for CommitmentSigned {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeCommitmentSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for RevokeAndACK {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeRevokeAndACK>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for RevokeAndACK {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UpdateFee {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUpdateFee>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UpdateFee {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUpdateFee>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for DataLossProtect {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeDataLossProtect>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for DataLossProtect {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeDataLossProtect>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ChannelReestablish {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelReestablish>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelReestablish {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for AnnouncementSignatures {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeAnnouncementSignatures>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for AnnouncementSignatures {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UnsignedNodeAnnouncement {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UnsignedNodeAnnouncement {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for NodeAnnouncement {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeNodeAnnouncement>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for NodeAnnouncement {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UnsignedChannelAnnouncement {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UnsignedChannelAnnouncement {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ChannelAnnouncement {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelAnnouncement>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelAnnouncement {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UnsignedChannelUpdate {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUnsignedChannelUpdate>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UnsignedChannelUpdate {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ChannelUpdate {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelUpdate>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelUpdate {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for QueryChannelRange {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeQueryChannelRange>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for QueryChannelRange {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeQueryChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ReplyChannelRange {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeReplyChannelRange>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ReplyChannelRange {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeReplyChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for QueryShortChannelIds {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeQueryShortChannelIds>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for QueryShortChannelIds {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeQueryShortChannelIds>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ReplyShortChannelIdsEnd {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ReplyShortChannelIdsEnd {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for GossipTimestampFilter {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeGossipTimestampFilter>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for GossipTimestampFilter {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeGossipTimestampFilter>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for LightningError {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeLightningError>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for LightningError {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeLightningError>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for CommitmentUpdate {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeCommitmentUpdate>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for CommitmentUpdate {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeCommitmentUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
use crate::c_types::*;
+use lightning::ln::peer_handler::IgnoringMessageHandler as nativeIgnoringMessageHandlerImport;
+type nativeIgnoringMessageHandler = nativeIgnoringMessageHandlerImport;
+
+/// 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.
+#[must_use]
+#[repr(C)]
+pub struct IgnoringMessageHandler {
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeIgnoringMessageHandler,
+ pub is_owned: bool,
+}
+
+impl Drop for IgnoringMessageHandler {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeIgnoringMessageHandler>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn IgnoringMessageHandler_free(this_ptr: IgnoringMessageHandler) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn IgnoringMessageHandler_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeIgnoringMessageHandler); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl IgnoringMessageHandler {
+ pub(crate) fn take_inner(mut self) -> *mut nativeIgnoringMessageHandler {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+#[must_use]
+#[no_mangle]
+pub extern "C" fn IgnoringMessageHandler_new() -> IgnoringMessageHandler {
+ IgnoringMessageHandler { inner: Box::into_raw(Box::new(nativeIgnoringMessageHandler {
+ })), is_owned: true }
+}
+impl From<nativeIgnoringMessageHandler> for crate::util::events::MessageSendEventsProvider {
+ fn from(obj: nativeIgnoringMessageHandler) -> Self {
+ let mut rust_obj = IgnoringMessageHandler { inner: Box::into_raw(Box::new(obj)), is_owned: true };
+ let mut ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&rust_obj);
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+ rust_obj.inner = std::ptr::null_mut();
+ ret.free = Some(IgnoringMessageHandler_free_void);
+ ret
+ }
+}
+#[no_mangle]
+pub extern "C" fn IgnoringMessageHandler_as_MessageSendEventsProvider(this_arg: &IgnoringMessageHandler) -> crate::util::events::MessageSendEventsProvider {
+ crate::util::events::MessageSendEventsProvider {
+ this_arg: unsafe { (*this_arg).inner as *mut c_void },
+ free: None,
+ get_and_clear_pending_msg_events: IgnoringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events,
+ }
+}
+
+#[must_use]
+extern "C" fn IgnoringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, );
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
+ local_ret.into()
+}
+
+impl From<nativeIgnoringMessageHandler> for crate::ln::msgs::RoutingMessageHandler {
+ fn from(obj: nativeIgnoringMessageHandler) -> Self {
+ let mut rust_obj = IgnoringMessageHandler { inner: Box::into_raw(Box::new(obj)), is_owned: true };
+ let mut ret = IgnoringMessageHandler_as_RoutingMessageHandler(&rust_obj);
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+ rust_obj.inner = std::ptr::null_mut();
+ ret.free = Some(IgnoringMessageHandler_free_void);
+ ret
+ }
+}
+#[no_mangle]
+pub extern "C" fn IgnoringMessageHandler_as_RoutingMessageHandler(this_arg: &IgnoringMessageHandler) -> crate::ln::msgs::RoutingMessageHandler {
+ crate::ln::msgs::RoutingMessageHandler {
+ this_arg: unsafe { (*this_arg).inner as *mut c_void },
+ free: None,
+ handle_node_announcement: IgnoringMessageHandler_RoutingMessageHandler_handle_node_announcement,
+ handle_channel_announcement: IgnoringMessageHandler_RoutingMessageHandler_handle_channel_announcement,
+ handle_channel_update: IgnoringMessageHandler_RoutingMessageHandler_handle_channel_update,
+ handle_htlc_fail_channel_update: IgnoringMessageHandler_RoutingMessageHandler_handle_htlc_fail_channel_update,
+ get_next_channel_announcements: IgnoringMessageHandler_RoutingMessageHandler_get_next_channel_announcements,
+ get_next_node_announcements: IgnoringMessageHandler_RoutingMessageHandler_get_next_node_announcements,
+ sync_routing_table: IgnoringMessageHandler_RoutingMessageHandler_sync_routing_table,
+ handle_reply_channel_range: IgnoringMessageHandler_RoutingMessageHandler_handle_reply_channel_range,
+ handle_reply_short_channel_ids_end: IgnoringMessageHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end,
+ handle_query_channel_range: IgnoringMessageHandler_RoutingMessageHandler_handle_query_channel_range,
+ handle_query_short_channel_ids: IgnoringMessageHandler_RoutingMessageHandler_handle_query_short_channel_ids,
+ MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider {
+ this_arg: unsafe { (*this_arg).inner as *mut c_void },
+ free: None,
+ get_and_clear_pending_msg_events: IgnoringMessageHandler_RoutingMessageHandler_get_and_clear_pending_msg_events,
+ },
+ }
+}
+
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_node_announcement(this_arg: *const c_void, _msg: &crate::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, unsafe { &*_msg.inner });
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+ local_ret
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, _msg: &crate::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, unsafe { &*_msg.inner });
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+ local_ret
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_channel_update(this_arg: *const c_void, _msg: &crate::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, unsafe { &*_msg.inner });
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+ local_ret
+}
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_htlc_fail_channel_update(this_arg: *const c_void, _update: &crate::ln::msgs::HTLCFailChannelUpdate) {
+ <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_htlc_fail_channel_update(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &_update.to_native())
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_get_next_channel_announcements(this_arg: *const c_void, mut _starting_point: u64, mut _batch_amount: u8) -> crate::c_types::derived::CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_channel_announcements(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, _starting_point, _batch_amount);
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_1 = crate::ln::msgs::ChannelUpdate { inner: if orig_ret_0_1.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((orig_ret_0_1.unwrap()))) } }, is_owned: true }; let mut local_orig_ret_0_2 = crate::ln::msgs::ChannelUpdate { inner: if orig_ret_0_2.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((orig_ret_0_2.unwrap()))) } }, is_owned: true }; let mut local_ret_0 = (crate::ln::msgs::ChannelAnnouncement { inner: Box::into_raw(Box::new(orig_ret_0_0)), is_owned: true }, local_orig_ret_0_1, local_orig_ret_0_2).into(); local_ret_0 }); };
+ local_ret.into()
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_get_next_node_announcements(this_arg: *const c_void, mut _starting_point: crate::c_types::PublicKey, mut _batch_amount: u8) -> crate::c_types::derived::CVec_NodeAnnouncementZ {
+ let mut local__starting_point_base = if _starting_point.is_null() { None } else { Some( { _starting_point.into_rust() }) }; let mut local__starting_point = local__starting_point_base.as_ref();
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_node_announcements(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, local__starting_point, _batch_amount);
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::ln::msgs::NodeAnnouncement { inner: Box::into_raw(Box::new(item)), is_owned: true } }); };
+ local_ret.into()
+}
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_sync_routing_table(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, _init: &crate::ln::msgs::Init) {
+ <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::sync_routing_table(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &_their_node_id.into_rust(), unsafe { &*_init.inner })
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+ local_ret
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+ local_ret
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+ local_ret
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_query_short_channel_ids(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+ local_ret
+}
+#[must_use]
+extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
+ let mut ret = <nativeIgnoringMessageHandler as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, );
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
+ local_ret.into()
+}
+
+
+use lightning::ln::peer_handler::ErroringMessageHandler as nativeErroringMessageHandlerImport;
+type nativeErroringMessageHandler = nativeErroringMessageHandlerImport;
+
+/// A dummy struct which implements `ChannelMessageHandler` without having any channels.
+/// You can provide one of these as the route_handler in a MessageHandler.
+#[must_use]
+#[repr(C)]
+pub struct ErroringMessageHandler {
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeErroringMessageHandler,
+ pub is_owned: bool,
+}
+
+impl Drop for ErroringMessageHandler {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeErroringMessageHandler>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn ErroringMessageHandler_free(this_ptr: ErroringMessageHandler) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn ErroringMessageHandler_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErroringMessageHandler); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl ErroringMessageHandler {
+ pub(crate) fn take_inner(mut self) -> *mut nativeErroringMessageHandler {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+/// Constructs a new ErroringMessageHandler
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ErroringMessageHandler_new() -> ErroringMessageHandler {
+ let mut ret = lightning::ln::peer_handler::ErroringMessageHandler::new();
+ ErroringMessageHandler { inner: Box::into_raw(Box::new(ret)), is_owned: true }
+}
+
+impl From<nativeErroringMessageHandler> for crate::util::events::MessageSendEventsProvider {
+ fn from(obj: nativeErroringMessageHandler) -> Self {
+ let mut rust_obj = ErroringMessageHandler { inner: Box::into_raw(Box::new(obj)), is_owned: true };
+ let mut ret = ErroringMessageHandler_as_MessageSendEventsProvider(&rust_obj);
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+ rust_obj.inner = std::ptr::null_mut();
+ ret.free = Some(ErroringMessageHandler_free_void);
+ ret
+ }
+}
+#[no_mangle]
+pub extern "C" fn ErroringMessageHandler_as_MessageSendEventsProvider(this_arg: &ErroringMessageHandler) -> crate::util::events::MessageSendEventsProvider {
+ crate::util::events::MessageSendEventsProvider {
+ this_arg: unsafe { (*this_arg).inner as *mut c_void },
+ free: None,
+ get_and_clear_pending_msg_events: ErroringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events,
+ }
+}
+
+#[must_use]
+extern "C" fn ErroringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
+ let mut ret = <nativeErroringMessageHandler as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, );
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
+ local_ret.into()
+}
+
+impl From<nativeErroringMessageHandler> for crate::ln::msgs::ChannelMessageHandler {
+ fn from(obj: nativeErroringMessageHandler) -> Self {
+ let mut rust_obj = ErroringMessageHandler { inner: Box::into_raw(Box::new(obj)), is_owned: true };
+ let mut ret = ErroringMessageHandler_as_ChannelMessageHandler(&rust_obj);
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+ rust_obj.inner = std::ptr::null_mut();
+ ret.free = Some(ErroringMessageHandler_free_void);
+ ret
+ }
+}
+#[no_mangle]
+pub extern "C" fn ErroringMessageHandler_as_ChannelMessageHandler(this_arg: &ErroringMessageHandler) -> crate::ln::msgs::ChannelMessageHandler {
+ crate::ln::msgs::ChannelMessageHandler {
+ this_arg: unsafe { (*this_arg).inner as *mut c_void },
+ free: None,
+ handle_open_channel: ErroringMessageHandler_ChannelMessageHandler_handle_open_channel,
+ handle_accept_channel: ErroringMessageHandler_ChannelMessageHandler_handle_accept_channel,
+ handle_funding_created: ErroringMessageHandler_ChannelMessageHandler_handle_funding_created,
+ handle_funding_signed: ErroringMessageHandler_ChannelMessageHandler_handle_funding_signed,
+ handle_funding_locked: ErroringMessageHandler_ChannelMessageHandler_handle_funding_locked,
+ handle_shutdown: ErroringMessageHandler_ChannelMessageHandler_handle_shutdown,
+ handle_closing_signed: ErroringMessageHandler_ChannelMessageHandler_handle_closing_signed,
+ handle_update_add_htlc: ErroringMessageHandler_ChannelMessageHandler_handle_update_add_htlc,
+ handle_update_fulfill_htlc: ErroringMessageHandler_ChannelMessageHandler_handle_update_fulfill_htlc,
+ handle_update_fail_htlc: ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_htlc,
+ handle_update_fail_malformed_htlc: ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_malformed_htlc,
+ handle_commitment_signed: ErroringMessageHandler_ChannelMessageHandler_handle_commitment_signed,
+ handle_revoke_and_ack: ErroringMessageHandler_ChannelMessageHandler_handle_revoke_and_ack,
+ handle_update_fee: ErroringMessageHandler_ChannelMessageHandler_handle_update_fee,
+ handle_announcement_signatures: ErroringMessageHandler_ChannelMessageHandler_handle_announcement_signatures,
+ peer_disconnected: ErroringMessageHandler_ChannelMessageHandler_peer_disconnected,
+ peer_connected: ErroringMessageHandler_ChannelMessageHandler_peer_connected,
+ handle_channel_reestablish: ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish,
+ handle_error: ErroringMessageHandler_ChannelMessageHandler_handle_error,
+ MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider {
+ this_arg: unsafe { (*this_arg).inner as *mut c_void },
+ free: None,
+ get_and_clear_pending_msg_events: ErroringMessageHandler_ChannelMessageHandler_get_and_clear_pending_msg_events,
+ },
+ }
+}
+
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_open_channel(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut _their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::OpenChannel) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_open_channel(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(_their_features.take_inner()) }, unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_accept_channel(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut _their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::AcceptChannel) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_accept_channel(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(_their_features.take_inner()) }, unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_funding_created(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingCreated) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_created(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_funding_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingSigned) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_funding_locked(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingLocked) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_funding_locked(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, _their_features: &crate::ln::features::InitFeatures, msg: &crate::ln::msgs::Shutdown) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*_their_features.inner }, unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_closing_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ClosingSigned) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_closing_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_add_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateAddHTLC) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFulfillHTLC) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailHTLC) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_malformed_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailMalformedHTLC) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_fail_malformed_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_commitment_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::CommitmentSigned) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_revoke_and_ack(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::RevokeAndACK) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fee(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFee) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_update_fee(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::AnnouncementSignatures) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), unsafe { &*msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _no_connection_possible: bool) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), _no_connection_possible)
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, _msg: &crate::ln::msgs::Init) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::peer_connected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), unsafe { &*_msg.inner })
+}
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_error(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, _msg: &crate::ln::msgs::ErrorMessage) {
+ <nativeErroringMessageHandler as lightning::ln::msgs::ChannelMessageHandler<>>::handle_error(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &_their_node_id.into_rust(), unsafe { &*_msg.inner })
+}
+#[must_use]
+extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
+ let mut ret = <nativeErroringMessageHandler as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, );
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
+ local_ret.into()
+}
+
+
use lightning::ln::peer_handler::MessageHandler as nativeMessageHandlerImport;
type nativeMessageHandler = nativeMessageHandlerImport<crate::ln::msgs::ChannelMessageHandler, crate::ln::msgs::RoutingMessageHandler>;
impl Drop for MessageHandler {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeMessageHandler>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
}
}
/// A message handler which handles messages specific to channels. Usually this is just a
-/// ChannelManager object.
+/// ChannelManager object or a ErroringMessageHandler.
#[no_mangle]
pub extern "C" fn MessageHandler_get_chan_handler(this_ptr: &MessageHandler) -> *const crate::ln::msgs::ChannelMessageHandler {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chan_handler;
&(*inner_val)
}
/// A message handler which handles messages specific to channels. Usually this is just a
-/// ChannelManager object.
+/// ChannelManager object or a ErroringMessageHandler.
#[no_mangle]
pub extern "C" fn MessageHandler_set_chan_handler(this_ptr: &mut MessageHandler, mut val: crate::ln::msgs::ChannelMessageHandler) {
unsafe { &mut *this_ptr.inner }.chan_handler = 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.
#[no_mangle]
pub extern "C" fn MessageHandler_get_route_handler(this_ptr: &MessageHandler) -> *const crate::ln::msgs::RoutingMessageHandler {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.route_handler;
&(*inner_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.
#[no_mangle]
pub extern "C" fn MessageHandler_set_route_handler(this_ptr: &mut MessageHandler, mut val: crate::ln::msgs::RoutingMessageHandler) {
unsafe { &mut *this_ptr.inner }.route_handler = val;
impl Drop for PeerHandleError {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativePeerHandleError>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for PeerHandleError {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativePeerHandleError>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for PeerManager {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativePeerManager>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Drop for NetworkGraph {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeNetworkGraph>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for NetworkGraph {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeNetworkGraph>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for LockedNetworkGraph {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeLockedNetworkGraph>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Drop for NetGraphMsgHandler {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeNetGraphMsgHandler>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
NetGraphMsgHandler { inner: Box::into_raw(Box::new(ret)), is_owned: true }
}
+/// 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.
+#[no_mangle]
+pub extern "C" fn NetGraphMsgHandler_add_chain_access(this_arg: &mut NetGraphMsgHandler, chain_access: *mut crate::chain::Access) {
+ let mut local_chain_access = if chain_access == std::ptr::null_mut() { None } else { Some( { unsafe { *Box::from_raw(chain_access) } }) };
+ unsafe { &mut (*(this_arg.inner as *mut nativeNetGraphMsgHandler)) }.add_chain_access(local_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
/// bindings as you can call `self.network_graph.read().unwrap()` in Rust
},
}
}
-use lightning::ln::msgs::RoutingMessageHandler as RoutingMessageHandlerTraitImport;
+
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_node_announcement(this_arg: *const c_void, msg: &crate::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, unsafe { &*msg.inner });
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, unsafe { &*msg.inner });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, msg: &crate::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, unsafe { &*msg.inner });
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, unsafe { &*msg.inner });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_htlc_fail_channel_update(this_arg: *const c_void, update: &crate::ln::msgs::HTLCFailChannelUpdate) {
- <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::handle_htlc_fail_channel_update(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &update.to_native())
+ <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_htlc_fail_channel_update(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &update.to_native())
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_channel_update(this_arg: *const c_void, msg: &crate::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, unsafe { &*msg.inner });
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, unsafe { &*msg.inner });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_next_channel_announcements(this_arg: *const c_void, mut starting_point: u64, mut batch_amount: u8) -> crate::c_types::derived::CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::get_next_channel_announcements(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, starting_point, batch_amount);
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_channel_announcements(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, starting_point, batch_amount);
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_1 = crate::ln::msgs::ChannelUpdate { inner: if orig_ret_0_1.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((orig_ret_0_1.unwrap()))) } }, is_owned: true }; let mut local_orig_ret_0_2 = crate::ln::msgs::ChannelUpdate { inner: if orig_ret_0_2.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((orig_ret_0_2.unwrap()))) } }, is_owned: true }; let mut local_ret_0 = (crate::ln::msgs::ChannelAnnouncement { inner: Box::into_raw(Box::new(orig_ret_0_0)), is_owned: true }, local_orig_ret_0_1, local_orig_ret_0_2).into(); local_ret_0 }); };
local_ret.into()
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_next_node_announcements(this_arg: *const c_void, mut starting_point: crate::c_types::PublicKey, mut batch_amount: u8) -> crate::c_types::derived::CVec_NodeAnnouncementZ {
let mut local_starting_point_base = if starting_point.is_null() { None } else { Some( { starting_point.into_rust() }) }; let mut local_starting_point = local_starting_point_base.as_ref();
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::get_next_node_announcements(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, local_starting_point, batch_amount);
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::get_next_node_announcements(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, local_starting_point, batch_amount);
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::ln::msgs::NodeAnnouncement { inner: Box::into_raw(Box::new(item)), is_owned: true } }); };
local_ret.into()
}
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_sync_routing_table(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init_msg: &crate::ln::msgs::Init) {
- <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::sync_routing_table(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), unsafe { &*init_msg.inner })
+ <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::sync_routing_table(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), unsafe { &*init_msg.inner })
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_short_channel_ids(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as RoutingMessageHandlerTraitImport<>>::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
-use lightning::util::events::MessageSendEventsProvider as nativeMessageSendEventsProviderTrait;
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
- let mut ret = <nativeNetGraphMsgHandler as MessageSendEventsProviderTraitImport<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, );
+ let mut ret = <nativeNetGraphMsgHandler as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, );
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
local_ret.into()
}
get_and_clear_pending_msg_events: NetGraphMsgHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events,
}
}
-use lightning::util::events::MessageSendEventsProvider as MessageSendEventsProviderTraitImport;
+
#[must_use]
extern "C" fn NetGraphMsgHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
- let mut ret = <nativeNetGraphMsgHandler as MessageSendEventsProviderTraitImport<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, );
+ let mut ret = <nativeNetGraphMsgHandler as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, );
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
local_ret.into()
}
impl Drop for DirectionalChannelInfo {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeDirectionalChannelInfo>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for DirectionalChannelInfo {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeDirectionalChannelInfo>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ChannelInfo {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelInfo>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelInfo {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelInfo>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for RoutingFees {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeRoutingFees>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for RoutingFees {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeRoutingFees>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for NodeAnnouncementInfo {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeNodeAnnouncementInfo>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for NodeAnnouncementInfo {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeNodeAnnouncementInfo>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for NodeInfo {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeNodeInfo>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for NodeInfo {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeNodeInfo>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for RouteHop {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeRouteHop>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
pub extern "C" fn RouteHop_set_channel_features(this_ptr: &mut RouteHop, mut val: crate::ln::features::ChannelFeatures) {
unsafe { &mut *this_ptr.inner }.channel_features = *unsafe { Box::from_raw(val.take_inner()) };
}
-/// 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).
#[no_mangle]
pub extern "C" fn RouteHop_get_fee_msat(this_ptr: &RouteHop) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_msat;
(*inner_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).
#[no_mangle]
pub extern "C" fn RouteHop_set_fee_msat(this_ptr: &mut RouteHop, mut val: u64) {
unsafe { &mut *this_ptr.inner }.fee_msat = val;
impl Clone for RouteHop {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeRouteHop>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for Route {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeRoute>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for Route {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeRoute>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for RouteHint {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeRouteHint>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
pub extern "C" fn RouteHint_set_cltv_expiry_delta(this_ptr: &mut RouteHint, mut val: u16) {
unsafe { &mut *this_ptr.inner }.cltv_expiry_delta = val;
}
-/// The minimum value, in msat, which must be relayed to the next hop.
-#[no_mangle]
-pub extern "C" fn RouteHint_get_htlc_minimum_msat(this_ptr: &RouteHint) -> u64 {
- let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
- (*inner_val)
-}
-/// The minimum value, in msat, which must be relayed to the next hop.
-#[no_mangle]
-pub extern "C" fn RouteHint_set_htlc_minimum_msat(this_ptr: &mut RouteHint, mut val: u64) {
- unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
-}
-#[must_use]
-#[no_mangle]
-pub extern "C" fn RouteHint_new(mut src_node_id_arg: crate::c_types::PublicKey, mut short_channel_id_arg: u64, mut fees_arg: crate::routing::network_graph::RoutingFees, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64) -> RouteHint {
- RouteHint { inner: Box::into_raw(Box::new(nativeRouteHint {
- src_node_id: src_node_id_arg.into_rust(),
- short_channel_id: short_channel_id_arg,
- fees: *unsafe { Box::from_raw(fees_arg.take_inner()) },
- cltv_expiry_delta: cltv_expiry_delta_arg,
- htlc_minimum_msat: htlc_minimum_msat_arg,
- })), is_owned: true }
-}
impl Clone for RouteHint {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeRouteHint>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
pub extern "C" fn RouteHint_clone(orig: &RouteHint) -> RouteHint {
orig.clone()
}
-/// 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.
#[no_mangle]
-pub extern "C" fn get_route(mut our_node_id: crate::c_types::PublicKey, network: &crate::routing::network_graph::NetworkGraph, mut target: crate::c_types::PublicKey, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut last_hops: crate::c_types::derived::CVec_RouteHintZ, mut final_value_msat: u64, mut final_cltv: u32, mut logger: crate::util::logger::Logger) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
+pub extern "C" fn get_route(mut our_node_id: crate::c_types::PublicKey, network: &crate::routing::network_graph::NetworkGraph, mut payee: crate::c_types::PublicKey, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut last_hops: crate::c_types::derived::CVec_RouteHintZ, mut final_value_msat: u64, mut final_cltv: u32, mut logger: crate::util::logger::Logger) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
let mut local_first_hops_base = if first_hops == std::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { unsafe { &*item.inner } }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
let mut local_last_hops = Vec::new(); for mut item in last_hops.as_slice().iter() { local_last_hops.push( { unsafe { &*item.inner } }); };
- let mut ret = lightning::routing::router::get_route(&our_node_id.into_rust(), unsafe { &*network.inner }, &target.into_rust(), local_first_hops, &local_last_hops[..], final_value_msat, final_cltv, logger);
+ let mut ret = lightning::routing::router::get_route(&our_node_id.into_rust(), unsafe { &*network.inner }, &payee.into_rust(), local_first_hops, &local_last_hops[..], final_value_msat, final_cltv, logger);
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::router::Route { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
impl Drop for ChannelHandshakeConfig {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelHandshakeConfig>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelHandshakeConfig {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelHandshakeConfig>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ChannelHandshakeLimits {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelHandshakeLimits>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelHandshakeLimits {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelHandshakeLimits>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for ChannelConfig {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeChannelConfig>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for ChannelConfig {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeChannelConfig>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
impl Drop for UserConfig {
fn drop(&mut self) {
- if self.is_owned && !self.inner.is_null() {
+ if self.is_owned && !<*mut nativeUserConfig>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
impl Clone for UserConfig {
fn clone(&self) -> Self {
Self {
- inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+ inner: if <*mut nativeUserConfig>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}