Merge pull request #117 from TheBlueMatt/2022-08-fix-npe
[ldk-java] / src / main / java / org / ldk / structs / MessageSendEvent.java
index 0beba4e7bca454e8b888d29f783264e5b535e5a9..ff26147f36ff4920d3ae5e8c5569a452cbd23473 100644 (file)
@@ -104,7 +104,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.AcceptChannel(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -126,7 +126,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.OpenChannel(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -147,7 +147,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.FundingCreated msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.FundingCreated(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -168,7 +168,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.FundingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.FundingSigned(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -189,7 +189,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.ChannelReady msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelReady(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -210,7 +210,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.AnnouncementSignatures msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.AnnouncementSignatures(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -232,7 +232,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long updates = obj.updates;
                        org.ldk.structs.CommitmentUpdate updates_hu_conv = null; if (updates < 0 || updates > 4096) { updates_hu_conv = new org.ldk.structs.CommitmentUpdate(null, updates); }
-                       updates_hu_conv.ptrs_to.add(this);
+                       if (updates_hu_conv != null) { updates_hu_conv.ptrs_to.add(this); };
                        this.updates = updates_hu_conv;
                }
        }
@@ -253,7 +253,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.RevokeAndACK msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.RevokeAndACK(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -274,7 +274,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.ClosingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ClosingSigned(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -295,7 +295,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.Shutdown(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -316,7 +316,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.ChannelReestablish msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelReestablish(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -343,11 +343,11 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        long msg = obj.msg;
                        org.ldk.structs.ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                        long update_msg = obj.update_msg;
                        org.ldk.structs.ChannelUpdate update_msg_hu_conv = null; if (update_msg < 0 || update_msg > 4096) { update_msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, update_msg); }
-                       update_msg_hu_conv.ptrs_to.add(this);
+                       if (update_msg_hu_conv != null) { update_msg_hu_conv.ptrs_to.add(this); };
                        this.update_msg = update_msg_hu_conv;
                }
        }
@@ -363,7 +363,7 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        long msg = obj.msg;
                        org.ldk.structs.NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.NodeAnnouncement(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -379,7 +379,7 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        long msg = obj.msg;
                        org.ldk.structs.ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -402,7 +402,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -423,7 +423,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long action = obj.action;
                        org.ldk.structs.ErrorAction action_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(action);
-                       action_hu_conv.ptrs_to.add(this);
+                       if (action_hu_conv != null) { action_hu_conv.ptrs_to.add(this); };
                        this.action = action_hu_conv;
                }
        }
@@ -444,7 +444,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.QueryChannelRange(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -466,7 +466,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -488,7 +488,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ReplyChannelRange(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -510,7 +510,7 @@ public class MessageSendEvent extends CommonBase {
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
                        org.ldk.structs.GossipTimestampFilter msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -528,7 +528,7 @@ public class MessageSendEvent extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -536,12 +536,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
         */
        public static MessageSendEvent send_accept_channel(byte[] node_id, AcceptChannel msg) {
-               long ret = bindings.MessageSendEvent_send_accept_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_accept_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -549,12 +550,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
         */
        public static MessageSendEvent send_open_channel(byte[] node_id, OpenChannel msg) {
-               long ret = bindings.MessageSendEvent_send_open_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_open_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -562,12 +564,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
         */
        public static MessageSendEvent send_funding_created(byte[] node_id, FundingCreated msg) {
-               long ret = bindings.MessageSendEvent_send_funding_created(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_funding_created(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -575,12 +578,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
         */
        public static MessageSendEvent send_funding_signed(byte[] node_id, FundingSigned msg) {
-               long ret = bindings.MessageSendEvent_send_funding_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_funding_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -588,12 +592,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
         */
        public static MessageSendEvent send_channel_ready(byte[] node_id, ChannelReady msg) {
-               long ret = bindings.MessageSendEvent_send_channel_ready(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_channel_ready(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -601,12 +606,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
         */
        public static MessageSendEvent send_announcement_signatures(byte[] node_id, AnnouncementSignatures msg) {
-               long ret = bindings.MessageSendEvent_send_announcement_signatures(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_announcement_signatures(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -614,12 +620,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
         */
        public static MessageSendEvent update_htlcs(byte[] node_id, CommitmentUpdate updates) {
-               long ret = bindings.MessageSendEvent_update_htlcs(InternalUtils.check_arr_len(node_id, 33), updates == null ? 0 : updates.ptr & ~1);
+               long ret = bindings.MessageSendEvent_update_htlcs(InternalUtils.check_arr_len(node_id, 33), updates == null ? 0 : updates.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(updates);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(updates); };
                return ret_hu_conv;
        }
 
@@ -627,12 +634,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
         */
        public static MessageSendEvent send_revoke_and_ack(byte[] node_id, RevokeAndACK msg) {
-               long ret = bindings.MessageSendEvent_send_revoke_and_ack(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_revoke_and_ack(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -640,12 +648,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
         */
        public static MessageSendEvent send_closing_signed(byte[] node_id, ClosingSigned msg) {
-               long ret = bindings.MessageSendEvent_send_closing_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_closing_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -653,12 +662,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendShutdown-variant MessageSendEvent
         */
        public static MessageSendEvent send_shutdown(byte[] node_id, Shutdown msg) {
-               long ret = bindings.MessageSendEvent_send_shutdown(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_shutdown(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -666,12 +676,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
         */
        public static MessageSendEvent send_channel_reestablish(byte[] node_id, ChannelReestablish msg) {
-               long ret = bindings.MessageSendEvent_send_channel_reestablish(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_channel_reestablish(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -679,12 +690,14 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
         */
        public static MessageSendEvent broadcast_channel_announcement(ChannelAnnouncement msg, ChannelUpdate update_msg) {
-               long ret = bindings.MessageSendEvent_broadcast_channel_announcement(msg == null ? 0 : msg.ptr & ~1, update_msg == null ? 0 : update_msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_broadcast_channel_announcement(msg == null ? 0 : msg.ptr, update_msg == null ? 0 : update_msg.ptr);
                Reference.reachabilityFence(msg);
                Reference.reachabilityFence(update_msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(update_msg); };
                return ret_hu_conv;
        }
 
@@ -692,11 +705,12 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
         */
        public static MessageSendEvent broadcast_node_announcement(NodeAnnouncement msg) {
-               long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -704,11 +718,12 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
         */
        public static MessageSendEvent broadcast_channel_update(ChannelUpdate msg) {
-               long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -716,12 +731,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
         */
        public static MessageSendEvent send_channel_update(byte[] node_id, ChannelUpdate msg) {
-               long ret = bindings.MessageSendEvent_send_channel_update(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_channel_update(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -734,7 +750,7 @@ public class MessageSendEvent extends CommonBase {
                Reference.reachabilityFence(action);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -742,12 +758,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
         */
        public static MessageSendEvent send_channel_range_query(byte[] node_id, QueryChannelRange msg) {
-               long ret = bindings.MessageSendEvent_send_channel_range_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_channel_range_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -755,12 +772,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
         */
        public static MessageSendEvent send_short_ids_query(byte[] node_id, QueryShortChannelIds msg) {
-               long ret = bindings.MessageSendEvent_send_short_ids_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_short_ids_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -768,12 +786,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
         */
        public static MessageSendEvent send_reply_channel_range(byte[] node_id, ReplyChannelRange msg) {
-               long ret = bindings.MessageSendEvent_send_reply_channel_range(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_reply_channel_range(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }
 
@@ -781,12 +800,13 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
         */
        public static MessageSendEvent send_gossip_timestamp_filter(byte[] node_id, GossipTimestampFilter msg) {
-               long ret = bindings.MessageSendEvent_send_gossip_timestamp_filter(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               long ret = bindings.MessageSendEvent_send_gossip_timestamp_filter(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
                Reference.reachabilityFence(node_id);
                Reference.reachabilityFence(msg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
                return ret_hu_conv;
        }