Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / MessageSendEvent.java
index 670c5b427fb89cd6a6c9f23230910d85c29a0c91..535c80c709d594fc056d9a16ce70ec062d47037b 100644 (file)
@@ -4,6 +4,7 @@ import org.ldk.impl.bindings;
 import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
+import java.lang.ref.Reference;
 import javax.annotation.Nullable;
 
 
@@ -70,9 +71,6 @@ public class MessageSendEvent extends CommonBase {
                if (raw_val.getClass() == bindings.LDKMessageSendEvent.HandleError.class) {
                        return new HandleError(ptr, (bindings.LDKMessageSendEvent.HandleError)raw_val);
                }
-               if (raw_val.getClass() == bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate.class) {
-                       return new PaymentFailureNetworkUpdate(ptr, (bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate)raw_val);
-               }
                if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelRangeQuery.class) {
                        return new SendChannelRangeQuery(ptr, (bindings.LDKMessageSendEvent.SendChannelRangeQuery)raw_val);
                }
@@ -85,6 +83,10 @@ public class MessageSendEvent extends CommonBase {
                assert false; return null; // Unreachable without extending the (internal) bindings interface
        }
 
+       /**
+        * Used to indicate that we've accepted a channel open and should send the accept_channel
+        * message provided to the given peer.
+        */
        public final static class SendAcceptChannel extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -98,11 +100,15 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       AcceptChannel msg_hu_conv = new AcceptChannel(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that we've initiated a channel open and should send the open_channel
+        * message provided to the given peer.
+        */
        public final static class SendOpenChannel extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -116,11 +122,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       OpenChannel msg_hu_conv = new OpenChannel(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
+        */
        public final static class SendFundingCreated extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -134,11 +143,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       FundingCreated msg_hu_conv = new FundingCreated(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
+        */
        public final static class SendFundingSigned extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -152,11 +164,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       FundingSigned msg_hu_conv = new FundingSigned(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
+        */
        public final static class SendFundingLocked extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive these message(s)
@@ -170,11 +185,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       FundingLocked msg_hu_conv = new FundingLocked(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
+        */
        public final static class SendAnnouncementSignatures extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive these message(s)
@@ -188,11 +206,15 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       AnnouncementSignatures msg_hu_conv = new AnnouncementSignatures(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
+        * message should be sent to the peer with the given node_id.
+        */
        public final static class UpdateHTLCs extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive these message(s)
@@ -206,11 +228,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long updates = obj.updates;
-                       CommitmentUpdate updates_hu_conv = new CommitmentUpdate(null, 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);
                        this.updates = updates_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
+        */
        public final static class SendRevokeAndACK extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -224,11 +249,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       RevokeAndACK msg_hu_conv = new RevokeAndACK(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
+        */
        public final static class SendClosingSigned extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -242,11 +270,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       ClosingSigned msg_hu_conv = new ClosingSigned(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
+        */
        public final static class SendShutdown extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -260,11 +291,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       Shutdown msg_hu_conv = new Shutdown(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
+        */
        public final static class SendChannelReestablish extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -278,11 +312,21 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       ChannelReestablish msg_hu_conv = new ChannelReestablish(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a channel_announcement and channel_update should be broadcast to all
+        * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
+        * 
+        * Note that after doing so, you very likely (unless you did so very recently) want to call
+        * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
+        * This ensures that any nodes which see our channel_announcement also have a relevant
+        * node_announcement, including relevant feature flags which may be important for routing
+        * through or to us.
+        */
        public final static class BroadcastChannelAnnouncement extends MessageSendEvent {
                /**
                 * The channel_announcement which should be sent.
@@ -295,15 +339,18 @@ public class MessageSendEvent extends CommonBase {
                private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) {
                        super(null, ptr);
                        long msg = obj.msg;
-                       ChannelAnnouncement msg_hu_conv = new ChannelAnnouncement(null, 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);
                        this.msg = msg_hu_conv;
                        long update_msg = obj.update_msg;
-                       ChannelUpdate update_msg_hu_conv = new ChannelUpdate(null, 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);
                        this.update_msg = update_msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a node_announcement should be broadcast to all peers.
+        */
        public final static class BroadcastNodeAnnouncement extends MessageSendEvent {
                /**
                 * The node_announcement which should be sent.
@@ -312,11 +359,14 @@ public class MessageSendEvent extends CommonBase {
                private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) {
                        super(null, ptr);
                        long msg = obj.msg;
-                       NodeAnnouncement msg_hu_conv = new NodeAnnouncement(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a channel_update should be broadcast to all peers.
+        */
        public final static class BroadcastChannelUpdate extends MessageSendEvent {
                /**
                 * The channel_update which should be sent.
@@ -325,11 +375,16 @@ public class MessageSendEvent extends CommonBase {
                private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) {
                        super(null, ptr);
                        long msg = obj.msg;
-                       ChannelUpdate msg_hu_conv = new ChannelUpdate(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Used to indicate that a channel_update should be sent to a single peer.
+        * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
+        * private channel and we shouldn't be informing all of our peers of channel parameters.
+        */
        public final static class SendChannelUpdate extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -343,11 +398,14 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       ChannelUpdate msg_hu_conv = new ChannelUpdate(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Broadcast an error downstream to be handled
+        */
        public final static class HandleError extends MessageSendEvent {
                /**
                 * The node_id of the node which should receive this message
@@ -366,19 +424,9 @@ public class MessageSendEvent extends CommonBase {
                        this.action = action_hu_conv;
                }
        }
-       public final static class PaymentFailureNetworkUpdate extends MessageSendEvent {
-               /**
-                * The channel/node update which should be sent to NetGraphMsgHandler
-               */
-               public final HTLCFailChannelUpdate update;
-               private PaymentFailureNetworkUpdate(long ptr, bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate obj) {
-                       super(null, ptr);
-                       long update = obj.update;
-                       HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
-                       update_hu_conv.ptrs_to.add(this);
-                       this.update = update_hu_conv;
-               }
-       }
+       /**
+        * Query a peer for channels with funding transaction UTXOs in a block range.
+        */
        public final static class SendChannelRangeQuery extends MessageSendEvent {
                /**
                 * The node_id of this message recipient
@@ -392,11 +440,15 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       QueryChannelRange msg_hu_conv = new QueryChannelRange(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Request routing gossip messages from a peer for a list of channels identified by
+        * their short_channel_ids.
+        */
        public final static class SendShortIdsQuery extends MessageSendEvent {
                /**
                 * The node_id of this message recipient
@@ -410,11 +462,15 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       QueryShortChannelIds msg_hu_conv = new QueryShortChannelIds(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       /**
+        * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
+        * emitted during processing of the query.
+        */
        public final static class SendReplyChannelRange extends MessageSendEvent {
                /**
                 * The node_id of this message recipient
@@ -428,17 +484,24 @@ public class MessageSendEvent extends CommonBase {
                        super(null, ptr);
                        this.node_id = obj.node_id;
                        long msg = obj.msg;
-                       ReplyChannelRange msg_hu_conv = new ReplyChannelRange(null, 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);
                        this.msg = msg_hu_conv;
                }
        }
+       long clone_ptr() {
+               long ret = bindings.MessageSendEvent_clone_ptr(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
        /**
         * Creates a copy of the MessageSendEvent
         */
        public MessageSendEvent clone() {
                long ret = bindings.MessageSendEvent_clone(this.ptr);
-               if (ret < 1024) { return null; }
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
@@ -448,11 +511,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_accept_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -460,11 +524,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_open_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -472,11 +537,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_funding_created(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -484,11 +550,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_funding_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -496,11 +563,12 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
         */
        public static MessageSendEvent send_funding_locked(byte[] node_id, FundingLocked msg) {
-               long ret = bindings.MessageSendEvent_send_funding_locked(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_funding_locked(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -508,11 +576,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_announcement_signatures(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -520,11 +589,12 @@ 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(node_id, updates == null ? 0 : updates.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_update_htlcs(InternalUtils.check_arr_len(node_id, 33), updates == null ? 0 : updates.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(updates);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(updates);
                return ret_hu_conv;
        }
 
@@ -532,11 +602,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_revoke_and_ack(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -544,11 +615,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_closing_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -556,11 +628,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_shutdown(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -568,11 +641,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_channel_reestablish(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -581,11 +655,11 @@ public class MessageSendEvent extends CommonBase {
         */
        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);
-               if (ret < 1024) { return null; }
+               Reference.reachabilityFence(msg);
+               Reference.reachabilityFence(update_msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
-               ret_hu_conv.ptrs_to.add(update_msg);
                return ret_hu_conv;
        }
 
@@ -594,10 +668,10 @@ public class MessageSendEvent extends CommonBase {
         */
        public static MessageSendEvent broadcast_node_announcement(NodeAnnouncement msg) {
                long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -606,10 +680,10 @@ public class MessageSendEvent extends CommonBase {
         */
        public static MessageSendEvent broadcast_channel_update(ChannelUpdate msg) {
                long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -617,11 +691,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_channel_update(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -629,19 +704,10 @@ public class MessageSendEvent extends CommonBase {
         * Utility method to constructs a new HandleError-variant MessageSendEvent
         */
        public static MessageSendEvent handle_error(byte[] node_id, ErrorAction action) {
-               long ret = bindings.MessageSendEvent_handle_error(node_id, action.ptr);
-               if (ret < 1024) { return null; }
-               MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               return ret_hu_conv;
-       }
-
-       /**
-        * Utility method to constructs a new PaymentFailureNetworkUpdate-variant MessageSendEvent
-        */
-       public static MessageSendEvent payment_failure_network_update(HTLCFailChannelUpdate update) {
-               long ret = bindings.MessageSendEvent_payment_failure_network_update(update.ptr);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_handle_error(InternalUtils.check_arr_len(node_id, 33), action.ptr);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(action);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
@@ -651,11 +717,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_channel_range_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -663,11 +730,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_short_ids_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }
 
@@ -675,11 +743,12 @@ 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(node_id, msg == null ? 0 : msg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               long ret = bindings.MessageSendEvent_send_reply_channel_range(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
+               Reference.reachabilityFence(node_id);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(msg);
                return ret_hu_conv;
        }