8bb6667f048231bb67b5eb7164a97a35bf843e16
[ldk-java] / src / main / java / org / ldk / structs / ChannelMessageHandler.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  * A trait to describe an object which can receive channel messages.
12  * 
13  * Messages MAY be called in parallel when they originate from different their_node_ids, however
14  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class ChannelMessageHandler extends CommonBase {
18         final bindings.LDKChannelMessageHandler bindings_instance;
19         ChannelMessageHandler(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
20         private ChannelMessageHandler(bindings.LDKChannelMessageHandler arg, bindings.LDKMessageSendEventsProvider MessageSendEventsProvider) {
21                 super(bindings.LDKChannelMessageHandler_new(arg, MessageSendEventsProvider));
22                 this.ptrs_to.add(arg);
23                 this.ptrs_to.add(MessageSendEventsProvider);
24                 this.bindings_instance = arg;
25         }
26         @Override @SuppressWarnings("deprecation")
27         protected void finalize() throws Throwable {
28                 if (ptr != 0) { bindings.ChannelMessageHandler_free(ptr); } super.finalize();
29         }
30
31         public static interface ChannelMessageHandlerInterface {
32                 /**
33                  * Handle an incoming open_channel message from the given peer.
34                  */
35                 void handle_open_channel(byte[] their_node_id, InitFeatures their_features, OpenChannel msg);
36                 /**
37                  * Handle an incoming accept_channel message from the given peer.
38                  */
39                 void handle_accept_channel(byte[] their_node_id, InitFeatures their_features, AcceptChannel msg);
40                 /**
41                  * Handle an incoming funding_created message from the given peer.
42                  */
43                 void handle_funding_created(byte[] their_node_id, FundingCreated msg);
44                 /**
45                  * Handle an incoming funding_signed message from the given peer.
46                  */
47                 void handle_funding_signed(byte[] their_node_id, FundingSigned msg);
48                 /**
49                  * Handle an incoming funding_locked message from the given peer.
50                  */
51                 void handle_funding_locked(byte[] their_node_id, FundingLocked msg);
52                 /**
53                  * Handle an incoming shutdown message from the given peer.
54                  */
55                 void handle_shutdown(byte[] their_node_id, InitFeatures their_features, Shutdown msg);
56                 /**
57                  * Handle an incoming closing_signed message from the given peer.
58                  */
59                 void handle_closing_signed(byte[] their_node_id, ClosingSigned msg);
60                 /**
61                  * Handle an incoming update_add_htlc message from the given peer.
62                  */
63                 void handle_update_add_htlc(byte[] their_node_id, UpdateAddHTLC msg);
64                 /**
65                  * Handle an incoming update_fulfill_htlc message from the given peer.
66                  */
67                 void handle_update_fulfill_htlc(byte[] their_node_id, UpdateFulfillHTLC msg);
68                 /**
69                  * Handle an incoming update_fail_htlc message from the given peer.
70                  */
71                 void handle_update_fail_htlc(byte[] their_node_id, UpdateFailHTLC msg);
72                 /**
73                  * Handle an incoming update_fail_malformed_htlc message from the given peer.
74                  */
75                 void handle_update_fail_malformed_htlc(byte[] their_node_id, UpdateFailMalformedHTLC msg);
76                 /**
77                  * Handle an incoming commitment_signed message from the given peer.
78                  */
79                 void handle_commitment_signed(byte[] their_node_id, CommitmentSigned msg);
80                 /**
81                  * Handle an incoming revoke_and_ack message from the given peer.
82                  */
83                 void handle_revoke_and_ack(byte[] their_node_id, RevokeAndACK msg);
84                 /**
85                  * Handle an incoming update_fee message from the given peer.
86                  */
87                 void handle_update_fee(byte[] their_node_id, UpdateFee msg);
88                 /**
89                  * Handle an incoming announcement_signatures message from the given peer.
90                  */
91                 void handle_announcement_signatures(byte[] their_node_id, AnnouncementSignatures msg);
92                 /**
93                  * Indicates a connection to the peer failed/an existing connection was lost. If no connection
94                  * is believed to be possible in the future (eg they're sending us messages we don't
95                  * understand or indicate they require unknown feature bits), no_connection_possible is set
96                  * and any outstanding channels should be failed.
97                  */
98                 void peer_disconnected(byte[] their_node_id, boolean no_connection_possible);
99                 /**
100                  * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
101                  */
102                 void peer_connected(byte[] their_node_id, Init msg);
103                 /**
104                  * Handle an incoming channel_reestablish message from the given peer.
105                  */
106                 void handle_channel_reestablish(byte[] their_node_id, ChannelReestablish msg);
107                 /**
108                  * Handle an incoming channel update from the given peer.
109                  */
110                 void handle_channel_update(byte[] their_node_id, ChannelUpdate msg);
111                 /**
112                  * Handle an incoming error message from the given peer.
113                  */
114                 void handle_error(byte[] their_node_id, ErrorMessage msg);
115         }
116         private static class LDKChannelMessageHandlerHolder { ChannelMessageHandler held; }
117         public static ChannelMessageHandler new_impl(ChannelMessageHandlerInterface arg, MessageSendEventsProvider.MessageSendEventsProviderInterface MessageSendEventsProvider_impl) {
118                 final LDKChannelMessageHandlerHolder impl_holder = new LDKChannelMessageHandlerHolder();
119                 impl_holder.held = new ChannelMessageHandler(new bindings.LDKChannelMessageHandler() {
120                         @Override public void handle_open_channel(byte[] their_node_id, long their_features, long msg) {
121                                 InitFeatures their_features_hu_conv = null; if (their_features < 0 || their_features > 4096) { their_features_hu_conv = new InitFeatures(null, their_features); }
122                                 their_features_hu_conv.ptrs_to.add(this);
123                                 OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new OpenChannel(null, msg); }
124                                 arg.handle_open_channel(their_node_id, their_features_hu_conv, msg_hu_conv);
125                         }
126                         @Override public void handle_accept_channel(byte[] their_node_id, long their_features, long msg) {
127                                 InitFeatures their_features_hu_conv = null; if (their_features < 0 || their_features > 4096) { their_features_hu_conv = new InitFeatures(null, their_features); }
128                                 their_features_hu_conv.ptrs_to.add(this);
129                                 AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AcceptChannel(null, msg); }
130                                 arg.handle_accept_channel(their_node_id, their_features_hu_conv, msg_hu_conv);
131                         }
132                         @Override public void handle_funding_created(byte[] their_node_id, long msg) {
133                                 FundingCreated msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingCreated(null, msg); }
134                                 arg.handle_funding_created(their_node_id, msg_hu_conv);
135                         }
136                         @Override public void handle_funding_signed(byte[] their_node_id, long msg) {
137                                 FundingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingSigned(null, msg); }
138                                 arg.handle_funding_signed(their_node_id, msg_hu_conv);
139                         }
140                         @Override public void handle_funding_locked(byte[] their_node_id, long msg) {
141                                 FundingLocked msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingLocked(null, msg); }
142                                 arg.handle_funding_locked(their_node_id, msg_hu_conv);
143                         }
144                         @Override public void handle_shutdown(byte[] their_node_id, long their_features, long msg) {
145                                 InitFeatures their_features_hu_conv = null; if (their_features < 0 || their_features > 4096) { their_features_hu_conv = new InitFeatures(null, their_features); }
146                                 Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new Shutdown(null, msg); }
147                                 arg.handle_shutdown(their_node_id, their_features_hu_conv, msg_hu_conv);
148                         }
149                         @Override public void handle_closing_signed(byte[] their_node_id, long msg) {
150                                 ClosingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ClosingSigned(null, msg); }
151                                 arg.handle_closing_signed(their_node_id, msg_hu_conv);
152                         }
153                         @Override public void handle_update_add_htlc(byte[] their_node_id, long msg) {
154                                 UpdateAddHTLC msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateAddHTLC(null, msg); }
155                                 arg.handle_update_add_htlc(their_node_id, msg_hu_conv);
156                         }
157                         @Override public void handle_update_fulfill_htlc(byte[] their_node_id, long msg) {
158                                 UpdateFulfillHTLC msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateFulfillHTLC(null, msg); }
159                                 arg.handle_update_fulfill_htlc(their_node_id, msg_hu_conv);
160                         }
161                         @Override public void handle_update_fail_htlc(byte[] their_node_id, long msg) {
162                                 UpdateFailHTLC msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateFailHTLC(null, msg); }
163                                 arg.handle_update_fail_htlc(their_node_id, msg_hu_conv);
164                         }
165                         @Override public void handle_update_fail_malformed_htlc(byte[] their_node_id, long msg) {
166                                 UpdateFailMalformedHTLC msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateFailMalformedHTLC(null, msg); }
167                                 arg.handle_update_fail_malformed_htlc(their_node_id, msg_hu_conv);
168                         }
169                         @Override public void handle_commitment_signed(byte[] their_node_id, long msg) {
170                                 CommitmentSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new CommitmentSigned(null, msg); }
171                                 arg.handle_commitment_signed(their_node_id, msg_hu_conv);
172                         }
173                         @Override public void handle_revoke_and_ack(byte[] their_node_id, long msg) {
174                                 RevokeAndACK msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new RevokeAndACK(null, msg); }
175                                 arg.handle_revoke_and_ack(their_node_id, msg_hu_conv);
176                         }
177                         @Override public void handle_update_fee(byte[] their_node_id, long msg) {
178                                 UpdateFee msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateFee(null, msg); }
179                                 arg.handle_update_fee(their_node_id, msg_hu_conv);
180                         }
181                         @Override public void handle_announcement_signatures(byte[] their_node_id, long msg) {
182                                 AnnouncementSignatures msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AnnouncementSignatures(null, msg); }
183                                 arg.handle_announcement_signatures(their_node_id, msg_hu_conv);
184                         }
185                         @Override public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) {
186                                 arg.peer_disconnected(their_node_id, no_connection_possible);
187                         }
188                         @Override public void peer_connected(byte[] their_node_id, long msg) {
189                                 Init msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new Init(null, msg); }
190                                 arg.peer_connected(their_node_id, msg_hu_conv);
191                         }
192                         @Override public void handle_channel_reestablish(byte[] their_node_id, long msg) {
193                                 ChannelReestablish msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelReestablish(null, msg); }
194                                 arg.handle_channel_reestablish(their_node_id, msg_hu_conv);
195                         }
196                         @Override public void handle_channel_update(byte[] their_node_id, long msg) {
197                                 ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); }
198                                 arg.handle_channel_update(their_node_id, msg_hu_conv);
199                         }
200                         @Override public void handle_error(byte[] their_node_id, long msg) {
201                                 ErrorMessage msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ErrorMessage(null, msg); }
202                                 arg.handle_error(their_node_id, msg_hu_conv);
203                         }
204                 }, MessageSendEventsProvider.new_impl(MessageSendEventsProvider_impl).bindings_instance);
205                 return impl_holder.held;
206         }
207
208         /**
209          * Gets the underlying MessageSendEventsProvider.
210          */
211         public MessageSendEventsProvider get_message_send_events_provider() {
212                 MessageSendEventsProvider res = new MessageSendEventsProvider(null, bindings.LDKChannelMessageHandler_get_MessageSendEventsProvider(this.ptr));
213                 this.ptrs_to.add(res);
214                 return res;
215         }
216
217         /**
218          * Handle an incoming open_channel message from the given peer.
219          */
220         public void handle_open_channel(byte[] their_node_id, InitFeatures their_features, OpenChannel msg) {
221                 bindings.ChannelMessageHandler_handle_open_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr & ~1, msg == null ? 0 : msg.ptr & ~1);
222                 Reference.reachabilityFence(this);
223                 Reference.reachabilityFence(their_node_id);
224                 Reference.reachabilityFence(their_features);
225                 Reference.reachabilityFence(msg);
226                 this.ptrs_to.add(msg);
227         }
228
229         /**
230          * Handle an incoming accept_channel message from the given peer.
231          */
232         public void handle_accept_channel(byte[] their_node_id, InitFeatures their_features, AcceptChannel msg) {
233                 bindings.ChannelMessageHandler_handle_accept_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr & ~1, msg == null ? 0 : msg.ptr & ~1);
234                 Reference.reachabilityFence(this);
235                 Reference.reachabilityFence(their_node_id);
236                 Reference.reachabilityFence(their_features);
237                 Reference.reachabilityFence(msg);
238                 this.ptrs_to.add(msg);
239         }
240
241         /**
242          * Handle an incoming funding_created message from the given peer.
243          */
244         public void handle_funding_created(byte[] their_node_id, FundingCreated msg) {
245                 bindings.ChannelMessageHandler_handle_funding_created(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
246                 Reference.reachabilityFence(this);
247                 Reference.reachabilityFence(their_node_id);
248                 Reference.reachabilityFence(msg);
249                 this.ptrs_to.add(msg);
250         }
251
252         /**
253          * Handle an incoming funding_signed message from the given peer.
254          */
255         public void handle_funding_signed(byte[] their_node_id, FundingSigned msg) {
256                 bindings.ChannelMessageHandler_handle_funding_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
257                 Reference.reachabilityFence(this);
258                 Reference.reachabilityFence(their_node_id);
259                 Reference.reachabilityFence(msg);
260                 this.ptrs_to.add(msg);
261         }
262
263         /**
264          * Handle an incoming funding_locked message from the given peer.
265          */
266         public void handle_funding_locked(byte[] their_node_id, FundingLocked msg) {
267                 bindings.ChannelMessageHandler_handle_funding_locked(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
268                 Reference.reachabilityFence(this);
269                 Reference.reachabilityFence(their_node_id);
270                 Reference.reachabilityFence(msg);
271                 this.ptrs_to.add(msg);
272         }
273
274         /**
275          * Handle an incoming shutdown message from the given peer.
276          */
277         public void handle_shutdown(byte[] their_node_id, InitFeatures their_features, Shutdown msg) {
278                 bindings.ChannelMessageHandler_handle_shutdown(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr & ~1, msg == null ? 0 : msg.ptr & ~1);
279                 Reference.reachabilityFence(this);
280                 Reference.reachabilityFence(their_node_id);
281                 Reference.reachabilityFence(their_features);
282                 Reference.reachabilityFence(msg);
283                 this.ptrs_to.add(their_features);
284                 this.ptrs_to.add(msg);
285         }
286
287         /**
288          * Handle an incoming closing_signed message from the given peer.
289          */
290         public void handle_closing_signed(byte[] their_node_id, ClosingSigned msg) {
291                 bindings.ChannelMessageHandler_handle_closing_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
292                 Reference.reachabilityFence(this);
293                 Reference.reachabilityFence(their_node_id);
294                 Reference.reachabilityFence(msg);
295                 this.ptrs_to.add(msg);
296         }
297
298         /**
299          * Handle an incoming update_add_htlc message from the given peer.
300          */
301         public void handle_update_add_htlc(byte[] their_node_id, UpdateAddHTLC msg) {
302                 bindings.ChannelMessageHandler_handle_update_add_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
303                 Reference.reachabilityFence(this);
304                 Reference.reachabilityFence(their_node_id);
305                 Reference.reachabilityFence(msg);
306                 this.ptrs_to.add(msg);
307         }
308
309         /**
310          * Handle an incoming update_fulfill_htlc message from the given peer.
311          */
312         public void handle_update_fulfill_htlc(byte[] their_node_id, UpdateFulfillHTLC msg) {
313                 bindings.ChannelMessageHandler_handle_update_fulfill_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
314                 Reference.reachabilityFence(this);
315                 Reference.reachabilityFence(their_node_id);
316                 Reference.reachabilityFence(msg);
317                 this.ptrs_to.add(msg);
318         }
319
320         /**
321          * Handle an incoming update_fail_htlc message from the given peer.
322          */
323         public void handle_update_fail_htlc(byte[] their_node_id, UpdateFailHTLC msg) {
324                 bindings.ChannelMessageHandler_handle_update_fail_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
325                 Reference.reachabilityFence(this);
326                 Reference.reachabilityFence(their_node_id);
327                 Reference.reachabilityFence(msg);
328                 this.ptrs_to.add(msg);
329         }
330
331         /**
332          * Handle an incoming update_fail_malformed_htlc message from the given peer.
333          */
334         public void handle_update_fail_malformed_htlc(byte[] their_node_id, UpdateFailMalformedHTLC msg) {
335                 bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
336                 Reference.reachabilityFence(this);
337                 Reference.reachabilityFence(their_node_id);
338                 Reference.reachabilityFence(msg);
339                 this.ptrs_to.add(msg);
340         }
341
342         /**
343          * Handle an incoming commitment_signed message from the given peer.
344          */
345         public void handle_commitment_signed(byte[] their_node_id, CommitmentSigned msg) {
346                 bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
347                 Reference.reachabilityFence(this);
348                 Reference.reachabilityFence(their_node_id);
349                 Reference.reachabilityFence(msg);
350                 this.ptrs_to.add(msg);
351         }
352
353         /**
354          * Handle an incoming revoke_and_ack message from the given peer.
355          */
356         public void handle_revoke_and_ack(byte[] their_node_id, RevokeAndACK msg) {
357                 bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
358                 Reference.reachabilityFence(this);
359                 Reference.reachabilityFence(their_node_id);
360                 Reference.reachabilityFence(msg);
361                 this.ptrs_to.add(msg);
362         }
363
364         /**
365          * Handle an incoming update_fee message from the given peer.
366          */
367         public void handle_update_fee(byte[] their_node_id, UpdateFee msg) {
368                 bindings.ChannelMessageHandler_handle_update_fee(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
369                 Reference.reachabilityFence(this);
370                 Reference.reachabilityFence(their_node_id);
371                 Reference.reachabilityFence(msg);
372                 this.ptrs_to.add(msg);
373         }
374
375         /**
376          * Handle an incoming announcement_signatures message from the given peer.
377          */
378         public void handle_announcement_signatures(byte[] their_node_id, AnnouncementSignatures msg) {
379                 bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
380                 Reference.reachabilityFence(this);
381                 Reference.reachabilityFence(their_node_id);
382                 Reference.reachabilityFence(msg);
383                 this.ptrs_to.add(msg);
384         }
385
386         /**
387          * Indicates a connection to the peer failed/an existing connection was lost. If no connection
388          * is believed to be possible in the future (eg they're sending us messages we don't
389          * understand or indicate they require unknown feature bits), no_connection_possible is set
390          * and any outstanding channels should be failed.
391          */
392         public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) {
393                 bindings.ChannelMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), no_connection_possible);
394                 Reference.reachabilityFence(this);
395                 Reference.reachabilityFence(their_node_id);
396                 Reference.reachabilityFence(no_connection_possible);
397         }
398
399         /**
400          * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
401          */
402         public void peer_connected(byte[] their_node_id, Init msg) {
403                 bindings.ChannelMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
404                 Reference.reachabilityFence(this);
405                 Reference.reachabilityFence(their_node_id);
406                 Reference.reachabilityFence(msg);
407                 this.ptrs_to.add(msg);
408         }
409
410         /**
411          * Handle an incoming channel_reestablish message from the given peer.
412          */
413         public void handle_channel_reestablish(byte[] their_node_id, ChannelReestablish msg) {
414                 bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
415                 Reference.reachabilityFence(this);
416                 Reference.reachabilityFence(their_node_id);
417                 Reference.reachabilityFence(msg);
418                 this.ptrs_to.add(msg);
419         }
420
421         /**
422          * Handle an incoming channel update from the given peer.
423          */
424         public void handle_channel_update(byte[] their_node_id, ChannelUpdate msg) {
425                 bindings.ChannelMessageHandler_handle_channel_update(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
426                 Reference.reachabilityFence(this);
427                 Reference.reachabilityFence(their_node_id);
428                 Reference.reachabilityFence(msg);
429                 this.ptrs_to.add(msg);
430         }
431
432         /**
433          * Handle an incoming error message from the given peer.
434          */
435         public void handle_error(byte[] their_node_id, ErrorMessage msg) {
436                 bindings.ChannelMessageHandler_handle_error(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1);
437                 Reference.reachabilityFence(this);
438                 Reference.reachabilityFence(their_node_id);
439                 Reference.reachabilityFence(msg);
440                 this.ptrs_to.add(msg);
441         }
442
443 }