X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FMessageSendEvent.java;h=e1a703df0a3914ba197cde9ae59e04d7f2b80429;hb=c3ae2d6897e5a809459c8d9a72a4b3aa0052c8c8;hp=30b7548f2fed04c40930018226c44819cf60bc6b;hpb=a9b82019e7ffa7d32d44943133bb64e1197bd2f1;p=ldk-java diff --git a/src/main/java/org/ldk/structs/MessageSendEvent.java b/src/main/java/org/ldk/structs/MessageSendEvent.java index 30b7548f..e1a703df 100644 --- a/src/main/java/org/ldk/structs/MessageSendEvent.java +++ b/src/main/java/org/ldk/structs/MessageSendEvent.java @@ -5,6 +5,12 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * An event generated by ChannelManager which indicates a message should be sent to a peer (or + * broadcast to most peers). + * These events are handled by PeerManager::process_events if you are using a PeerManager. + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class MessageSendEvent extends CommonBase { private MessageSendEvent(Object _dummy, long ptr) { super(ptr); } @@ -69,6 +75,9 @@ public class MessageSendEvent extends CommonBase { if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShortIdsQuery.class) { return new SendShortIdsQuery(ptr, (bindings.LDKMessageSendEvent.SendShortIdsQuery)raw_val); } + if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendReplyChannelRange.class) { + return new SendReplyChannelRange(ptr, (bindings.LDKMessageSendEvent.SendReplyChannelRange)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -80,6 +89,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; AcceptChannel msg_hu_conv = new AcceptChannel(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -91,6 +101,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; OpenChannel msg_hu_conv = new OpenChannel(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -102,6 +113,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; FundingCreated msg_hu_conv = new FundingCreated(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -113,6 +125,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; FundingSigned msg_hu_conv = new FundingSigned(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -124,6 +137,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; FundingLocked msg_hu_conv = new FundingLocked(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -135,6 +149,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; AnnouncementSignatures msg_hu_conv = new AnnouncementSignatures(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -146,6 +161,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long updates = obj.updates; CommitmentUpdate updates_hu_conv = new CommitmentUpdate(null, updates); + updates_hu_conv.ptrs_to.add(this); this.updates = updates_hu_conv; } } @@ -157,6 +173,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; RevokeAndACK msg_hu_conv = new RevokeAndACK(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -168,6 +185,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; ClosingSigned msg_hu_conv = new ClosingSigned(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -179,6 +197,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; Shutdown msg_hu_conv = new Shutdown(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -190,6 +209,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; ChannelReestablish msg_hu_conv = new ChannelReestablish(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -200,9 +220,11 @@ public class MessageSendEvent extends CommonBase { super(null, ptr); long msg = obj.msg; ChannelAnnouncement 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); + update_msg_hu_conv.ptrs_to.add(this); this.update_msg = update_msg_hu_conv; } } @@ -212,6 +234,7 @@ public class MessageSendEvent extends CommonBase { super(null, ptr); long msg = obj.msg; NodeAnnouncement msg_hu_conv = new NodeAnnouncement(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -221,6 +244,7 @@ public class MessageSendEvent extends CommonBase { super(null, ptr); long msg = obj.msg; ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -254,6 +278,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; QueryChannelRange msg_hu_conv = new QueryChannelRange(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -265,7 +290,30 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; QueryShortChannelIds msg_hu_conv = new QueryShortChannelIds(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } + public final static class SendReplyChannelRange extends MessageSendEvent { + public final byte[] node_id; + public final ReplyChannelRange msg; + private SendReplyChannelRange(long ptr, bindings.LDKMessageSendEvent.SendReplyChannelRange obj) { + super(null, ptr); + this.node_id = obj.node_id; + long msg = obj.msg; + ReplyChannelRange msg_hu_conv = new ReplyChannelRange(null, msg); + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + } + } + /** + * Creates a copy of the MessageSendEvent + */ + public MessageSendEvent clone() { + long ret = bindings.MessageSendEvent_clone(this.ptr); + MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + }