Auto-generated bindings updates 2021-03-0.0.13-bindings
authorMatt Corallo <git@bluematt.me>
Sun, 7 Mar 2021 18:09:20 +0000 (13:09 -0500)
committerMatt Corallo <git@bluematt.me>
Sun, 7 Mar 2021 18:09:37 +0000 (13:09 -0500)
16 files changed:
lightning-c-bindings/include/lightning.h
lightning-c-bindings/include/lightningpp.hpp
lightning-c-bindings/include/rust_types.h
lightning-c-bindings/src/c_types/derived.rs
lightning-c-bindings/src/chain/chainmonitor.rs
lightning-c-bindings/src/chain/channelmonitor.rs
lightning-c-bindings/src/chain/keysinterface.rs
lightning-c-bindings/src/chain/transaction.rs
lightning-c-bindings/src/ln/chan_utils.rs
lightning-c-bindings/src/ln/channelmanager.rs
lightning-c-bindings/src/ln/features.rs
lightning-c-bindings/src/ln/msgs.rs
lightning-c-bindings/src/ln/peer_handler.rs
lightning-c-bindings/src/routing/network_graph.rs
lightning-c-bindings/src/routing/router.rs
lightning-c-bindings/src/util/config.rs

index 536d6a74cf7db1b5a3a88056db8a90eace2d1151..eb6f45b713c3d9bd4fbe60f69cd1c0744f634000 100644 (file)
@@ -160,6 +160,7 @@ typedef enum LDKNetwork {
    LDKNetwork_Bitcoin,
    LDKNetwork_Testnet,
    LDKNetwork_Regtest,
+   LDKNetwork_Signet,
    /**
     * Must be last for serialization purposes
     */
@@ -539,252 +540,6 @@ typedef struct LDKCResult_CVec_SignatureZNoneZ {
    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;
-
 
 
 /**
@@ -942,6 +697,48 @@ typedef struct MUST_USE_STRUCT LDKChannelReestablish {
 
 
 
+/**
+ * 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
  */
@@ -1213,81 +1010,285 @@ typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
    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;
 
 
 
@@ -2168,7 +2169,7 @@ typedef struct LDKSign {
  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
  * gotten are fully handled before re-serializing the new state.
  *
- * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
+ * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
  * returned block hash and the the current chain and then reconnecting blocks to get to the
@@ -2601,7 +2602,7 @@ typedef struct LDKLogger {
  * 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
@@ -3613,6 +3614,24 @@ typedef struct MUST_USE_STRUCT LDKKeysManager {
    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;
@@ -3716,15 +3735,26 @@ typedef struct LDKChannelMessageHandler {
  * 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 {
    /**
@@ -3830,6 +3860,36 @@ typedef struct LDKRoutingMessageHandler {
 
 
 
+/**
+ * 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.
  */
@@ -4073,6 +4133,34 @@ void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _r
 
 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);
@@ -4127,34 +4215,6 @@ void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecod
 
 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);
@@ -5278,7 +5338,7 @@ struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_
  *
  * 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
@@ -5297,7 +5357,7 @@ MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(co
  *
  * [`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
@@ -5307,7 +5367,7 @@ MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_m
  * 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
@@ -5320,7 +5380,7 @@ MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(s
  * 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:
@@ -5335,13 +5395,13 @@ MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commit
  *
  * [`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
@@ -5718,6 +5778,44 @@ struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager
 
 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);
 
 /**
@@ -5842,13 +5940,11 @@ struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSen
  *
  * 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.
@@ -5989,6 +6085,8 @@ void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager
  * 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);
 
@@ -6069,8 +6167,9 @@ void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR
 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
 
 /**
- * Blocks until ChannelManager needs to be persisted. Only one listener on `wait` is
- * guaranteed to be woken up.
+ * 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);
 
@@ -7833,29 +7932,48 @@ struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(s
 
 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);
 
@@ -8691,12 +8809,16 @@ struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop
 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);
 
@@ -8778,39 +8900,27 @@ uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR
  */
 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);
 
@@ -8835,6 +8945,13 @@ MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirt
  */
 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
index 78193157c19c652b4fbf36fdacb9fa79509091f0..3151b9c0cb6c013cd960d6ec6b459037b735668c 100644 (file)
@@ -165,6 +165,36 @@ public:
        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;
@@ -806,6 +836,21 @@ public:
        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;
@@ -2741,21 +2786,6 @@ public:
        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;
@@ -2771,6 +2801,21 @@ public:
        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;
index d998eb04cfbff82363b4eae47c74df234061de45..6d573e907dcf9264707618afea1bd34e7040e239 100644 (file)
@@ -30,6 +30,10 @@ struct nativeCommitmentTransactionOpaque;
 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;
@@ -81,6 +85,8 @@ struct nativeChannelMonitorOpaque;
 typedef struct nativeChannelMonitorOpaque LDKnativeChannelMonitor;
 struct nativeChannelManagerOpaque;
 typedef struct nativeChannelManagerOpaque LDKnativeChannelManager;
+struct nativeChainParametersOpaque;
+typedef struct nativeChainParametersOpaque LDKnativeChainParameters;
 struct nativeChannelDetailsOpaque;
 typedef struct nativeChannelDetailsOpaque LDKnativeChannelDetails;
 struct nativeChannelManagerReadArgsOpaque;
index f2211f191ee94f8fbe97e5494bac4626bb5c6cdd..c16f9a21c3030865e7b480592b2ebe4b164acbac 100644 (file)
@@ -950,70 +950,38 @@ impl Clone for CResult_CVec_SignatureZNoneZ {
 #[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); }
@@ -1022,36 +990,36 @@ impl Clone for CVec_u8Z {
        }
 }
 #[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() } {
@@ -1064,16 +1032,16 @@ impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
                }
        }
 }
-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,
@@ -1081,53 +1049,171 @@ impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate:
                }
        }
 }
-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 {
@@ -1137,16 +1223,16 @@ impl Drop for CResult_NonePeerHandleErrorZ {
                }
        }
 }
-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,
@@ -1154,15 +1240,235 @@ impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleEr
                }
        }
 }
-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 })))
                        } }
                }
        }
@@ -1500,312 +1806,6 @@ impl Clone for CResult_ChannelConfigDecodeErrorZ {
 #[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,
index de47fcb572f2ea177fe841abec29fd520fbf361c..c05f9017ca1eb6888aff883701b3642661b6339b 100644 (file)
@@ -49,7 +49,7 @@ pub struct ChainMonitor {
 
 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) };
                }
        }
@@ -137,22 +137,22 @@ pub extern "C" fn ChainMonitor_as_Watch(this_arg: &ChainMonitor) -> crate::chain
                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()
 }
@@ -175,10 +175,10 @@ pub extern "C" fn ChainMonitor_as_EventsProvider(this_arg: &ChainMonitor) -> cra
                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()
 }
index efab4b165d5f46c7e5830d00487daa72c8b79760..9fab7e0466a8f19ce06cd01bdd5db91e27847edb 100644 (file)
@@ -34,7 +34,7 @@ pub struct ChannelMonitorUpdate {
 
 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) };
                }
        }
@@ -94,7 +94,7 @@ pub extern "C" fn ChannelMonitorUpdate_set_update_id(this_ptr: &mut ChannelMonit
 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,
                }
@@ -243,7 +243,7 @@ pub struct MonitorUpdateError {
 
 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) };
                }
        }
@@ -268,7 +268,7 @@ impl MonitorUpdateError {
 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,
                }
@@ -386,7 +386,7 @@ pub struct HTLCUpdate {
 
 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) };
                }
        }
@@ -411,7 +411,7 @@ impl HTLCUpdate {
 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,
                }
@@ -455,7 +455,7 @@ type nativeChannelMonitor = nativeChannelMonitorImport<crate::chain::keysinterfa
 /// 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
@@ -471,7 +471,7 @@ pub struct ChannelMonitor {
 
 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) };
                }
        }
@@ -507,8 +507,8 @@ pub(crate) extern "C" fn ChannelMonitor_write_void(obj: *const c_void) -> crate:
 /// 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
 }
@@ -527,7 +527,7 @@ pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &ChannelMonitor)
 #[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
 }
 
@@ -537,8 +537,8 @@ pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &ChannelMonitor) -> c
 /// [`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()
 }
@@ -551,8 +551,8 @@ pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg:
 /// 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()
 }
@@ -568,8 +568,8 @@ pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &mut Cha
 /// 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()
 }
@@ -587,9 +587,9 @@ pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &mut
 /// [`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()
 }
@@ -597,8 +597,8 @@ pub extern "C" fn ChannelMonitor_block_connected(this_arg: &mut ChannelMonitor,
 /// 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
index 9235f8ec38a3924f183e1ffcb43cbb9f7648f7cf..abd779693d19fc365f56246acb084f6639c3fbcd 100644 (file)
@@ -23,7 +23,7 @@ pub struct DelayedPaymentOutputDescriptor {
 
 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) };
                }
        }
@@ -140,7 +140,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_new(mut outpoint_arg: crate::ch
 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,
                }
@@ -172,7 +172,7 @@ pub struct StaticPaymentOutputDescriptor {
 
 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) };
                }
        }
@@ -249,7 +249,7 @@ pub extern "C" fn StaticPaymentOutputDescriptor_new(mut outpoint_arg: crate::cha
 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,
                }
@@ -790,7 +790,7 @@ pub struct InMemorySigner {
 
 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) };
                }
        }
@@ -881,7 +881,7 @@ pub extern "C" fn InMemorySigner_set_commitment_seed(this_ptr: &mut InMemorySign
 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,
                }
@@ -1023,20 +1023,20 @@ pub extern "C" fn InMemorySigner_as_Sign(this_arg: &InMemorySigner) -> crate::ch
                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) {
@@ -1048,48 +1048,48 @@ 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]
@@ -1128,7 +1128,7 @@ pub struct KeysManager {
 
 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) };
                }
        }
@@ -1232,35 +1232,35 @@ pub extern "C" fn KeysManager_as_KeysInterface(this_arg: &KeysManager) -> crate:
                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
 }
index d0fd8c62112469ec8ede0856c6436a5d10c784e7..f9432230fe21237d11c9c9425b35d436da66ca6b 100644 (file)
@@ -23,7 +23,7 @@ pub struct OutPoint {
 
 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) };
                }
        }
@@ -78,7 +78,7 @@ pub extern "C" fn OutPoint_new(mut txid_arg: crate::c_types::ThirtyTwoBytes, mut
 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,
                }
index a32feb6e21442f0acab40ca2034ec926b9115493..4a2656780383e5b0d887a52d08fc7acf3b6fd336 100644 (file)
@@ -97,7 +97,7 @@ pub struct TxCreationKeys {
 
 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) };
                }
        }
@@ -192,7 +192,7 @@ pub extern "C" fn TxCreationKeys_new(mut per_commitment_point_arg: crate::c_type
 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,
                }
@@ -237,7 +237,7 @@ pub struct ChannelPublicKeys {
 
 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) };
                }
        }
@@ -346,7 +346,7 @@ pub extern "C" fn ChannelPublicKeys_new(mut funding_pubkey_arg: crate::c_types::
 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,
                }
@@ -423,7 +423,7 @@ pub struct HTLCOutputInCommitment {
 
 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) };
                }
        }
@@ -500,7 +500,7 @@ pub extern "C" fn HTLCOutputInCommitment_set_payment_hash(this_ptr: &mut HTLCOut
 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,
                }
@@ -573,7 +573,7 @@ pub struct ChannelTransactionParameters {
 
 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) };
                }
        }
@@ -674,7 +674,7 @@ pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate
 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,
                }
@@ -705,7 +705,7 @@ pub struct CounterpartyChannelTransactionParameters {
 
 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) };
                }
        }
@@ -760,7 +760,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_new(mut pubkeys_arg:
 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,
                }
@@ -853,7 +853,7 @@ pub struct DirectedChannelTransactionParameters {
 
 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) };
                }
        }
@@ -937,7 +937,7 @@ pub struct HolderCommitmentTransaction {
 
 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) };
                }
        }
@@ -979,7 +979,7 @@ pub extern "C" fn HolderCommitmentTransaction_set_counterparty_htlc_sigs(this_pt
 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,
                }
@@ -1034,7 +1034,7 @@ pub struct BuiltCommitmentTransaction {
 
 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) };
                }
        }
@@ -1096,7 +1096,7 @@ pub extern "C" fn BuiltCommitmentTransaction_new(mut transaction_arg: crate::c_t
 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,
                }
@@ -1165,7 +1165,7 @@ pub struct CommitmentTransaction {
 
 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) };
                }
        }
@@ -1190,7 +1190,7 @@ impl CommitmentTransaction {
 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,
                }
@@ -1299,7 +1299,7 @@ pub struct TrustedCommitmentTransaction {
 
 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) };
                }
        }
index a865372d0c27fdfda040714a7d7ce1374b0b98a7..86257f77e124d20f86c5ad81ccd182a02661a49b 100644 (file)
@@ -36,7 +36,7 @@ type nativeChannelManager = nativeChannelManagerImport<crate::chain::keysinterfa
 /// 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
@@ -64,7 +64,7 @@ pub struct ChannelManager {
 
 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) };
                }
        }
@@ -87,6 +87,94 @@ impl ChannelManager {
        }
 }
 
+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;
 
@@ -102,7 +190,7 @@ pub struct ChannelDetails {
 
 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) };
                }
        }
@@ -241,7 +329,7 @@ pub extern "C" fn ChannelDetails_set_is_live(this_ptr: &mut ChannelDetails, mut
 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,
                }
@@ -431,15 +519,13 @@ pub extern "C" fn PaymentSendFailure_clone(orig: &PaymentSendFailure) -> Payment
 ///
 /// 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 }
 }
 
@@ -612,6 +698,8 @@ pub extern "C" fn ChannelManager_process_pending_htlc_forwards(this_arg: &Channe
 /// 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()
@@ -704,10 +792,10 @@ pub extern "C" fn ChannelManager_as_MessageSendEventsProvider(this_arg: &Channel
                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()
 }
@@ -730,10 +818,10 @@ pub extern "C" fn ChannelManager_as_EventsProvider(this_arg: &ChannelManager) ->
                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()
 }
@@ -757,12 +845,12 @@ pub extern "C" fn ChannelManager_as_Listen(this_arg: &ChannelManager) -> crate::
                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.
@@ -781,8 +869,9 @@ pub extern "C" fn ChannelManager_block_disconnected(this_arg: &ChannelManager, h
        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()
@@ -829,68 +918,67 @@ pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: &ChannelMana
                },
        }
 }
-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()
 }
@@ -912,15 +1000,26 @@ type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static,
 /// 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 {
@@ -932,7 +1031,7 @@ 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) };
                }
        }
index 71adebeb5725210808a956616cc8fa71e0641575..06dc42020a1d1509c2137e2a2c3b74d76e6ad693 100644 (file)
@@ -23,7 +23,7 @@ use crate::c_types::*;
 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,
                }
@@ -41,7 +41,7 @@ pub extern "C" fn InitFeatures_clone(orig: &InitFeatures) -> InitFeatures {
 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,
                }
@@ -59,7 +59,7 @@ pub extern "C" fn NodeFeatures_clone(orig: &NodeFeatures) -> NodeFeatures {
 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,
                }
@@ -90,7 +90,7 @@ pub struct InitFeatures {
 
 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) };
                }
        }
@@ -128,7 +128,7 @@ pub struct NodeFeatures {
 
 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) };
                }
        }
@@ -166,7 +166,7 @@ pub struct ChannelFeatures {
 
 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) };
                }
        }
index 4425e24cbb6deba2d6920b20c3328004b7d1a0e6..416b532c103ba36a11e1ec0b7236fbc6766cfe19 100644 (file)
@@ -35,7 +35,7 @@ pub struct DecodeError {
 
 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) };
                }
        }
@@ -60,7 +60,7 @@ impl DecodeError {
 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,
                }
@@ -91,7 +91,7 @@ pub struct Init {
 
 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) };
                }
        }
@@ -134,7 +134,7 @@ pub extern "C" fn Init_new(mut features_arg: crate::ln::features::InitFeatures)
 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,
                }
@@ -165,7 +165,7 @@ pub struct ErrorMessage {
 
 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) };
                }
        }
@@ -226,7 +226,7 @@ pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwo
 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,
                }
@@ -257,7 +257,7 @@ pub struct Ping {
 
 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) };
                }
        }
@@ -314,7 +314,7 @@ pub extern "C" fn Ping_new(mut ponglen_arg: u16, mut byteslen_arg: u16) -> Ping
 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,
                }
@@ -345,7 +345,7 @@ pub struct Pong {
 
 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) };
                }
        }
@@ -390,7 +390,7 @@ pub extern "C" fn Pong_new(mut byteslen_arg: u16) -> Pong {
 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,
                }
@@ -421,7 +421,7 @@ pub struct OpenChannel {
 
 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) };
                }
        }
@@ -644,7 +644,7 @@ pub extern "C" fn OpenChannel_set_channel_flags(this_ptr: &mut OpenChannel, mut
 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,
                }
@@ -675,7 +675,7 @@ pub struct AcceptChannel {
 
 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) };
                }
        }
@@ -854,7 +854,7 @@ pub extern "C" fn AcceptChannel_set_first_per_commitment_point(this_ptr: &mut Ac
 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,
                }
@@ -885,7 +885,7 @@ pub struct FundingCreated {
 
 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) };
                }
        }
@@ -964,7 +964,7 @@ pub extern "C" fn FundingCreated_new(mut temporary_channel_id_arg: crate::c_type
 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,
                }
@@ -995,7 +995,7 @@ pub struct FundingSigned {
 
 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) };
                }
        }
@@ -1050,7 +1050,7 @@ pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTw
 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,
                }
@@ -1081,7 +1081,7 @@ pub struct FundingLocked {
 
 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) };
                }
        }
@@ -1136,7 +1136,7 @@ pub extern "C" fn FundingLocked_new(mut channel_id_arg: crate::c_types::ThirtyTw
 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,
                }
@@ -1167,7 +1167,7 @@ pub struct Shutdown {
 
 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) };
                }
        }
@@ -1224,7 +1224,7 @@ pub extern "C" fn Shutdown_new(mut channel_id_arg: crate::c_types::ThirtyTwoByte
 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,
                }
@@ -1255,7 +1255,7 @@ pub struct ClosingSigned {
 
 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) };
                }
        }
@@ -1322,7 +1322,7 @@ pub extern "C" fn ClosingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTw
 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,
                }
@@ -1353,7 +1353,7 @@ pub struct UpdateAddHTLC {
 
 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) };
                }
        }
@@ -1433,7 +1433,7 @@ pub extern "C" fn UpdateAddHTLC_set_cltv_expiry(this_ptr: &mut UpdateAddHTLC, mu
 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,
                }
@@ -1464,7 +1464,7 @@ pub struct UpdateFulfillHTLC {
 
 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) };
                }
        }
@@ -1531,7 +1531,7 @@ pub extern "C" fn UpdateFulfillHTLC_new(mut channel_id_arg: crate::c_types::Thir
 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,
                }
@@ -1562,7 +1562,7 @@ pub struct UpdateFailHTLC {
 
 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) };
                }
        }
@@ -1609,7 +1609,7 @@ pub extern "C" fn UpdateFailHTLC_set_htlc_id(this_ptr: &mut UpdateFailHTLC, mut
 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,
                }
@@ -1640,7 +1640,7 @@ pub struct UpdateFailMalformedHTLC {
 
 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) };
                }
        }
@@ -1698,7 +1698,7 @@ pub extern "C" fn UpdateFailMalformedHTLC_set_failure_code(this_ptr: &mut Update
 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,
                }
@@ -1729,7 +1729,7 @@ pub struct CommitmentSigned {
 
 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) };
                }
        }
@@ -1792,7 +1792,7 @@ pub extern "C" fn CommitmentSigned_new(mut channel_id_arg: crate::c_types::Thirt
 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,
                }
@@ -1823,7 +1823,7 @@ pub struct RevokeAndACK {
 
 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) };
                }
        }
@@ -1890,7 +1890,7 @@ pub extern "C" fn RevokeAndACK_new(mut channel_id_arg: crate::c_types::ThirtyTwo
 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,
                }
@@ -1921,7 +1921,7 @@ pub struct UpdateFee {
 
 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) };
                }
        }
@@ -1976,7 +1976,7 @@ pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::c_types::ThirtyTwoByt
 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,
                }
@@ -2010,7 +2010,7 @@ pub struct DataLossProtect {
 
 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) };
                }
        }
@@ -2067,7 +2067,7 @@ pub extern "C" fn DataLossProtect_new(mut your_last_per_commitment_secret_arg: c
 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,
                }
@@ -2098,7 +2098,7 @@ pub struct ChannelReestablish {
 
 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) };
                }
        }
@@ -2156,7 +2156,7 @@ pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr:
 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,
                }
@@ -2187,7 +2187,7 @@ pub struct AnnouncementSignatures {
 
 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) };
                }
        }
@@ -2266,7 +2266,7 @@ pub extern "C" fn AnnouncementSignatures_new(mut channel_id_arg: crate::c_types:
 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,
                }
@@ -2490,7 +2490,7 @@ pub struct UnsignedNodeAnnouncement {
 
 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) };
                }
        }
@@ -2580,7 +2580,7 @@ pub extern "C" fn UnsignedNodeAnnouncement_set_addresses(this_ptr: &mut Unsigned
 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,
                }
@@ -2611,7 +2611,7 @@ pub struct NodeAnnouncement {
 
 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) };
                }
        }
@@ -2666,7 +2666,7 @@ pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::Signat
 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,
                }
@@ -2697,7 +2697,7 @@ pub struct UnsignedChannelAnnouncement {
 
 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) };
                }
        }
@@ -2799,7 +2799,7 @@ pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr: &mut U
 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,
                }
@@ -2830,7 +2830,7 @@ pub struct ChannelAnnouncement {
 
 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) };
                }
        }
@@ -2921,7 +2921,7 @@ pub extern "C" fn ChannelAnnouncement_new(mut node_signature_1_arg: crate::c_typ
 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,
                }
@@ -2952,7 +2952,7 @@ pub struct UnsignedChannelUpdate {
 
 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) };
                }
        }
@@ -3065,7 +3065,7 @@ pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr
 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,
                }
@@ -3096,7 +3096,7 @@ pub struct ChannelUpdate {
 
 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) };
                }
        }
@@ -3151,7 +3151,7 @@ pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::Signature
 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,
                }
@@ -3185,7 +3185,7 @@ pub struct QueryChannelRange {
 
 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) };
                }
        }
@@ -3252,7 +3252,7 @@ pub extern "C" fn QueryChannelRange_new(mut chain_hash_arg: crate::c_types::Thir
 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,
                }
@@ -3289,7 +3289,7 @@ pub struct ReplyChannelRange {
 
 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) };
                }
        }
@@ -3376,7 +3376,7 @@ pub extern "C" fn ReplyChannelRange_new(mut chain_hash_arg: crate::c_types::Thir
 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,
                }
@@ -3414,7 +3414,7 @@ pub struct QueryShortChannelIds {
 
 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) };
                }
        }
@@ -3465,7 +3465,7 @@ pub extern "C" fn QueryShortChannelIds_new(mut chain_hash_arg: crate::c_types::T
 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,
                }
@@ -3499,7 +3499,7 @@ pub struct ReplyShortChannelIdsEnd {
 
 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) };
                }
        }
@@ -3556,7 +3556,7 @@ pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types
 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,
                }
@@ -3589,7 +3589,7 @@ pub struct GossipTimestampFilter {
 
 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) };
                }
        }
@@ -3656,7 +3656,7 @@ pub extern "C" fn GossipTimestampFilter_new(mut chain_hash_arg: crate::c_types::
 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,
                }
@@ -3784,7 +3784,7 @@ pub struct LightningError {
 
 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) };
                }
        }
@@ -3839,7 +3839,7 @@ pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::derived::CVec_
 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,
                }
@@ -3871,7 +3871,7 @@ pub struct CommitmentUpdate {
 
 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) };
                }
        }
@@ -3961,7 +3961,7 @@ pub extern "C" fn CommitmentUpdate_new(mut update_add_htlcs_arg: crate::c_types:
 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,
                }
index d1b1538f68593e5ae2fc6c7a14c1e54bf4e29092..96966a8599444b43b73e0e18d87fe37f1cf61f61 100644 (file)
@@ -11,6 +11,358 @@ use bitcoin::hashes::Hash;
 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>;
 
@@ -26,7 +378,7 @@ pub struct MessageHandler {
 
 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) };
                }
        }
@@ -49,27 +401,27 @@ impl MessageHandler {
        }
 }
 /// 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;
@@ -196,7 +548,7 @@ pub struct PeerHandleError {
 
 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) };
                }
        }
@@ -241,7 +593,7 @@ pub extern "C" fn PeerHandleError_new(mut no_connection_possible_arg: bool) -> P
 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,
                }
@@ -279,7 +631,7 @@ pub struct PeerManager {
 
 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) };
                }
        }
index 51d92a18c80795ae3e78574eae2ce48fa1686ccd..72910e8a39934b97280c18c7f3d063a62031ce53 100644 (file)
@@ -20,7 +20,7 @@ pub struct NetworkGraph {
 
 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) };
                }
        }
@@ -45,7 +45,7 @@ impl NetworkGraph {
 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,
                }
@@ -78,7 +78,7 @@ pub struct LockedNetworkGraph {
 
 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) };
                }
        }
@@ -120,7 +120,7 @@ pub struct NetGraphMsgHandler {
 
 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) };
                }
        }
@@ -165,6 +165,15 @@ pub extern "C" fn NetGraphMsgHandler_from_net_graph(chain_access: *mut crate::ch
        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
@@ -217,72 +226,71 @@ pub extern "C" fn NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: &NetGrap
                },
        }
 }
-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()
 }
@@ -305,10 +313,10 @@ pub extern "C" fn NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg: &Net
                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()
 }
@@ -330,7 +338,7 @@ pub struct DirectionalChannelInfo {
 
 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) };
                }
        }
@@ -431,7 +439,7 @@ pub extern "C" fn DirectionalChannelInfo_set_last_update_message(this_ptr: &mut
 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,
                }
@@ -477,7 +485,7 @@ pub struct ChannelInfo {
 
 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) };
                }
        }
@@ -580,7 +588,7 @@ pub extern "C" fn ChannelInfo_set_announcement_message(this_ptr: &mut ChannelInf
 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,
                }
@@ -625,7 +633,7 @@ pub struct RoutingFees {
 
 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) };
                }
        }
@@ -682,7 +690,7 @@ pub extern "C" fn RoutingFees_new(mut base_msat_arg: u32, mut proportional_milli
 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,
                }
@@ -727,7 +735,7 @@ pub struct NodeAnnouncementInfo {
 
 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) };
                }
        }
@@ -841,7 +849,7 @@ pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::ln::features
 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,
                }
@@ -886,7 +894,7 @@ pub struct NodeInfo {
 
 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) };
                }
        }
@@ -963,7 +971,7 @@ pub extern "C" fn NodeInfo_new(mut channels_arg: crate::c_types::derived::CVec_u
 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,
                }
index ba1a18bb8a6c5b75a0d39ede14b5bd3194eefb64..32b4aebb926666e9d5a4bca6201189d5d636bb10 100644 (file)
@@ -23,7 +23,7 @@ pub struct RouteHop {
 
 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) };
                }
        }
@@ -93,13 +93,17 @@ pub extern "C" fn RouteHop_get_channel_features(this_ptr: &RouteHop) -> crate::l
 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;
@@ -132,7 +136,7 @@ pub extern "C" fn RouteHop_new(mut pubkey_arg: crate::c_types::PublicKey, mut no
 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,
                }
@@ -164,7 +168,7 @@ pub struct Route {
 
 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) };
                }
        }
@@ -208,7 +212,7 @@ pub extern "C" fn Route_new(mut paths_arg: crate::c_types::derived::CVec_CVec_Ro
 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,
                }
@@ -253,7 +257,7 @@ pub struct RouteHint {
 
 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) };
                }
        }
@@ -319,32 +323,10 @@ pub extern "C" fn RouteHint_get_cltv_expiry_delta(this_ptr: &RouteHint) -> u16 {
 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,
                }
@@ -359,27 +341,27 @@ pub(crate) extern "C" fn RouteHint_clone_void(this_ptr: *const c_void) -> *mut c
 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
 }
index 78e837485c6f0eef2c2f4eedf109bfca4ddf560f..9f8769d80231eda8b1dede261d1e99c7f436d18c 100644 (file)
@@ -23,7 +23,7 @@ pub struct ChannelHandshakeConfig {
 
 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) };
                }
        }
@@ -132,7 +132,7 @@ pub extern "C" fn ChannelHandshakeConfig_new(mut minimum_depth_arg: u32, mut our
 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,
                }
@@ -178,7 +178,7 @@ pub struct ChannelHandshakeLimits {
 
 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) };
                }
        }
@@ -415,7 +415,7 @@ pub extern "C" fn ChannelHandshakeLimits_new(mut min_funding_satoshis_arg: u64,
 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,
                }
@@ -452,7 +452,7 @@ pub struct ChannelConfig {
 
 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) };
                }
        }
@@ -567,7 +567,7 @@ pub extern "C" fn ChannelConfig_new(mut fee_proportional_millionths_arg: u32, mu
 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,
                }
@@ -620,7 +620,7 @@ pub struct UserConfig {
 
 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) };
                }
        }
@@ -687,7 +687,7 @@ pub extern "C" fn UserConfig_new(mut own_channel_config_arg: crate::util::config
 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,
                }