]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/MessageSendEvent.java
Fix race in tests
[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
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class MessageSendEvent extends CommonBase {
10         private MessageSendEvent(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.MessageSendEvent_free(ptr); }
15         }
16         static MessageSendEvent constr_from_ptr(long ptr) {
17                 bindings.LDKMessageSendEvent raw_val = bindings.LDKMessageSendEvent_ref_from_ptr(ptr);
18                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAcceptChannel.class) {
19                         return new SendAcceptChannel(ptr, (bindings.LDKMessageSendEvent.SendAcceptChannel)raw_val);
20                 }
21                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendOpenChannel.class) {
22                         return new SendOpenChannel(ptr, (bindings.LDKMessageSendEvent.SendOpenChannel)raw_val);
23                 }
24                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingCreated.class) {
25                         return new SendFundingCreated(ptr, (bindings.LDKMessageSendEvent.SendFundingCreated)raw_val);
26                 }
27                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingSigned.class) {
28                         return new SendFundingSigned(ptr, (bindings.LDKMessageSendEvent.SendFundingSigned)raw_val);
29                 }
30                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingLocked.class) {
31                         return new SendFundingLocked(ptr, (bindings.LDKMessageSendEvent.SendFundingLocked)raw_val);
32                 }
33                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAnnouncementSignatures.class) {
34                         return new SendAnnouncementSignatures(ptr, (bindings.LDKMessageSendEvent.SendAnnouncementSignatures)raw_val);
35                 }
36                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.UpdateHTLCs.class) {
37                         return new UpdateHTLCs(ptr, (bindings.LDKMessageSendEvent.UpdateHTLCs)raw_val);
38                 }
39                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendRevokeAndACK.class) {
40                         return new SendRevokeAndACK(ptr, (bindings.LDKMessageSendEvent.SendRevokeAndACK)raw_val);
41                 }
42                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendClosingSigned.class) {
43                         return new SendClosingSigned(ptr, (bindings.LDKMessageSendEvent.SendClosingSigned)raw_val);
44                 }
45                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShutdown.class) {
46                         return new SendShutdown(ptr, (bindings.LDKMessageSendEvent.SendShutdown)raw_val);
47                 }
48                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelReestablish.class) {
49                         return new SendChannelReestablish(ptr, (bindings.LDKMessageSendEvent.SendChannelReestablish)raw_val);
50                 }
51                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement.class) {
52                         return new BroadcastChannelAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement)raw_val);
53                 }
54                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement.class) {
55                         return new BroadcastNodeAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement)raw_val);
56                 }
57                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelUpdate.class) {
58                         return new BroadcastChannelUpdate(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelUpdate)raw_val);
59                 }
60                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.HandleError.class) {
61                         return new HandleError(ptr, (bindings.LDKMessageSendEvent.HandleError)raw_val);
62                 }
63                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate.class) {
64                         return new PaymentFailureNetworkUpdate(ptr, (bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate)raw_val);
65                 }
66                 assert false; return null; // Unreachable without extending the (internal) bindings interface
67         }
68
69         public final static class SendAcceptChannel extends MessageSendEvent {
70                 public final byte[] node_id;
71                 public final AcceptChannel msg;
72                 private SendAcceptChannel(long ptr, bindings.LDKMessageSendEvent.SendAcceptChannel obj) {
73                         super(null, ptr);
74                         this.node_id = obj.node_id;
75                         long msg = obj.msg;
76                         AcceptChannel msg_hu_conv = new AcceptChannel(null, msg);
77                         this.msg = msg_hu_conv;
78                 }
79         }
80         public final static class SendOpenChannel extends MessageSendEvent {
81                 public final byte[] node_id;
82                 public final OpenChannel msg;
83                 private SendOpenChannel(long ptr, bindings.LDKMessageSendEvent.SendOpenChannel obj) {
84                         super(null, ptr);
85                         this.node_id = obj.node_id;
86                         long msg = obj.msg;
87                         OpenChannel msg_hu_conv = new OpenChannel(null, msg);
88                         this.msg = msg_hu_conv;
89                 }
90         }
91         public final static class SendFundingCreated extends MessageSendEvent {
92                 public final byte[] node_id;
93                 public final FundingCreated msg;
94                 private SendFundingCreated(long ptr, bindings.LDKMessageSendEvent.SendFundingCreated obj) {
95                         super(null, ptr);
96                         this.node_id = obj.node_id;
97                         long msg = obj.msg;
98                         FundingCreated msg_hu_conv = new FundingCreated(null, msg);
99                         this.msg = msg_hu_conv;
100                 }
101         }
102         public final static class SendFundingSigned extends MessageSendEvent {
103                 public final byte[] node_id;
104                 public final FundingSigned msg;
105                 private SendFundingSigned(long ptr, bindings.LDKMessageSendEvent.SendFundingSigned obj) {
106                         super(null, ptr);
107                         this.node_id = obj.node_id;
108                         long msg = obj.msg;
109                         FundingSigned msg_hu_conv = new FundingSigned(null, msg);
110                         this.msg = msg_hu_conv;
111                 }
112         }
113         public final static class SendFundingLocked extends MessageSendEvent {
114                 public final byte[] node_id;
115                 public final FundingLocked msg;
116                 private SendFundingLocked(long ptr, bindings.LDKMessageSendEvent.SendFundingLocked obj) {
117                         super(null, ptr);
118                         this.node_id = obj.node_id;
119                         long msg = obj.msg;
120                         FundingLocked msg_hu_conv = new FundingLocked(null, msg);
121                         this.msg = msg_hu_conv;
122                 }
123         }
124         public final static class SendAnnouncementSignatures extends MessageSendEvent {
125                 public final byte[] node_id;
126                 public final AnnouncementSignatures msg;
127                 private SendAnnouncementSignatures(long ptr, bindings.LDKMessageSendEvent.SendAnnouncementSignatures obj) {
128                         super(null, ptr);
129                         this.node_id = obj.node_id;
130                         long msg = obj.msg;
131                         AnnouncementSignatures msg_hu_conv = new AnnouncementSignatures(null, msg);
132                         this.msg = msg_hu_conv;
133                 }
134         }
135         public final static class UpdateHTLCs extends MessageSendEvent {
136                 public final byte[] node_id;
137                 public final CommitmentUpdate updates;
138                 private UpdateHTLCs(long ptr, bindings.LDKMessageSendEvent.UpdateHTLCs obj) {
139                         super(null, ptr);
140                         this.node_id = obj.node_id;
141                         long updates = obj.updates;
142                         CommitmentUpdate updates_hu_conv = new CommitmentUpdate(null, updates);
143                         this.updates = updates_hu_conv;
144                 }
145         }
146         public final static class SendRevokeAndACK extends MessageSendEvent {
147                 public final byte[] node_id;
148                 public final RevokeAndACK msg;
149                 private SendRevokeAndACK(long ptr, bindings.LDKMessageSendEvent.SendRevokeAndACK obj) {
150                         super(null, ptr);
151                         this.node_id = obj.node_id;
152                         long msg = obj.msg;
153                         RevokeAndACK msg_hu_conv = new RevokeAndACK(null, msg);
154                         this.msg = msg_hu_conv;
155                 }
156         }
157         public final static class SendClosingSigned extends MessageSendEvent {
158                 public final byte[] node_id;
159                 public final ClosingSigned msg;
160                 private SendClosingSigned(long ptr, bindings.LDKMessageSendEvent.SendClosingSigned obj) {
161                         super(null, ptr);
162                         this.node_id = obj.node_id;
163                         long msg = obj.msg;
164                         ClosingSigned msg_hu_conv = new ClosingSigned(null, msg);
165                         this.msg = msg_hu_conv;
166                 }
167         }
168         public final static class SendShutdown extends MessageSendEvent {
169                 public final byte[] node_id;
170                 public final Shutdown msg;
171                 private SendShutdown(long ptr, bindings.LDKMessageSendEvent.SendShutdown obj) {
172                         super(null, ptr);
173                         this.node_id = obj.node_id;
174                         long msg = obj.msg;
175                         Shutdown msg_hu_conv = new Shutdown(null, msg);
176                         this.msg = msg_hu_conv;
177                 }
178         }
179         public final static class SendChannelReestablish extends MessageSendEvent {
180                 public final byte[] node_id;
181                 public final ChannelReestablish msg;
182                 private SendChannelReestablish(long ptr, bindings.LDKMessageSendEvent.SendChannelReestablish obj) {
183                         super(null, ptr);
184                         this.node_id = obj.node_id;
185                         long msg = obj.msg;
186                         ChannelReestablish msg_hu_conv = new ChannelReestablish(null, msg);
187                         this.msg = msg_hu_conv;
188                 }
189         }
190         public final static class BroadcastChannelAnnouncement extends MessageSendEvent {
191                 public final ChannelAnnouncement msg;
192                 public final ChannelUpdate update_msg;
193                 private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) {
194                         super(null, ptr);
195                         long msg = obj.msg;
196                         ChannelAnnouncement msg_hu_conv = new ChannelAnnouncement(null, msg);
197                         this.msg = msg_hu_conv;
198                         long update_msg = obj.update_msg;
199                         ChannelUpdate update_msg_hu_conv = new ChannelUpdate(null, update_msg);
200                         this.update_msg = update_msg_hu_conv;
201                 }
202         }
203         public final static class BroadcastNodeAnnouncement extends MessageSendEvent {
204                 public final NodeAnnouncement msg;
205                 private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) {
206                         super(null, ptr);
207                         long msg = obj.msg;
208                         NodeAnnouncement msg_hu_conv = new NodeAnnouncement(null, msg);
209                         this.msg = msg_hu_conv;
210                 }
211         }
212         public final static class BroadcastChannelUpdate extends MessageSendEvent {
213                 public final ChannelUpdate msg;
214                 private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) {
215                         super(null, ptr);
216                         long msg = obj.msg;
217                         ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
218                         this.msg = msg_hu_conv;
219                 }
220         }
221         public final static class HandleError extends MessageSendEvent {
222                 public final byte[] node_id;
223                 public final ErrorAction action;
224                 private HandleError(long ptr, bindings.LDKMessageSendEvent.HandleError obj) {
225                         super(null, ptr);
226                         this.node_id = obj.node_id;
227                         long action = obj.action;
228                         ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action);
229                         action_hu_conv.ptrs_to.add(this);
230                         this.action = action_hu_conv;
231                 }
232         }
233         public final static class PaymentFailureNetworkUpdate extends MessageSendEvent {
234                 public final HTLCFailChannelUpdate update;
235                 private PaymentFailureNetworkUpdate(long ptr, bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate obj) {
236                         super(null, ptr);
237                         long update = obj.update;
238                         HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
239                         update_hu_conv.ptrs_to.add(this);
240                         this.update = update_hu_conv;
241                 }
242         }
243 }