[Java] Update auto-generated Java bindings for 0.0.113
[ldk-java] / src / main / java / org / ldk / structs / MessageSendEvent.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
13  * broadcast to most peers).
14  * These events are handled by PeerManager::process_events if you are using a PeerManager.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class MessageSendEvent extends CommonBase {
18         private MessageSendEvent(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.MessageSendEvent_free(ptr); }
23         }
24         static MessageSendEvent constr_from_ptr(long ptr) {
25                 bindings.LDKMessageSendEvent raw_val = bindings.LDKMessageSendEvent_ref_from_ptr(ptr);
26                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAcceptChannel.class) {
27                         return new SendAcceptChannel(ptr, (bindings.LDKMessageSendEvent.SendAcceptChannel)raw_val);
28                 }
29                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendOpenChannel.class) {
30                         return new SendOpenChannel(ptr, (bindings.LDKMessageSendEvent.SendOpenChannel)raw_val);
31                 }
32                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingCreated.class) {
33                         return new SendFundingCreated(ptr, (bindings.LDKMessageSendEvent.SendFundingCreated)raw_val);
34                 }
35                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingSigned.class) {
36                         return new SendFundingSigned(ptr, (bindings.LDKMessageSendEvent.SendFundingSigned)raw_val);
37                 }
38                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelReady.class) {
39                         return new SendChannelReady(ptr, (bindings.LDKMessageSendEvent.SendChannelReady)raw_val);
40                 }
41                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAnnouncementSignatures.class) {
42                         return new SendAnnouncementSignatures(ptr, (bindings.LDKMessageSendEvent.SendAnnouncementSignatures)raw_val);
43                 }
44                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.UpdateHTLCs.class) {
45                         return new UpdateHTLCs(ptr, (bindings.LDKMessageSendEvent.UpdateHTLCs)raw_val);
46                 }
47                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendRevokeAndACK.class) {
48                         return new SendRevokeAndACK(ptr, (bindings.LDKMessageSendEvent.SendRevokeAndACK)raw_val);
49                 }
50                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendClosingSigned.class) {
51                         return new SendClosingSigned(ptr, (bindings.LDKMessageSendEvent.SendClosingSigned)raw_val);
52                 }
53                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShutdown.class) {
54                         return new SendShutdown(ptr, (bindings.LDKMessageSendEvent.SendShutdown)raw_val);
55                 }
56                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelReestablish.class) {
57                         return new SendChannelReestablish(ptr, (bindings.LDKMessageSendEvent.SendChannelReestablish)raw_val);
58                 }
59                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelAnnouncement.class) {
60                         return new SendChannelAnnouncement(ptr, (bindings.LDKMessageSendEvent.SendChannelAnnouncement)raw_val);
61                 }
62                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement.class) {
63                         return new BroadcastChannelAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement)raw_val);
64                 }
65                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelUpdate.class) {
66                         return new BroadcastChannelUpdate(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelUpdate)raw_val);
67                 }
68                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelUpdate.class) {
69                         return new SendChannelUpdate(ptr, (bindings.LDKMessageSendEvent.SendChannelUpdate)raw_val);
70                 }
71                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.HandleError.class) {
72                         return new HandleError(ptr, (bindings.LDKMessageSendEvent.HandleError)raw_val);
73                 }
74                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelRangeQuery.class) {
75                         return new SendChannelRangeQuery(ptr, (bindings.LDKMessageSendEvent.SendChannelRangeQuery)raw_val);
76                 }
77                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShortIdsQuery.class) {
78                         return new SendShortIdsQuery(ptr, (bindings.LDKMessageSendEvent.SendShortIdsQuery)raw_val);
79                 }
80                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendReplyChannelRange.class) {
81                         return new SendReplyChannelRange(ptr, (bindings.LDKMessageSendEvent.SendReplyChannelRange)raw_val);
82                 }
83                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendGossipTimestampFilter.class) {
84                         return new SendGossipTimestampFilter(ptr, (bindings.LDKMessageSendEvent.SendGossipTimestampFilter)raw_val);
85                 }
86                 assert false; return null; // Unreachable without extending the (internal) bindings interface
87         }
88
89         /**
90          * Used to indicate that we've accepted a channel open and should send the accept_channel
91          * message provided to the given peer.
92          */
93         public final static class SendAcceptChannel extends MessageSendEvent {
94                 /**
95                  * The node_id of the node which should receive this message
96                 */
97                 public final byte[] node_id;
98                 /**
99                  * The message which should be sent.
100                 */
101                 public final org.ldk.structs.AcceptChannel msg;
102                 private SendAcceptChannel(long ptr, bindings.LDKMessageSendEvent.SendAcceptChannel obj) {
103                         super(null, ptr);
104                         this.node_id = obj.node_id;
105                         long msg = obj.msg;
106                         org.ldk.structs.AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.AcceptChannel(null, msg); }
107                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
108                         this.msg = msg_hu_conv;
109                 }
110         }
111         /**
112          * Used to indicate that we've initiated a channel open and should send the open_channel
113          * message provided to the given peer.
114          */
115         public final static class SendOpenChannel extends MessageSendEvent {
116                 /**
117                  * The node_id of the node which should receive this message
118                 */
119                 public final byte[] node_id;
120                 /**
121                  * The message which should be sent.
122                 */
123                 public final org.ldk.structs.OpenChannel msg;
124                 private SendOpenChannel(long ptr, bindings.LDKMessageSendEvent.SendOpenChannel obj) {
125                         super(null, ptr);
126                         this.node_id = obj.node_id;
127                         long msg = obj.msg;
128                         org.ldk.structs.OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.OpenChannel(null, msg); }
129                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
130                         this.msg = msg_hu_conv;
131                 }
132         }
133         /**
134          * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
135          */
136         public final static class SendFundingCreated extends MessageSendEvent {
137                 /**
138                  * The node_id of the node which should receive this message
139                 */
140                 public final byte[] node_id;
141                 /**
142                  * The message which should be sent.
143                 */
144                 public final org.ldk.structs.FundingCreated msg;
145                 private SendFundingCreated(long ptr, bindings.LDKMessageSendEvent.SendFundingCreated obj) {
146                         super(null, ptr);
147                         this.node_id = obj.node_id;
148                         long msg = obj.msg;
149                         org.ldk.structs.FundingCreated msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.FundingCreated(null, msg); }
150                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
151                         this.msg = msg_hu_conv;
152                 }
153         }
154         /**
155          * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
156          */
157         public final static class SendFundingSigned extends MessageSendEvent {
158                 /**
159                  * The node_id of the node which should receive this message
160                 */
161                 public final byte[] node_id;
162                 /**
163                  * The message which should be sent.
164                 */
165                 public final org.ldk.structs.FundingSigned msg;
166                 private SendFundingSigned(long ptr, bindings.LDKMessageSendEvent.SendFundingSigned obj) {
167                         super(null, ptr);
168                         this.node_id = obj.node_id;
169                         long msg = obj.msg;
170                         org.ldk.structs.FundingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.FundingSigned(null, msg); }
171                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
172                         this.msg = msg_hu_conv;
173                 }
174         }
175         /**
176          * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
177          */
178         public final static class SendChannelReady extends MessageSendEvent {
179                 /**
180                  * The node_id of the node which should receive these message(s)
181                 */
182                 public final byte[] node_id;
183                 /**
184                  * The channel_ready message which should be sent.
185                 */
186                 public final org.ldk.structs.ChannelReady msg;
187                 private SendChannelReady(long ptr, bindings.LDKMessageSendEvent.SendChannelReady obj) {
188                         super(null, ptr);
189                         this.node_id = obj.node_id;
190                         long msg = obj.msg;
191                         org.ldk.structs.ChannelReady msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelReady(null, msg); }
192                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
193                         this.msg = msg_hu_conv;
194                 }
195         }
196         /**
197          * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
198          */
199         public final static class SendAnnouncementSignatures extends MessageSendEvent {
200                 /**
201                  * The node_id of the node which should receive these message(s)
202                 */
203                 public final byte[] node_id;
204                 /**
205                  * The announcement_signatures message which should be sent.
206                 */
207                 public final org.ldk.structs.AnnouncementSignatures msg;
208                 private SendAnnouncementSignatures(long ptr, bindings.LDKMessageSendEvent.SendAnnouncementSignatures obj) {
209                         super(null, ptr);
210                         this.node_id = obj.node_id;
211                         long msg = obj.msg;
212                         org.ldk.structs.AnnouncementSignatures msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.AnnouncementSignatures(null, msg); }
213                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
214                         this.msg = msg_hu_conv;
215                 }
216         }
217         /**
218          * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
219          * message should be sent to the peer with the given node_id.
220          */
221         public final static class UpdateHTLCs extends MessageSendEvent {
222                 /**
223                  * The node_id of the node which should receive these message(s)
224                 */
225                 public final byte[] node_id;
226                 /**
227                  * The update messages which should be sent. ALL messages in the struct should be sent!
228                 */
229                 public final org.ldk.structs.CommitmentUpdate updates;
230                 private UpdateHTLCs(long ptr, bindings.LDKMessageSendEvent.UpdateHTLCs obj) {
231                         super(null, ptr);
232                         this.node_id = obj.node_id;
233                         long updates = obj.updates;
234                         org.ldk.structs.CommitmentUpdate updates_hu_conv = null; if (updates < 0 || updates > 4096) { updates_hu_conv = new org.ldk.structs.CommitmentUpdate(null, updates); }
235                         if (updates_hu_conv != null) { updates_hu_conv.ptrs_to.add(this); };
236                         this.updates = updates_hu_conv;
237                 }
238         }
239         /**
240          * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
241          */
242         public final static class SendRevokeAndACK extends MessageSendEvent {
243                 /**
244                  * The node_id of the node which should receive this message
245                 */
246                 public final byte[] node_id;
247                 /**
248                  * The message which should be sent.
249                 */
250                 public final org.ldk.structs.RevokeAndACK msg;
251                 private SendRevokeAndACK(long ptr, bindings.LDKMessageSendEvent.SendRevokeAndACK obj) {
252                         super(null, ptr);
253                         this.node_id = obj.node_id;
254                         long msg = obj.msg;
255                         org.ldk.structs.RevokeAndACK msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.RevokeAndACK(null, msg); }
256                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
257                         this.msg = msg_hu_conv;
258                 }
259         }
260         /**
261          * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
262          */
263         public final static class SendClosingSigned extends MessageSendEvent {
264                 /**
265                  * The node_id of the node which should receive this message
266                 */
267                 public final byte[] node_id;
268                 /**
269                  * The message which should be sent.
270                 */
271                 public final org.ldk.structs.ClosingSigned msg;
272                 private SendClosingSigned(long ptr, bindings.LDKMessageSendEvent.SendClosingSigned obj) {
273                         super(null, ptr);
274                         this.node_id = obj.node_id;
275                         long msg = obj.msg;
276                         org.ldk.structs.ClosingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ClosingSigned(null, msg); }
277                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
278                         this.msg = msg_hu_conv;
279                 }
280         }
281         /**
282          * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
283          */
284         public final static class SendShutdown extends MessageSendEvent {
285                 /**
286                  * The node_id of the node which should receive this message
287                 */
288                 public final byte[] node_id;
289                 /**
290                  * The message which should be sent.
291                 */
292                 public final org.ldk.structs.Shutdown msg;
293                 private SendShutdown(long ptr, bindings.LDKMessageSendEvent.SendShutdown obj) {
294                         super(null, ptr);
295                         this.node_id = obj.node_id;
296                         long msg = obj.msg;
297                         org.ldk.structs.Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.Shutdown(null, msg); }
298                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
299                         this.msg = msg_hu_conv;
300                 }
301         }
302         /**
303          * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
304          */
305         public final static class SendChannelReestablish extends MessageSendEvent {
306                 /**
307                  * The node_id of the node which should receive this message
308                 */
309                 public final byte[] node_id;
310                 /**
311                  * The message which should be sent.
312                 */
313                 public final org.ldk.structs.ChannelReestablish msg;
314                 private SendChannelReestablish(long ptr, bindings.LDKMessageSendEvent.SendChannelReestablish obj) {
315                         super(null, ptr);
316                         this.node_id = obj.node_id;
317                         long msg = obj.msg;
318                         org.ldk.structs.ChannelReestablish msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelReestablish(null, msg); }
319                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
320                         this.msg = msg_hu_conv;
321                 }
322         }
323         /**
324          * Used to send a channel_announcement and channel_update to a specific peer, likely on
325          * initial connection to ensure our peers know about our channels.
326          */
327         public final static class SendChannelAnnouncement extends MessageSendEvent {
328                 /**
329                  * The node_id of the node which should receive this message
330                 */
331                 public final byte[] node_id;
332                 /**
333                  * The channel_announcement which should be sent.
334                 */
335                 public final org.ldk.structs.ChannelAnnouncement msg;
336                 /**
337                  * The followup channel_update which should be sent.
338                 */
339                 public final org.ldk.structs.ChannelUpdate update_msg;
340                 private SendChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.SendChannelAnnouncement obj) {
341                         super(null, ptr);
342                         this.node_id = obj.node_id;
343                         long msg = obj.msg;
344                         org.ldk.structs.ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, msg); }
345                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
346                         this.msg = msg_hu_conv;
347                         long update_msg = obj.update_msg;
348                         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); }
349                         if (update_msg_hu_conv != null) { update_msg_hu_conv.ptrs_to.add(this); };
350                         this.update_msg = update_msg_hu_conv;
351                 }
352         }
353         /**
354          * Used to indicate that a channel_announcement and channel_update should be broadcast to all
355          * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
356          * 
357          * Note that after doing so, you very likely (unless you did so very recently) want to
358          * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
359          * ensures that any nodes which see our channel_announcement also have a relevant
360          * node_announcement, including relevant feature flags which may be important for routing
361          * through or to us.
362          * 
363          * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
364          */
365         public final static class BroadcastChannelAnnouncement extends MessageSendEvent {
366                 /**
367                  * The channel_announcement which should be sent.
368                 */
369                 public final org.ldk.structs.ChannelAnnouncement msg;
370                 /**
371                  * The followup channel_update which should be sent.
372                 */
373                 public final org.ldk.structs.ChannelUpdate update_msg;
374                 private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) {
375                         super(null, ptr);
376                         long msg = obj.msg;
377                         org.ldk.structs.ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, msg); }
378                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
379                         this.msg = msg_hu_conv;
380                         long update_msg = obj.update_msg;
381                         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); }
382                         if (update_msg_hu_conv != null) { update_msg_hu_conv.ptrs_to.add(this); };
383                         this.update_msg = update_msg_hu_conv;
384                 }
385         }
386         /**
387          * Used to indicate that a channel_update should be broadcast to all peers.
388          */
389         public final static class BroadcastChannelUpdate extends MessageSendEvent {
390                 /**
391                  * The channel_update which should be sent.
392                 */
393                 public final org.ldk.structs.ChannelUpdate msg;
394                 private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) {
395                         super(null, ptr);
396                         long msg = obj.msg;
397                         org.ldk.structs.ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, msg); }
398                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
399                         this.msg = msg_hu_conv;
400                 }
401         }
402         /**
403          * Used to indicate that a channel_update should be sent to a single peer.
404          * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
405          * private channel and we shouldn't be informing all of our peers of channel parameters.
406          */
407         public final static class SendChannelUpdate extends MessageSendEvent {
408                 /**
409                  * The node_id of the node which should receive this message
410                 */
411                 public final byte[] node_id;
412                 /**
413                  * The channel_update which should be sent.
414                 */
415                 public final org.ldk.structs.ChannelUpdate msg;
416                 private SendChannelUpdate(long ptr, bindings.LDKMessageSendEvent.SendChannelUpdate obj) {
417                         super(null, ptr);
418                         this.node_id = obj.node_id;
419                         long msg = obj.msg;
420                         org.ldk.structs.ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, msg); }
421                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
422                         this.msg = msg_hu_conv;
423                 }
424         }
425         /**
426          * Broadcast an error downstream to be handled
427          */
428         public final static class HandleError extends MessageSendEvent {
429                 /**
430                  * The node_id of the node which should receive this message
431                 */
432                 public final byte[] node_id;
433                 /**
434                  * The action which should be taken.
435                 */
436                 public final org.ldk.structs.ErrorAction action;
437                 private HandleError(long ptr, bindings.LDKMessageSendEvent.HandleError obj) {
438                         super(null, ptr);
439                         this.node_id = obj.node_id;
440                         long action = obj.action;
441                         org.ldk.structs.ErrorAction action_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(action);
442                         if (action_hu_conv != null) { action_hu_conv.ptrs_to.add(this); };
443                         this.action = action_hu_conv;
444                 }
445         }
446         /**
447          * Query a peer for channels with funding transaction UTXOs in a block range.
448          */
449         public final static class SendChannelRangeQuery extends MessageSendEvent {
450                 /**
451                  * The node_id of this message recipient
452                 */
453                 public final byte[] node_id;
454                 /**
455                  * The query_channel_range which should be sent.
456                 */
457                 public final org.ldk.structs.QueryChannelRange msg;
458                 private SendChannelRangeQuery(long ptr, bindings.LDKMessageSendEvent.SendChannelRangeQuery obj) {
459                         super(null, ptr);
460                         this.node_id = obj.node_id;
461                         long msg = obj.msg;
462                         org.ldk.structs.QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.QueryChannelRange(null, msg); }
463                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
464                         this.msg = msg_hu_conv;
465                 }
466         }
467         /**
468          * Request routing gossip messages from a peer for a list of channels identified by
469          * their short_channel_ids.
470          */
471         public final static class SendShortIdsQuery extends MessageSendEvent {
472                 /**
473                  * The node_id of this message recipient
474                 */
475                 public final byte[] node_id;
476                 /**
477                  * The query_short_channel_ids which should be sent.
478                 */
479                 public final org.ldk.structs.QueryShortChannelIds msg;
480                 private SendShortIdsQuery(long ptr, bindings.LDKMessageSendEvent.SendShortIdsQuery obj) {
481                         super(null, ptr);
482                         this.node_id = obj.node_id;
483                         long msg = obj.msg;
484                         org.ldk.structs.QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, msg); }
485                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
486                         this.msg = msg_hu_conv;
487                 }
488         }
489         /**
490          * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
491          * emitted during processing of the query.
492          */
493         public final static class SendReplyChannelRange extends MessageSendEvent {
494                 /**
495                  * The node_id of this message recipient
496                 */
497                 public final byte[] node_id;
498                 /**
499                  * The reply_channel_range which should be sent.
500                 */
501                 public final org.ldk.structs.ReplyChannelRange msg;
502                 private SendReplyChannelRange(long ptr, bindings.LDKMessageSendEvent.SendReplyChannelRange obj) {
503                         super(null, ptr);
504                         this.node_id = obj.node_id;
505                         long msg = obj.msg;
506                         org.ldk.structs.ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ReplyChannelRange(null, msg); }
507                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
508                         this.msg = msg_hu_conv;
509                 }
510         }
511         /**
512          * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
513          * enable receiving gossip messages from the peer.
514          */
515         public final static class SendGossipTimestampFilter extends MessageSendEvent {
516                 /**
517                  * The node_id of this message recipient
518                 */
519                 public final byte[] node_id;
520                 /**
521                  * The gossip_timestamp_filter which should be sent.
522                 */
523                 public final org.ldk.structs.GossipTimestampFilter msg;
524                 private SendGossipTimestampFilter(long ptr, bindings.LDKMessageSendEvent.SendGossipTimestampFilter obj) {
525                         super(null, ptr);
526                         this.node_id = obj.node_id;
527                         long msg = obj.msg;
528                         org.ldk.structs.GossipTimestampFilter msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, msg); }
529                         if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
530                         this.msg = msg_hu_conv;
531                 }
532         }
533         long clone_ptr() {
534                 long ret = bindings.MessageSendEvent_clone_ptr(this.ptr);
535                 Reference.reachabilityFence(this);
536                 return ret;
537         }
538
539         /**
540          * Creates a copy of the MessageSendEvent
541          */
542         public MessageSendEvent clone() {
543                 long ret = bindings.MessageSendEvent_clone(this.ptr);
544                 Reference.reachabilityFence(this);
545                 if (ret >= 0 && ret <= 4096) { return null; }
546                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
547                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
548                 return ret_hu_conv;
549         }
550
551         /**
552          * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
553          */
554         public static MessageSendEvent send_accept_channel(byte[] node_id, org.ldk.structs.AcceptChannel msg) {
555                 long ret = bindings.MessageSendEvent_send_accept_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
556                 Reference.reachabilityFence(node_id);
557                 Reference.reachabilityFence(msg);
558                 if (ret >= 0 && ret <= 4096) { return null; }
559                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
560                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
561                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
562                 return ret_hu_conv;
563         }
564
565         /**
566          * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
567          */
568         public static MessageSendEvent send_open_channel(byte[] node_id, org.ldk.structs.OpenChannel msg) {
569                 long ret = bindings.MessageSendEvent_send_open_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
570                 Reference.reachabilityFence(node_id);
571                 Reference.reachabilityFence(msg);
572                 if (ret >= 0 && ret <= 4096) { return null; }
573                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
574                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
575                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
576                 return ret_hu_conv;
577         }
578
579         /**
580          * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
581          */
582         public static MessageSendEvent send_funding_created(byte[] node_id, org.ldk.structs.FundingCreated msg) {
583                 long ret = bindings.MessageSendEvent_send_funding_created(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
584                 Reference.reachabilityFence(node_id);
585                 Reference.reachabilityFence(msg);
586                 if (ret >= 0 && ret <= 4096) { return null; }
587                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
588                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
589                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
590                 return ret_hu_conv;
591         }
592
593         /**
594          * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
595          */
596         public static MessageSendEvent send_funding_signed(byte[] node_id, org.ldk.structs.FundingSigned msg) {
597                 long ret = bindings.MessageSendEvent_send_funding_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
598                 Reference.reachabilityFence(node_id);
599                 Reference.reachabilityFence(msg);
600                 if (ret >= 0 && ret <= 4096) { return null; }
601                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
602                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
603                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
604                 return ret_hu_conv;
605         }
606
607         /**
608          * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
609          */
610         public static MessageSendEvent send_channel_ready(byte[] node_id, org.ldk.structs.ChannelReady msg) {
611                 long ret = bindings.MessageSendEvent_send_channel_ready(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
612                 Reference.reachabilityFence(node_id);
613                 Reference.reachabilityFence(msg);
614                 if (ret >= 0 && ret <= 4096) { return null; }
615                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
616                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
617                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
618                 return ret_hu_conv;
619         }
620
621         /**
622          * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
623          */
624         public static MessageSendEvent send_announcement_signatures(byte[] node_id, org.ldk.structs.AnnouncementSignatures msg) {
625                 long ret = bindings.MessageSendEvent_send_announcement_signatures(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
626                 Reference.reachabilityFence(node_id);
627                 Reference.reachabilityFence(msg);
628                 if (ret >= 0 && ret <= 4096) { return null; }
629                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
630                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
631                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
632                 return ret_hu_conv;
633         }
634
635         /**
636          * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
637          */
638         public static MessageSendEvent update_htlcs(byte[] node_id, org.ldk.structs.CommitmentUpdate updates) {
639                 long ret = bindings.MessageSendEvent_update_htlcs(InternalUtils.check_arr_len(node_id, 33), updates == null ? 0 : updates.ptr);
640                 Reference.reachabilityFence(node_id);
641                 Reference.reachabilityFence(updates);
642                 if (ret >= 0 && ret <= 4096) { return null; }
643                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
644                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
645                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(updates); };
646                 return ret_hu_conv;
647         }
648
649         /**
650          * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
651          */
652         public static MessageSendEvent send_revoke_and_ack(byte[] node_id, org.ldk.structs.RevokeAndACK msg) {
653                 long ret = bindings.MessageSendEvent_send_revoke_and_ack(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
654                 Reference.reachabilityFence(node_id);
655                 Reference.reachabilityFence(msg);
656                 if (ret >= 0 && ret <= 4096) { return null; }
657                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
658                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
659                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
660                 return ret_hu_conv;
661         }
662
663         /**
664          * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
665          */
666         public static MessageSendEvent send_closing_signed(byte[] node_id, org.ldk.structs.ClosingSigned msg) {
667                 long ret = bindings.MessageSendEvent_send_closing_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
668                 Reference.reachabilityFence(node_id);
669                 Reference.reachabilityFence(msg);
670                 if (ret >= 0 && ret <= 4096) { return null; }
671                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
672                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
673                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
674                 return ret_hu_conv;
675         }
676
677         /**
678          * Utility method to constructs a new SendShutdown-variant MessageSendEvent
679          */
680         public static MessageSendEvent send_shutdown(byte[] node_id, org.ldk.structs.Shutdown msg) {
681                 long ret = bindings.MessageSendEvent_send_shutdown(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
682                 Reference.reachabilityFence(node_id);
683                 Reference.reachabilityFence(msg);
684                 if (ret >= 0 && ret <= 4096) { return null; }
685                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
686                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
687                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
688                 return ret_hu_conv;
689         }
690
691         /**
692          * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
693          */
694         public static MessageSendEvent send_channel_reestablish(byte[] node_id, org.ldk.structs.ChannelReestablish msg) {
695                 long ret = bindings.MessageSendEvent_send_channel_reestablish(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
696                 Reference.reachabilityFence(node_id);
697                 Reference.reachabilityFence(msg);
698                 if (ret >= 0 && ret <= 4096) { return null; }
699                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
700                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
701                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
702                 return ret_hu_conv;
703         }
704
705         /**
706          * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
707          */
708         public static MessageSendEvent send_channel_announcement(byte[] node_id, org.ldk.structs.ChannelAnnouncement msg, org.ldk.structs.ChannelUpdate update_msg) {
709                 long ret = bindings.MessageSendEvent_send_channel_announcement(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr, update_msg == null ? 0 : update_msg.ptr);
710                 Reference.reachabilityFence(node_id);
711                 Reference.reachabilityFence(msg);
712                 Reference.reachabilityFence(update_msg);
713                 if (ret >= 0 && ret <= 4096) { return null; }
714                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
715                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
716                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
717                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(update_msg); };
718                 return ret_hu_conv;
719         }
720
721         /**
722          * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
723          */
724         public static MessageSendEvent broadcast_channel_announcement(org.ldk.structs.ChannelAnnouncement msg, org.ldk.structs.ChannelUpdate update_msg) {
725                 long ret = bindings.MessageSendEvent_broadcast_channel_announcement(msg == null ? 0 : msg.ptr, update_msg == null ? 0 : update_msg.ptr);
726                 Reference.reachabilityFence(msg);
727                 Reference.reachabilityFence(update_msg);
728                 if (ret >= 0 && ret <= 4096) { return null; }
729                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
730                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
731                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
732                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(update_msg); };
733                 return ret_hu_conv;
734         }
735
736         /**
737          * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
738          */
739         public static MessageSendEvent broadcast_channel_update(org.ldk.structs.ChannelUpdate msg) {
740                 long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr);
741                 Reference.reachabilityFence(msg);
742                 if (ret >= 0 && ret <= 4096) { return null; }
743                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
744                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
745                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
746                 return ret_hu_conv;
747         }
748
749         /**
750          * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
751          */
752         public static MessageSendEvent send_channel_update(byte[] node_id, org.ldk.structs.ChannelUpdate msg) {
753                 long ret = bindings.MessageSendEvent_send_channel_update(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
754                 Reference.reachabilityFence(node_id);
755                 Reference.reachabilityFence(msg);
756                 if (ret >= 0 && ret <= 4096) { return null; }
757                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
758                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
759                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
760                 return ret_hu_conv;
761         }
762
763         /**
764          * Utility method to constructs a new HandleError-variant MessageSendEvent
765          */
766         public static MessageSendEvent handle_error(byte[] node_id, org.ldk.structs.ErrorAction action) {
767                 long ret = bindings.MessageSendEvent_handle_error(InternalUtils.check_arr_len(node_id, 33), action.ptr);
768                 Reference.reachabilityFence(node_id);
769                 Reference.reachabilityFence(action);
770                 if (ret >= 0 && ret <= 4096) { return null; }
771                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
772                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
773                 return ret_hu_conv;
774         }
775
776         /**
777          * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
778          */
779         public static MessageSendEvent send_channel_range_query(byte[] node_id, org.ldk.structs.QueryChannelRange msg) {
780                 long ret = bindings.MessageSendEvent_send_channel_range_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
781                 Reference.reachabilityFence(node_id);
782                 Reference.reachabilityFence(msg);
783                 if (ret >= 0 && ret <= 4096) { return null; }
784                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
785                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
786                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
787                 return ret_hu_conv;
788         }
789
790         /**
791          * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
792          */
793         public static MessageSendEvent send_short_ids_query(byte[] node_id, org.ldk.structs.QueryShortChannelIds msg) {
794                 long ret = bindings.MessageSendEvent_send_short_ids_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
795                 Reference.reachabilityFence(node_id);
796                 Reference.reachabilityFence(msg);
797                 if (ret >= 0 && ret <= 4096) { return null; }
798                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
799                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
800                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
801                 return ret_hu_conv;
802         }
803
804         /**
805          * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
806          */
807         public static MessageSendEvent send_reply_channel_range(byte[] node_id, org.ldk.structs.ReplyChannelRange msg) {
808                 long ret = bindings.MessageSendEvent_send_reply_channel_range(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
809                 Reference.reachabilityFence(node_id);
810                 Reference.reachabilityFence(msg);
811                 if (ret >= 0 && ret <= 4096) { return null; }
812                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
813                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
814                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
815                 return ret_hu_conv;
816         }
817
818         /**
819          * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
820          */
821         public static MessageSendEvent send_gossip_timestamp_filter(byte[] node_id, org.ldk.structs.GossipTimestampFilter msg) {
822                 long ret = bindings.MessageSendEvent_send_gossip_timestamp_filter(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr);
823                 Reference.reachabilityFence(node_id);
824                 Reference.reachabilityFence(msg);
825                 if (ret >= 0 && ret <= 4096) { return null; }
826                 org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret);
827                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
828                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
829                 return ret_hu_conv;
830         }
831
832 }