1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
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.
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 {
22 if (ptr != 0) { bindings.MessageSendEvent_free(ptr); }
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);
29 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendOpenChannel.class) {
30 return new SendOpenChannel(ptr, (bindings.LDKMessageSendEvent.SendOpenChannel)raw_val);
32 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingCreated.class) {
33 return new SendFundingCreated(ptr, (bindings.LDKMessageSendEvent.SendFundingCreated)raw_val);
35 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingSigned.class) {
36 return new SendFundingSigned(ptr, (bindings.LDKMessageSendEvent.SendFundingSigned)raw_val);
38 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingLocked.class) {
39 return new SendFundingLocked(ptr, (bindings.LDKMessageSendEvent.SendFundingLocked)raw_val);
41 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAnnouncementSignatures.class) {
42 return new SendAnnouncementSignatures(ptr, (bindings.LDKMessageSendEvent.SendAnnouncementSignatures)raw_val);
44 if (raw_val.getClass() == bindings.LDKMessageSendEvent.UpdateHTLCs.class) {
45 return new UpdateHTLCs(ptr, (bindings.LDKMessageSendEvent.UpdateHTLCs)raw_val);
47 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendRevokeAndACK.class) {
48 return new SendRevokeAndACK(ptr, (bindings.LDKMessageSendEvent.SendRevokeAndACK)raw_val);
50 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendClosingSigned.class) {
51 return new SendClosingSigned(ptr, (bindings.LDKMessageSendEvent.SendClosingSigned)raw_val);
53 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShutdown.class) {
54 return new SendShutdown(ptr, (bindings.LDKMessageSendEvent.SendShutdown)raw_val);
56 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelReestablish.class) {
57 return new SendChannelReestablish(ptr, (bindings.LDKMessageSendEvent.SendChannelReestablish)raw_val);
59 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement.class) {
60 return new BroadcastChannelAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement)raw_val);
62 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement.class) {
63 return new BroadcastNodeAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement)raw_val);
65 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelUpdate.class) {
66 return new BroadcastChannelUpdate(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelUpdate)raw_val);
68 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelUpdate.class) {
69 return new SendChannelUpdate(ptr, (bindings.LDKMessageSendEvent.SendChannelUpdate)raw_val);
71 if (raw_val.getClass() == bindings.LDKMessageSendEvent.HandleError.class) {
72 return new HandleError(ptr, (bindings.LDKMessageSendEvent.HandleError)raw_val);
74 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelRangeQuery.class) {
75 return new SendChannelRangeQuery(ptr, (bindings.LDKMessageSendEvent.SendChannelRangeQuery)raw_val);
77 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShortIdsQuery.class) {
78 return new SendShortIdsQuery(ptr, (bindings.LDKMessageSendEvent.SendShortIdsQuery)raw_val);
80 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendReplyChannelRange.class) {
81 return new SendReplyChannelRange(ptr, (bindings.LDKMessageSendEvent.SendReplyChannelRange)raw_val);
83 assert false; return null; // Unreachable without extending the (internal) bindings interface
87 * Used to indicate that we've accepted a channel open and should send the accept_channel
88 * message provided to the given peer.
90 public final static class SendAcceptChannel extends MessageSendEvent {
92 * The node_id of the node which should receive this message
94 public final byte[] node_id;
96 * The message which should be sent.
98 public final AcceptChannel msg;
99 private SendAcceptChannel(long ptr, bindings.LDKMessageSendEvent.SendAcceptChannel obj) {
101 this.node_id = obj.node_id;
103 AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AcceptChannel(null, msg); }
104 msg_hu_conv.ptrs_to.add(this);
105 this.msg = msg_hu_conv;
109 * Used to indicate that we've initiated a channel open and should send the open_channel
110 * message provided to the given peer.
112 public final static class SendOpenChannel extends MessageSendEvent {
114 * The node_id of the node which should receive this message
116 public final byte[] node_id;
118 * The message which should be sent.
120 public final OpenChannel msg;
121 private SendOpenChannel(long ptr, bindings.LDKMessageSendEvent.SendOpenChannel obj) {
123 this.node_id = obj.node_id;
125 OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new OpenChannel(null, msg); }
126 msg_hu_conv.ptrs_to.add(this);
127 this.msg = msg_hu_conv;
131 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
133 public final static class SendFundingCreated extends MessageSendEvent {
135 * The node_id of the node which should receive this message
137 public final byte[] node_id;
139 * The message which should be sent.
141 public final FundingCreated msg;
142 private SendFundingCreated(long ptr, bindings.LDKMessageSendEvent.SendFundingCreated obj) {
144 this.node_id = obj.node_id;
146 FundingCreated msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingCreated(null, msg); }
147 msg_hu_conv.ptrs_to.add(this);
148 this.msg = msg_hu_conv;
152 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
154 public final static class SendFundingSigned extends MessageSendEvent {
156 * The node_id of the node which should receive this message
158 public final byte[] node_id;
160 * The message which should be sent.
162 public final FundingSigned msg;
163 private SendFundingSigned(long ptr, bindings.LDKMessageSendEvent.SendFundingSigned obj) {
165 this.node_id = obj.node_id;
167 FundingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingSigned(null, msg); }
168 msg_hu_conv.ptrs_to.add(this);
169 this.msg = msg_hu_conv;
173 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
175 public final static class SendFundingLocked extends MessageSendEvent {
177 * The node_id of the node which should receive these message(s)
179 public final byte[] node_id;
181 * The funding_locked message which should be sent.
183 public final FundingLocked msg;
184 private SendFundingLocked(long ptr, bindings.LDKMessageSendEvent.SendFundingLocked obj) {
186 this.node_id = obj.node_id;
188 FundingLocked msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingLocked(null, msg); }
189 msg_hu_conv.ptrs_to.add(this);
190 this.msg = msg_hu_conv;
194 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
196 public final static class SendAnnouncementSignatures extends MessageSendEvent {
198 * The node_id of the node which should receive these message(s)
200 public final byte[] node_id;
202 * The announcement_signatures message which should be sent.
204 public final AnnouncementSignatures msg;
205 private SendAnnouncementSignatures(long ptr, bindings.LDKMessageSendEvent.SendAnnouncementSignatures obj) {
207 this.node_id = obj.node_id;
209 AnnouncementSignatures msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AnnouncementSignatures(null, msg); }
210 msg_hu_conv.ptrs_to.add(this);
211 this.msg = msg_hu_conv;
215 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
216 * message should be sent to the peer with the given node_id.
218 public final static class UpdateHTLCs extends MessageSendEvent {
220 * The node_id of the node which should receive these message(s)
222 public final byte[] node_id;
224 * The update messages which should be sent. ALL messages in the struct should be sent!
226 public final CommitmentUpdate updates;
227 private UpdateHTLCs(long ptr, bindings.LDKMessageSendEvent.UpdateHTLCs obj) {
229 this.node_id = obj.node_id;
230 long updates = obj.updates;
231 CommitmentUpdate updates_hu_conv = null; if (updates < 0 || updates > 4096) { updates_hu_conv = new CommitmentUpdate(null, updates); }
232 updates_hu_conv.ptrs_to.add(this);
233 this.updates = updates_hu_conv;
237 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
239 public final static class SendRevokeAndACK extends MessageSendEvent {
241 * The node_id of the node which should receive this message
243 public final byte[] node_id;
245 * The message which should be sent.
247 public final RevokeAndACK msg;
248 private SendRevokeAndACK(long ptr, bindings.LDKMessageSendEvent.SendRevokeAndACK obj) {
250 this.node_id = obj.node_id;
252 RevokeAndACK msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new RevokeAndACK(null, msg); }
253 msg_hu_conv.ptrs_to.add(this);
254 this.msg = msg_hu_conv;
258 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
260 public final static class SendClosingSigned extends MessageSendEvent {
262 * The node_id of the node which should receive this message
264 public final byte[] node_id;
266 * The message which should be sent.
268 public final ClosingSigned msg;
269 private SendClosingSigned(long ptr, bindings.LDKMessageSendEvent.SendClosingSigned obj) {
271 this.node_id = obj.node_id;
273 ClosingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ClosingSigned(null, msg); }
274 msg_hu_conv.ptrs_to.add(this);
275 this.msg = msg_hu_conv;
279 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
281 public final static class SendShutdown extends MessageSendEvent {
283 * The node_id of the node which should receive this message
285 public final byte[] node_id;
287 * The message which should be sent.
289 public final Shutdown msg;
290 private SendShutdown(long ptr, bindings.LDKMessageSendEvent.SendShutdown obj) {
292 this.node_id = obj.node_id;
294 Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new Shutdown(null, msg); }
295 msg_hu_conv.ptrs_to.add(this);
296 this.msg = msg_hu_conv;
300 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
302 public final static class SendChannelReestablish extends MessageSendEvent {
304 * The node_id of the node which should receive this message
306 public final byte[] node_id;
308 * The message which should be sent.
310 public final ChannelReestablish msg;
311 private SendChannelReestablish(long ptr, bindings.LDKMessageSendEvent.SendChannelReestablish obj) {
313 this.node_id = obj.node_id;
315 ChannelReestablish msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelReestablish(null, msg); }
316 msg_hu_conv.ptrs_to.add(this);
317 this.msg = msg_hu_conv;
321 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
322 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
324 * Note that after doing so, you very likely (unless you did so very recently) want to call
325 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
326 * This ensures that any nodes which see our channel_announcement also have a relevant
327 * node_announcement, including relevant feature flags which may be important for routing
330 public final static class BroadcastChannelAnnouncement extends MessageSendEvent {
332 * The channel_announcement which should be sent.
334 public final ChannelAnnouncement msg;
336 * The followup channel_update which should be sent.
338 public final ChannelUpdate update_msg;
339 private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) {
342 ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelAnnouncement(null, msg); }
343 msg_hu_conv.ptrs_to.add(this);
344 this.msg = msg_hu_conv;
345 long update_msg = obj.update_msg;
346 ChannelUpdate update_msg_hu_conv = null; if (update_msg < 0 || update_msg > 4096) { update_msg_hu_conv = new ChannelUpdate(null, update_msg); }
347 update_msg_hu_conv.ptrs_to.add(this);
348 this.update_msg = update_msg_hu_conv;
352 * Used to indicate that a node_announcement should be broadcast to all peers.
354 public final static class BroadcastNodeAnnouncement extends MessageSendEvent {
356 * The node_announcement which should be sent.
358 public final NodeAnnouncement msg;
359 private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) {
362 NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new NodeAnnouncement(null, msg); }
363 msg_hu_conv.ptrs_to.add(this);
364 this.msg = msg_hu_conv;
368 * Used to indicate that a channel_update should be broadcast to all peers.
370 public final static class BroadcastChannelUpdate extends MessageSendEvent {
372 * The channel_update which should be sent.
374 public final ChannelUpdate msg;
375 private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) {
378 ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); }
379 msg_hu_conv.ptrs_to.add(this);
380 this.msg = msg_hu_conv;
384 * Used to indicate that a channel_update should be sent to a single peer.
385 * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
386 * private channel and we shouldn't be informing all of our peers of channel parameters.
388 public final static class SendChannelUpdate extends MessageSendEvent {
390 * The node_id of the node which should receive this message
392 public final byte[] node_id;
394 * The channel_update which should be sent.
396 public final ChannelUpdate msg;
397 private SendChannelUpdate(long ptr, bindings.LDKMessageSendEvent.SendChannelUpdate obj) {
399 this.node_id = obj.node_id;
401 ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); }
402 msg_hu_conv.ptrs_to.add(this);
403 this.msg = msg_hu_conv;
407 * Broadcast an error downstream to be handled
409 public final static class HandleError extends MessageSendEvent {
411 * The node_id of the node which should receive this message
413 public final byte[] node_id;
415 * The action which should be taken.
417 public final ErrorAction action;
418 private HandleError(long ptr, bindings.LDKMessageSendEvent.HandleError obj) {
420 this.node_id = obj.node_id;
421 long action = obj.action;
422 ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action);
423 action_hu_conv.ptrs_to.add(this);
424 this.action = action_hu_conv;
428 * Query a peer for channels with funding transaction UTXOs in a block range.
430 public final static class SendChannelRangeQuery extends MessageSendEvent {
432 * The node_id of this message recipient
434 public final byte[] node_id;
436 * The query_channel_range which should be sent.
438 public final QueryChannelRange msg;
439 private SendChannelRangeQuery(long ptr, bindings.LDKMessageSendEvent.SendChannelRangeQuery obj) {
441 this.node_id = obj.node_id;
443 QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryChannelRange(null, msg); }
444 msg_hu_conv.ptrs_to.add(this);
445 this.msg = msg_hu_conv;
449 * Request routing gossip messages from a peer for a list of channels identified by
450 * their short_channel_ids.
452 public final static class SendShortIdsQuery extends MessageSendEvent {
454 * The node_id of this message recipient
456 public final byte[] node_id;
458 * The query_short_channel_ids which should be sent.
460 public final QueryShortChannelIds msg;
461 private SendShortIdsQuery(long ptr, bindings.LDKMessageSendEvent.SendShortIdsQuery obj) {
463 this.node_id = obj.node_id;
465 QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryShortChannelIds(null, msg); }
466 msg_hu_conv.ptrs_to.add(this);
467 this.msg = msg_hu_conv;
471 * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
472 * emitted during processing of the query.
474 public final static class SendReplyChannelRange extends MessageSendEvent {
476 * The node_id of this message recipient
478 public final byte[] node_id;
480 * The reply_channel_range which should be sent.
482 public final ReplyChannelRange msg;
483 private SendReplyChannelRange(long ptr, bindings.LDKMessageSendEvent.SendReplyChannelRange obj) {
485 this.node_id = obj.node_id;
487 ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ReplyChannelRange(null, msg); }
488 msg_hu_conv.ptrs_to.add(this);
489 this.msg = msg_hu_conv;
493 long ret = bindings.MessageSendEvent_clone_ptr(this.ptr);
494 Reference.reachabilityFence(this);
499 * Creates a copy of the MessageSendEvent
501 public MessageSendEvent clone() {
502 long ret = bindings.MessageSendEvent_clone(this.ptr);
503 Reference.reachabilityFence(this);
504 if (ret >= 0 && ret <= 4096) { return null; }
505 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
506 ret_hu_conv.ptrs_to.add(this);
511 * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
513 public static MessageSendEvent send_accept_channel(byte[] node_id, AcceptChannel msg) {
514 long ret = bindings.MessageSendEvent_send_accept_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
515 Reference.reachabilityFence(node_id);
516 Reference.reachabilityFence(msg);
517 if (ret >= 0 && ret <= 4096) { return null; }
518 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
519 ret_hu_conv.ptrs_to.add(ret_hu_conv);
524 * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
526 public static MessageSendEvent send_open_channel(byte[] node_id, OpenChannel msg) {
527 long ret = bindings.MessageSendEvent_send_open_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
528 Reference.reachabilityFence(node_id);
529 Reference.reachabilityFence(msg);
530 if (ret >= 0 && ret <= 4096) { return null; }
531 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
532 ret_hu_conv.ptrs_to.add(ret_hu_conv);
537 * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
539 public static MessageSendEvent send_funding_created(byte[] node_id, FundingCreated msg) {
540 long ret = bindings.MessageSendEvent_send_funding_created(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
541 Reference.reachabilityFence(node_id);
542 Reference.reachabilityFence(msg);
543 if (ret >= 0 && ret <= 4096) { return null; }
544 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
545 ret_hu_conv.ptrs_to.add(ret_hu_conv);
550 * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
552 public static MessageSendEvent send_funding_signed(byte[] node_id, FundingSigned msg) {
553 long ret = bindings.MessageSendEvent_send_funding_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
554 Reference.reachabilityFence(node_id);
555 Reference.reachabilityFence(msg);
556 if (ret >= 0 && ret <= 4096) { return null; }
557 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
558 ret_hu_conv.ptrs_to.add(ret_hu_conv);
563 * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
565 public static MessageSendEvent send_funding_locked(byte[] node_id, FundingLocked msg) {
566 long ret = bindings.MessageSendEvent_send_funding_locked(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
567 Reference.reachabilityFence(node_id);
568 Reference.reachabilityFence(msg);
569 if (ret >= 0 && ret <= 4096) { return null; }
570 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
571 ret_hu_conv.ptrs_to.add(ret_hu_conv);
576 * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
578 public static MessageSendEvent send_announcement_signatures(byte[] node_id, AnnouncementSignatures msg) {
579 long ret = bindings.MessageSendEvent_send_announcement_signatures(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
580 Reference.reachabilityFence(node_id);
581 Reference.reachabilityFence(msg);
582 if (ret >= 0 && ret <= 4096) { return null; }
583 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
584 ret_hu_conv.ptrs_to.add(ret_hu_conv);
589 * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
591 public static MessageSendEvent update_htlcs(byte[] node_id, CommitmentUpdate updates) {
592 long ret = bindings.MessageSendEvent_update_htlcs(InternalUtils.check_arr_len(node_id, 33), updates == null ? 0 : updates.ptr & ~1);
593 Reference.reachabilityFence(node_id);
594 Reference.reachabilityFence(updates);
595 if (ret >= 0 && ret <= 4096) { return null; }
596 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
597 ret_hu_conv.ptrs_to.add(ret_hu_conv);
602 * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
604 public static MessageSendEvent send_revoke_and_ack(byte[] node_id, RevokeAndACK msg) {
605 long ret = bindings.MessageSendEvent_send_revoke_and_ack(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
606 Reference.reachabilityFence(node_id);
607 Reference.reachabilityFence(msg);
608 if (ret >= 0 && ret <= 4096) { return null; }
609 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
610 ret_hu_conv.ptrs_to.add(ret_hu_conv);
615 * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
617 public static MessageSendEvent send_closing_signed(byte[] node_id, ClosingSigned msg) {
618 long ret = bindings.MessageSendEvent_send_closing_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
619 Reference.reachabilityFence(node_id);
620 Reference.reachabilityFence(msg);
621 if (ret >= 0 && ret <= 4096) { return null; }
622 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
623 ret_hu_conv.ptrs_to.add(ret_hu_conv);
628 * Utility method to constructs a new SendShutdown-variant MessageSendEvent
630 public static MessageSendEvent send_shutdown(byte[] node_id, Shutdown msg) {
631 long ret = bindings.MessageSendEvent_send_shutdown(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
632 Reference.reachabilityFence(node_id);
633 Reference.reachabilityFence(msg);
634 if (ret >= 0 && ret <= 4096) { return null; }
635 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
636 ret_hu_conv.ptrs_to.add(ret_hu_conv);
641 * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
643 public static MessageSendEvent send_channel_reestablish(byte[] node_id, ChannelReestablish msg) {
644 long ret = bindings.MessageSendEvent_send_channel_reestablish(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
645 Reference.reachabilityFence(node_id);
646 Reference.reachabilityFence(msg);
647 if (ret >= 0 && ret <= 4096) { return null; }
648 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
649 ret_hu_conv.ptrs_to.add(ret_hu_conv);
654 * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
656 public static MessageSendEvent broadcast_channel_announcement(ChannelAnnouncement msg, ChannelUpdate update_msg) {
657 long ret = bindings.MessageSendEvent_broadcast_channel_announcement(msg == null ? 0 : msg.ptr & ~1, update_msg == null ? 0 : update_msg.ptr & ~1);
658 Reference.reachabilityFence(msg);
659 Reference.reachabilityFence(update_msg);
660 if (ret >= 0 && ret <= 4096) { return null; }
661 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
662 ret_hu_conv.ptrs_to.add(ret_hu_conv);
667 * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
669 public static MessageSendEvent broadcast_node_announcement(NodeAnnouncement msg) {
670 long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr & ~1);
671 Reference.reachabilityFence(msg);
672 if (ret >= 0 && ret <= 4096) { return null; }
673 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
674 ret_hu_conv.ptrs_to.add(ret_hu_conv);
679 * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
681 public static MessageSendEvent broadcast_channel_update(ChannelUpdate msg) {
682 long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr & ~1);
683 Reference.reachabilityFence(msg);
684 if (ret >= 0 && ret <= 4096) { return null; }
685 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
686 ret_hu_conv.ptrs_to.add(ret_hu_conv);
691 * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
693 public static MessageSendEvent send_channel_update(byte[] node_id, ChannelUpdate msg) {
694 long ret = bindings.MessageSendEvent_send_channel_update(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
695 Reference.reachabilityFence(node_id);
696 Reference.reachabilityFence(msg);
697 if (ret >= 0 && ret <= 4096) { return null; }
698 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
699 ret_hu_conv.ptrs_to.add(ret_hu_conv);
704 * Utility method to constructs a new HandleError-variant MessageSendEvent
706 public static MessageSendEvent handle_error(byte[] node_id, ErrorAction action) {
707 long ret = bindings.MessageSendEvent_handle_error(InternalUtils.check_arr_len(node_id, 33), action.ptr);
708 Reference.reachabilityFence(node_id);
709 Reference.reachabilityFence(action);
710 if (ret >= 0 && ret <= 4096) { return null; }
711 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
712 ret_hu_conv.ptrs_to.add(ret_hu_conv);
717 * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
719 public static MessageSendEvent send_channel_range_query(byte[] node_id, QueryChannelRange msg) {
720 long ret = bindings.MessageSendEvent_send_channel_range_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
721 Reference.reachabilityFence(node_id);
722 Reference.reachabilityFence(msg);
723 if (ret >= 0 && ret <= 4096) { return null; }
724 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
725 ret_hu_conv.ptrs_to.add(ret_hu_conv);
730 * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
732 public static MessageSendEvent send_short_ids_query(byte[] node_id, QueryShortChannelIds msg) {
733 long ret = bindings.MessageSendEvent_send_short_ids_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
734 Reference.reachabilityFence(node_id);
735 Reference.reachabilityFence(msg);
736 if (ret >= 0 && ret <= 4096) { return null; }
737 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
738 ret_hu_conv.ptrs_to.add(ret_hu_conv);
743 * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
745 public static MessageSendEvent send_reply_channel_range(byte[] node_id, ReplyChannelRange msg) {
746 long ret = bindings.MessageSendEvent_send_reply_channel_range(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
747 Reference.reachabilityFence(node_id);
748 Reference.reachabilityFence(msg);
749 if (ret >= 0 && ret <= 4096) { return null; }
750 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
751 ret_hu_conv.ptrs_to.add(ret_hu_conv);