Merge pull request #117 from TheBlueMatt/2022-08-fix-npe
[ldk-java] / src / main / java / org / ldk / structs / MessageSendEvent.java
index 4d9633c153758dc808bb2e5637bb220e1c5c1913..ff26147f36ff4920d3ae5e8c5569a452cbd23473 100644 (file)
@@ -35,8 +35,8 @@ public class MessageSendEvent extends CommonBase {
                if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingSigned.class) {
                        return new SendFundingSigned(ptr, (bindings.LDKMessageSendEvent.SendFundingSigned)raw_val);
                }
-               if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingLocked.class) {
-                       return new SendFundingLocked(ptr, (bindings.LDKMessageSendEvent.SendFundingLocked)raw_val);
+               if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelReady.class) {
+                       return new SendChannelReady(ptr, (bindings.LDKMessageSendEvent.SendChannelReady)raw_val);
                }
                if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAnnouncementSignatures.class) {
                        return new SendAnnouncementSignatures(ptr, (bindings.LDKMessageSendEvent.SendAnnouncementSignatures)raw_val);
@@ -103,8 +103,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AcceptChannel(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.AcceptChannel(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -125,8 +125,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new OpenChannel(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.OpenChannel(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -146,8 +146,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       FundingCreated msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingCreated(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.FundingCreated msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.FundingCreated(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -167,29 +167,29 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       FundingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingSigned(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.FundingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.FundingSigned(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
        /**
-        * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
+        * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
         */
-       public final static class SendFundingLocked extends MessageSendEvent {
+       public final static class SendChannelReady extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive these message(s)
                */
                public final byte[] node_id;
                /**
-                * The funding_locked message which should be sent.
+                * The channel_ready message which should be sent.
                */
-               public final org.ldk.structs.FundingLocked msg;
-               private SendFundingLocked(long ptr, bindings.LDKMessageSendEvent.SendFundingLocked obj) {
+               public final org.ldk.structs.ChannelReady msg;
+               private SendChannelReady(long ptr, bindings.LDKMessageSendEvent.SendChannelReady obj) {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       FundingLocked msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingLocked(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.ChannelReady msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelReady(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -209,8 +209,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       AnnouncementSignatures msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AnnouncementSignatures(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.AnnouncementSignatures msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.AnnouncementSignatures(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -231,8 +231,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long updates = obj.updates;
-                       CommitmentUpdate updates_hu_conv = null; if (updates < 0 || updates > 4096) { updates_hu_conv = new CommitmentUpdate(null, updates); }
-                       updates_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.CommitmentUpdate updates_hu_conv = null; if (updates < 0 || updates > 4096) { updates_hu_conv = new org.ldk.structs.CommitmentUpdate(null, updates); }
+                       if (updates_hu_conv != null) { updates_hu_conv.ptrs_to.add(this); };
                        this.updates = updates_hu_conv;
                }
        }
@@ -252,8 +252,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       RevokeAndACK msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new RevokeAndACK(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.RevokeAndACK msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.RevokeAndACK(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -273,8 +273,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       ClosingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ClosingSigned(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.ClosingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ClosingSigned(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -294,8 +294,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new Shutdown(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.Shutdown(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -315,8 +315,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       ChannelReestablish msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelReestablish(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.ChannelReestablish msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelReestablish(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -342,12 +342,12 @@ public class MessageSendEvent extends CommonBase {
                private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) {
                        super(null, ptr);
                        long msg = obj.msg;
-                       ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelAnnouncement(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                        long update_msg = obj.update_msg;
-                       ChannelUpdate update_msg_hu_conv = null; if (update_msg < 0 || update_msg > 4096) { update_msg_hu_conv = new ChannelUpdate(null, update_msg); }
-                       update_msg_hu_conv.ptrs_to.add(this);
+                       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); }
+                       if (update_msg_hu_conv != null) { update_msg_hu_conv.ptrs_to.add(this); };
                        this.update_msg = update_msg_hu_conv;
                }
        }
@@ -362,8 +362,8 @@ public class MessageSendEvent extends CommonBase {
                private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) {
                        super(null, ptr);
                        long msg = obj.msg;
-                       NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new NodeAnnouncement(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.NodeAnnouncement(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -378,8 +378,8 @@ public class MessageSendEvent extends CommonBase {
                private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) {
                        super(null, ptr);
                        long msg = obj.msg;
-                       ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -401,8 +401,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, msg); }
+                       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;
                }
        }
@@ -443,8 +443,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryChannelRange(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.QueryChannelRange(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -465,8 +465,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryShortChannelIds(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -487,8 +487,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ReplyChannelRange(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ReplyChannelRange(null, msg); }
+                       if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
                        this.msg = msg_hu_conv;
                }
        }
@@ -509,8 +509,8 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       GossipTimestampFilter msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new GossipTimestampFilter(null, msg); }
-                       msg_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.GossipTimestampFilter msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, msg); }
+                       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,25 +578,27 @@ 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;
        }
 
        /**
-        * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
+        * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
         */
-       public static MessageSendEvent send_funding_locked(byte[] node_id, FundingLocked msg) {
-               long ret = bindings.MessageSendEvent_send_funding_locked(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+       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);
                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;
        }