X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FMessageSendEvent.java;h=2885e0ca74d53c78aac5e87294c8b22d20529faa;hb=12c3ea6f32816f379249a75863971a1c7e1089a1;hp=5eb255afea785cb12c88d6465bc5bc19c75e87f4;hpb=aa0e2aade37133339f4113a0cd7465b111f0a0d0;p=ldk-java diff --git a/src/main/java/org/ldk/structs/MessageSendEvent.java b/src/main/java/org/ldk/structs/MessageSendEvent.java index 5eb255af..2885e0ca 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); } @@ -57,12 +63,24 @@ public class MessageSendEvent extends CommonBase { if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelUpdate.class) { return new BroadcastChannelUpdate(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelUpdate)raw_val); } + if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelUpdate.class) { + return new SendChannelUpdate(ptr, (bindings.LDKMessageSendEvent.SendChannelUpdate)raw_val); + } 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); + } + 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 } @@ -74,6 +92,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; } } @@ -85,6 +104,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; } } @@ -96,6 +116,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; } } @@ -107,6 +128,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; } } @@ -118,6 +140,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; } } @@ -129,6 +152,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; } } @@ -140,6 +164,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; } } @@ -151,6 +176,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; } } @@ -162,6 +188,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; } } @@ -173,6 +200,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; } } @@ -184,6 +212,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; } } @@ -194,9 +223,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; } } @@ -206,6 +237,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; } } @@ -215,6 +247,19 @@ 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; + } + } + public final static class SendChannelUpdate extends MessageSendEvent { + public final byte[] node_id; + public final ChannelUpdate msg; + private SendChannelUpdate(long ptr, bindings.LDKMessageSendEvent.SendChannelUpdate obj) { + super(null, ptr); + this.node_id = obj.node_id; + long msg = obj.msg; + ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -226,6 +271,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long action = obj.action; ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action); + action_hu_conv.ptrs_to.add(this); this.action = action_hu_conv; } } @@ -235,7 +281,54 @@ public class MessageSendEvent extends CommonBase { 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; } } + public final static class SendChannelRangeQuery extends MessageSendEvent { + public final byte[] node_id; + public final QueryChannelRange msg; + private SendChannelRangeQuery(long ptr, bindings.LDKMessageSendEvent.SendChannelRangeQuery obj) { + super(null, ptr); + 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; + } + } + public final static class SendShortIdsQuery extends MessageSendEvent { + public final byte[] node_id; + public final QueryShortChannelIds msg; + private SendShortIdsQuery(long ptr, bindings.LDKMessageSendEvent.SendShortIdsQuery obj) { + super(null, ptr); + 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; + } + }