Update CI references to 0.0.122
[ldk-java] / src / main / java / org / ldk / structs / RoutingMessageHandler.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 routing messages.
12  * 
13  * # Implementor DoS Warnings
14  * 
15  * For messages enabled with the `gossip_queries` feature there are potential DoS vectors when
16  * handling inbound queries. Implementors using an on-disk network graph should be aware of
17  * repeated disk I/O for queries accessing different parts of the network graph.
18  */
19 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
20 public class RoutingMessageHandler extends CommonBase {
21         final bindings.LDKRoutingMessageHandler bindings_instance;
22         RoutingMessageHandler(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
23         private RoutingMessageHandler(bindings.LDKRoutingMessageHandler arg, bindings.LDKMessageSendEventsProvider MessageSendEventsProvider) {
24                 super(bindings.LDKRoutingMessageHandler_new(arg, MessageSendEventsProvider));
25                 this.ptrs_to.add(arg);
26                 this.ptrs_to.add(MessageSendEventsProvider);
27                 this.bindings_instance = arg;
28         }
29         @Override @SuppressWarnings("deprecation")
30         protected void finalize() throws Throwable {
31                 if (ptr != 0) { bindings.RoutingMessageHandler_free(ptr); } super.finalize();
32         }
33         /**
34          * Destroys the object, freeing associated resources. After this call, any access
35          * to this object may result in a SEGFAULT or worse.
36          *
37          * You should generally NEVER call this method. You should let the garbage collector
38          * do this for you when it finalizes objects. However, it may be useful for types
39          * which represent locks and should be closed immediately to avoid holding locks
40          * until the GC runs.
41          */
42         public void destroy() {
43                 if (ptr != 0) { bindings.RoutingMessageHandler_free(ptr); }
44                 ptr = 0;
45         }
46         public static interface RoutingMessageHandlerInterface {
47                 /**
48                  * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on,
49                  * `false` or returning an `Err` otherwise.
50                  */
51                 Result_boolLightningErrorZ handle_node_announcement(NodeAnnouncement msg);
52                 /**
53                  * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false`
54                  * or returning an `Err` otherwise.
55                  */
56                 Result_boolLightningErrorZ handle_channel_announcement(ChannelAnnouncement msg);
57                 /**
58                  * Handle an incoming `channel_update` message, returning true if it should be forwarded on,
59                  * `false` or returning an `Err` otherwise.
60                  */
61                 Result_boolLightningErrorZ handle_channel_update(ChannelUpdate msg);
62                 /**
63                  * Gets channel announcements and updates required to dump our routing table to a remote node,
64                  * starting at the `short_channel_id` indicated by `starting_point` and including announcements
65                  * for a single channel.
66                  */
67                 Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement(long starting_point);
68                 /**
69                  * Gets a node announcement required to dump our routing table to a remote node, starting at
70                  * the node *after* the provided pubkey and including up to one announcement immediately
71                  * higher (as defined by `<PublicKey as Ord>::cmp`) than `starting_point`.
72                  * If `None` is provided for `starting_point`, we start at the first node.
73                  * 
74                  * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
75                  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
76                  */
77                 NodeAnnouncement get_next_node_announcement(NodeId starting_point);
78                 /**
79                  * Called when a connection is established with a peer. This can be used to
80                  * perform routing table synchronization using a strategy defined by the
81                  * implementor.
82                  * 
83                  * May return an `Err(())` if the features the peer supports are not sufficient to communicate
84                  * with us. Implementors should be somewhat conservative about doing so, however, as other
85                  * message handlers may still wish to communicate with this peer.
86                  */
87                 Result_NoneNoneZ peer_connected(byte[] their_node_id, Init init, boolean inbound);
88                 /**
89                  * Handles the reply of a query we initiated to learn about channels
90                  * for a given range of blocks. We can expect to receive one or more
91                  * replies to a single query.
92                  */
93                 Result_NoneLightningErrorZ handle_reply_channel_range(byte[] their_node_id, ReplyChannelRange msg);
94                 /**
95                  * Handles the reply of a query we initiated asking for routing gossip
96                  * messages for a list of channels. We should receive this message when
97                  * a node has completed its best effort to send us the pertaining routing
98                  * gossip messages.
99                  */
100                 Result_NoneLightningErrorZ handle_reply_short_channel_ids_end(byte[] their_node_id, ReplyShortChannelIdsEnd msg);
101                 /**
102                  * Handles when a peer asks us to send a list of `short_channel_id`s
103                  * for the requested range of blocks.
104                  */
105                 Result_NoneLightningErrorZ handle_query_channel_range(byte[] their_node_id, QueryChannelRange msg);
106                 /**
107                  * Handles when a peer asks us to send routing gossip messages for a
108                  * list of `short_channel_id`s.
109                  */
110                 Result_NoneLightningErrorZ handle_query_short_channel_ids(byte[] their_node_id, QueryShortChannelIds msg);
111                 /**
112                  * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages
113                  * pending some async action. While there is no guarantee of the rate of future messages, the
114                  * caller should seek to reduce the rate of new gossip messages handled, especially
115                  * [`ChannelAnnouncement`]s.
116                  */
117                 boolean processing_queue_high();
118                 /**
119                  * Gets the node feature flags which this handler itself supports. All available handlers are
120                  * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
121                  * which are broadcasted in our [`NodeAnnouncement`] message.
122                  */
123                 NodeFeatures provided_node_features();
124                 /**
125                  * Gets the init feature flags which should be sent to the given peer. All available handlers
126                  * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
127                  * which are sent in our [`Init`] message.
128                  * 
129                  * Note that this method is called before [`Self::peer_connected`].
130                  */
131                 InitFeatures provided_init_features(byte[] their_node_id);
132         }
133         private static class LDKRoutingMessageHandlerHolder { RoutingMessageHandler held; }
134         public static RoutingMessageHandler new_impl(RoutingMessageHandlerInterface arg, MessageSendEventsProvider.MessageSendEventsProviderInterface MessageSendEventsProvider_impl) {
135                 final LDKRoutingMessageHandlerHolder impl_holder = new LDKRoutingMessageHandlerHolder();
136                 impl_holder.held = new RoutingMessageHandler(new bindings.LDKRoutingMessageHandler() {
137                         @Override public long handle_node_announcement(long msg) {
138                                 org.ldk.structs.NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.NodeAnnouncement(null, msg); }
139                                 Result_boolLightningErrorZ ret = arg.handle_node_announcement(msg_hu_conv);
140                                 Reference.reachabilityFence(arg);
141                                 long result = ret == null ? 0 : ret.clone_ptr();
142                                 return result;
143                         }
144                         @Override public long handle_channel_announcement(long msg) {
145                                 org.ldk.structs.ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, msg); }
146                                 Result_boolLightningErrorZ ret = arg.handle_channel_announcement(msg_hu_conv);
147                                 Reference.reachabilityFence(arg);
148                                 long result = ret == null ? 0 : ret.clone_ptr();
149                                 return result;
150                         }
151                         @Override public long handle_channel_update(long msg) {
152                                 org.ldk.structs.ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, msg); }
153                                 Result_boolLightningErrorZ ret = arg.handle_channel_update(msg_hu_conv);
154                                 Reference.reachabilityFence(arg);
155                                 long result = ret == null ? 0 : ret.clone_ptr();
156                                 return result;
157                         }
158                         @Override public long get_next_channel_announcement(long starting_point) {
159                                 Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = arg.get_next_channel_announcement(starting_point);
160                                 Reference.reachabilityFence(arg);
161                                 long result = ret == null ? 0 : ret.clone_ptr();
162                                 if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); };
163                                 return result;
164                         }
165                         @Override public long get_next_node_announcement(long starting_point) {
166                                 org.ldk.structs.NodeId starting_point_hu_conv = null; if (starting_point < 0 || starting_point > 4096) { starting_point_hu_conv = new org.ldk.structs.NodeId(null, starting_point); }
167                                 if (starting_point_hu_conv != null) { starting_point_hu_conv.ptrs_to.add(this); };
168                                 NodeAnnouncement ret = arg.get_next_node_announcement(starting_point_hu_conv);
169                                 Reference.reachabilityFence(arg);
170                                 long result = ret == null ? 0 : ret.clone_ptr();
171                                 return result;
172                         }
173                         @Override public long peer_connected(byte[] their_node_id, long init, boolean inbound) {
174                                 org.ldk.structs.Init init_hu_conv = null; if (init < 0 || init > 4096) { init_hu_conv = new org.ldk.structs.Init(null, init); }
175                                 Result_NoneNoneZ ret = arg.peer_connected(their_node_id, init_hu_conv, inbound);
176                                 Reference.reachabilityFence(arg);
177                                 long result = ret == null ? 0 : ret.clone_ptr();
178                                 return result;
179                         }
180                         @Override public long handle_reply_channel_range(byte[] their_node_id, long msg) {
181                                 org.ldk.structs.ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ReplyChannelRange(null, msg); }
182                                 if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
183                                 Result_NoneLightningErrorZ ret = arg.handle_reply_channel_range(their_node_id, msg_hu_conv);
184                                 Reference.reachabilityFence(arg);
185                                 long result = ret == null ? 0 : ret.clone_ptr();
186                                 return result;
187                         }
188                         @Override public long handle_reply_short_channel_ids_end(byte[] their_node_id, long msg) {
189                                 org.ldk.structs.ReplyShortChannelIdsEnd msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.ReplyShortChannelIdsEnd(null, msg); }
190                                 if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
191                                 Result_NoneLightningErrorZ ret = arg.handle_reply_short_channel_ids_end(their_node_id, msg_hu_conv);
192                                 Reference.reachabilityFence(arg);
193                                 long result = ret == null ? 0 : ret.clone_ptr();
194                                 return result;
195                         }
196                         @Override public long handle_query_channel_range(byte[] their_node_id, long msg) {
197                                 org.ldk.structs.QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.QueryChannelRange(null, msg); }
198                                 if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
199                                 Result_NoneLightningErrorZ ret = arg.handle_query_channel_range(their_node_id, msg_hu_conv);
200                                 Reference.reachabilityFence(arg);
201                                 long result = ret == null ? 0 : ret.clone_ptr();
202                                 return result;
203                         }
204                         @Override public long handle_query_short_channel_ids(byte[] their_node_id, long msg) {
205                                 org.ldk.structs.QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, msg); }
206                                 if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); };
207                                 Result_NoneLightningErrorZ ret = arg.handle_query_short_channel_ids(their_node_id, msg_hu_conv);
208                                 Reference.reachabilityFence(arg);
209                                 long result = ret == null ? 0 : ret.clone_ptr();
210                                 return result;
211                         }
212                         @Override public boolean processing_queue_high() {
213                                 boolean ret = arg.processing_queue_high();
214                                 Reference.reachabilityFence(arg);
215                                 return ret;
216                         }
217                         @Override public long provided_node_features() {
218                                 NodeFeatures ret = arg.provided_node_features();
219                                 Reference.reachabilityFence(arg);
220                                 long result = ret == null ? 0 : ret.clone_ptr();
221                                 return result;
222                         }
223                         @Override public long provided_init_features(byte[] their_node_id) {
224                                 InitFeatures ret = arg.provided_init_features(their_node_id);
225                                 Reference.reachabilityFence(arg);
226                                 long result = ret == null ? 0 : ret.clone_ptr();
227                                 return result;
228                         }
229                 }, MessageSendEventsProvider.new_impl(MessageSendEventsProvider_impl).bindings_instance);
230                 return impl_holder.held;
231         }
232
233         /**
234          * Gets the underlying MessageSendEventsProvider.
235          */
236         public MessageSendEventsProvider get_message_send_events_provider() {
237                 MessageSendEventsProvider res = new MessageSendEventsProvider(null, bindings.LDKRoutingMessageHandler_get_MessageSendEventsProvider(this.ptr));
238                 res.ptrs_to.add(this);
239                 return res;
240         }
241
242         /**
243          * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on,
244          * `false` or returning an `Err` otherwise.
245          */
246         public Result_boolLightningErrorZ handle_node_announcement(org.ldk.structs.NodeAnnouncement msg) {
247                 long ret = bindings.RoutingMessageHandler_handle_node_announcement(this.ptr, msg == null ? 0 : msg.ptr);
248                 Reference.reachabilityFence(this);
249                 Reference.reachabilityFence(msg);
250                 if (ret >= 0 && ret <= 4096) { return null; }
251                 Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret);
252                 if (this != null) { this.ptrs_to.add(msg); };
253                 return ret_hu_conv;
254         }
255
256         /**
257          * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false`
258          * or returning an `Err` otherwise.
259          */
260         public Result_boolLightningErrorZ handle_channel_announcement(org.ldk.structs.ChannelAnnouncement msg) {
261                 long ret = bindings.RoutingMessageHandler_handle_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr);
262                 Reference.reachabilityFence(this);
263                 Reference.reachabilityFence(msg);
264                 if (ret >= 0 && ret <= 4096) { return null; }
265                 Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret);
266                 if (this != null) { this.ptrs_to.add(msg); };
267                 return ret_hu_conv;
268         }
269
270         /**
271          * Handle an incoming `channel_update` message, returning true if it should be forwarded on,
272          * `false` or returning an `Err` otherwise.
273          */
274         public Result_boolLightningErrorZ handle_channel_update(org.ldk.structs.ChannelUpdate msg) {
275                 long ret = bindings.RoutingMessageHandler_handle_channel_update(this.ptr, msg == null ? 0 : msg.ptr);
276                 Reference.reachabilityFence(this);
277                 Reference.reachabilityFence(msg);
278                 if (ret >= 0 && ret <= 4096) { return null; }
279                 Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret);
280                 if (this != null) { this.ptrs_to.add(msg); };
281                 return ret_hu_conv;
282         }
283
284         /**
285          * Gets channel announcements and updates required to dump our routing table to a remote node,
286          * starting at the `short_channel_id` indicated by `starting_point` and including announcements
287          * for a single channel.
288          */
289         public Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement(long starting_point) {
290                 long ret = bindings.RoutingMessageHandler_get_next_channel_announcement(this.ptr, starting_point);
291                 Reference.reachabilityFence(this);
292                 Reference.reachabilityFence(starting_point);
293                 if (ret >= 0 && ret <= 4096) { return null; }
294                 org.ldk.structs.Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_hu_conv = org.ldk.structs.Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ.constr_from_ptr(ret);
295                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
296                 return ret_hu_conv;
297         }
298
299         /**
300          * Gets a node announcement required to dump our routing table to a remote node, starting at
301          * the node *after* the provided pubkey and including up to one announcement immediately
302          * higher (as defined by `<PublicKey as Ord>::cmp`) than `starting_point`.
303          * If `None` is provided for `starting_point`, we start at the first node.
304          * 
305          * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
306          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
307          */
308         @Nullable
309         public NodeAnnouncement get_next_node_announcement(@Nullable org.ldk.structs.NodeId starting_point) {
310                 long ret = bindings.RoutingMessageHandler_get_next_node_announcement(this.ptr, starting_point == null ? 0 : starting_point.ptr);
311                 Reference.reachabilityFence(this);
312                 Reference.reachabilityFence(starting_point);
313                 if (ret >= 0 && ret <= 4096) { return null; }
314                 org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); }
315                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
316                 if (this != null) { this.ptrs_to.add(starting_point); };
317                 return ret_hu_conv;
318         }
319
320         /**
321          * Called when a connection is established with a peer. This can be used to
322          * perform routing table synchronization using a strategy defined by the
323          * implementor.
324          * 
325          * May return an `Err(())` if the features the peer supports are not sufficient to communicate
326          * with us. Implementors should be somewhat conservative about doing so, however, as other
327          * message handlers may still wish to communicate with this peer.
328          */
329         public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init init, boolean inbound) {
330                 long ret = bindings.RoutingMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), init == null ? 0 : init.ptr, inbound);
331                 Reference.reachabilityFence(this);
332                 Reference.reachabilityFence(their_node_id);
333                 Reference.reachabilityFence(init);
334                 Reference.reachabilityFence(inbound);
335                 if (ret >= 0 && ret <= 4096) { return null; }
336                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
337                 if (this != null) { this.ptrs_to.add(init); };
338                 return ret_hu_conv;
339         }
340
341         /**
342          * Handles the reply of a query we initiated to learn about channels
343          * for a given range of blocks. We can expect to receive one or more
344          * replies to a single query.
345          */
346         public Result_NoneLightningErrorZ handle_reply_channel_range(byte[] their_node_id, org.ldk.structs.ReplyChannelRange msg) {
347                 long ret = bindings.RoutingMessageHandler_handle_reply_channel_range(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
348                 Reference.reachabilityFence(this);
349                 Reference.reachabilityFence(their_node_id);
350                 Reference.reachabilityFence(msg);
351                 if (ret >= 0 && ret <= 4096) { return null; }
352                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
353                 if (this != null) { this.ptrs_to.add(msg); };
354                 return ret_hu_conv;
355         }
356
357         /**
358          * Handles the reply of a query we initiated asking for routing gossip
359          * messages for a list of channels. We should receive this message when
360          * a node has completed its best effort to send us the pertaining routing
361          * gossip messages.
362          */
363         public Result_NoneLightningErrorZ handle_reply_short_channel_ids_end(byte[] their_node_id, org.ldk.structs.ReplyShortChannelIdsEnd msg) {
364                 long ret = bindings.RoutingMessageHandler_handle_reply_short_channel_ids_end(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
365                 Reference.reachabilityFence(this);
366                 Reference.reachabilityFence(their_node_id);
367                 Reference.reachabilityFence(msg);
368                 if (ret >= 0 && ret <= 4096) { return null; }
369                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
370                 if (this != null) { this.ptrs_to.add(msg); };
371                 return ret_hu_conv;
372         }
373
374         /**
375          * Handles when a peer asks us to send a list of `short_channel_id`s
376          * for the requested range of blocks.
377          */
378         public Result_NoneLightningErrorZ handle_query_channel_range(byte[] their_node_id, org.ldk.structs.QueryChannelRange msg) {
379                 long ret = bindings.RoutingMessageHandler_handle_query_channel_range(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
380                 Reference.reachabilityFence(this);
381                 Reference.reachabilityFence(their_node_id);
382                 Reference.reachabilityFence(msg);
383                 if (ret >= 0 && ret <= 4096) { return null; }
384                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
385                 if (this != null) { this.ptrs_to.add(msg); };
386                 return ret_hu_conv;
387         }
388
389         /**
390          * Handles when a peer asks us to send routing gossip messages for a
391          * list of `short_channel_id`s.
392          */
393         public Result_NoneLightningErrorZ handle_query_short_channel_ids(byte[] their_node_id, org.ldk.structs.QueryShortChannelIds msg) {
394                 long ret = bindings.RoutingMessageHandler_handle_query_short_channel_ids(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
395                 Reference.reachabilityFence(this);
396                 Reference.reachabilityFence(their_node_id);
397                 Reference.reachabilityFence(msg);
398                 if (ret >= 0 && ret <= 4096) { return null; }
399                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
400                 if (this != null) { this.ptrs_to.add(msg); };
401                 return ret_hu_conv;
402         }
403
404         /**
405          * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages
406          * pending some async action. While there is no guarantee of the rate of future messages, the
407          * caller should seek to reduce the rate of new gossip messages handled, especially
408          * [`ChannelAnnouncement`]s.
409          */
410         public boolean processing_queue_high() {
411                 boolean ret = bindings.RoutingMessageHandler_processing_queue_high(this.ptr);
412                 Reference.reachabilityFence(this);
413                 return ret;
414         }
415
416         /**
417          * Gets the node feature flags which this handler itself supports. All available handlers are
418          * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
419          * which are broadcasted in our [`NodeAnnouncement`] message.
420          */
421         public NodeFeatures provided_node_features() {
422                 long ret = bindings.RoutingMessageHandler_provided_node_features(this.ptr);
423                 Reference.reachabilityFence(this);
424                 if (ret >= 0 && ret <= 4096) { return null; }
425                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
426                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
427                 return ret_hu_conv;
428         }
429
430         /**
431          * Gets the init feature flags which should be sent to the given peer. All available handlers
432          * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
433          * which are sent in our [`Init`] message.
434          * 
435          * Note that this method is called before [`Self::peer_connected`].
436          */
437         public InitFeatures provided_init_features(byte[] their_node_id) {
438                 long ret = bindings.RoutingMessageHandler_provided_init_features(this.ptr, InternalUtils.check_arr_len(their_node_id, 33));
439                 Reference.reachabilityFence(this);
440                 Reference.reachabilityFence(their_node_id);
441                 if (ret >= 0 && ret <= 4096) { return null; }
442                 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
443                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
444                 return ret_hu_conv;
445         }
446
447 }