1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * Features used within a `node_announcement` message.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class NodeFeatures extends CommonBase {
16 NodeFeatures(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.NodeFeatures_free(ptr); }
24 * Checks if two NodeFeaturess contain equal inner contents.
25 * This ignores pointers and is_owned flags and looks at the values in fields.
26 * Two objects with NULL inner values will be considered "equal" here.
28 public boolean eq(NodeFeatures b) {
29 boolean ret = bindings.NodeFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
30 Reference.reachabilityFence(this);
31 Reference.reachabilityFence(b);
32 if (this != null) { this.ptrs_to.add(b); };
36 @Override public boolean equals(Object o) {
37 if (!(o instanceof NodeFeatures)) return false;
38 return this.eq((NodeFeatures)o);
41 long ret = bindings.NodeFeatures_clone_ptr(this.ptr);
42 Reference.reachabilityFence(this);
47 * Creates a copy of the NodeFeatures
49 public NodeFeatures clone() {
50 long ret = bindings.NodeFeatures_clone(this.ptr);
51 Reference.reachabilityFence(this);
52 if (ret >= 0 && ret <= 4096) { return null; }
53 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
54 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
59 * Returns the set of known node features that are related to channels.
61 public static NodeFeatures known_channel_features() {
62 long ret = bindings.NodeFeatures_known_channel_features();
63 if (ret >= 0 && ret <= 4096) { return null; }
64 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
65 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
70 * Create a blank Features with no features set
72 public static NodeFeatures empty() {
73 long ret = bindings.NodeFeatures_empty();
74 if (ret >= 0 && ret <= 4096) { return null; }
75 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
76 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
81 * Creates a Features with the bits set which are known by the implementation
83 public static NodeFeatures known() {
84 long ret = bindings.NodeFeatures_known();
85 if (ret >= 0 && ret <= 4096) { return null; }
86 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
87 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
92 * Returns true if this `Features` object contains unknown feature flags which are set as
95 public boolean requires_unknown_bits() {
96 boolean ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
97 Reference.reachabilityFence(this);
102 * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
104 public byte[] write() {
105 byte[] ret = bindings.NodeFeatures_write(this.ptr);
106 Reference.reachabilityFence(this);
111 * Read a NodeFeatures from a byte array, created by NodeFeatures_write
113 public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
114 long ret = bindings.NodeFeatures_read(ser);
115 Reference.reachabilityFence(ser);
116 if (ret >= 0 && ret <= 4096) { return null; }
117 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
122 * Set this feature as optional.
124 public void set_data_loss_protect_optional() {
125 bindings.NodeFeatures_set_data_loss_protect_optional(this.ptr);
126 Reference.reachabilityFence(this);
130 * Set this feature as required.
132 public void set_data_loss_protect_required() {
133 bindings.NodeFeatures_set_data_loss_protect_required(this.ptr);
134 Reference.reachabilityFence(this);
138 * Checks if this feature is supported.
140 public boolean supports_data_loss_protect() {
141 boolean ret = bindings.NodeFeatures_supports_data_loss_protect(this.ptr);
142 Reference.reachabilityFence(this);
147 * Checks if this feature is required.
149 public boolean requires_data_loss_protect() {
150 boolean ret = bindings.NodeFeatures_requires_data_loss_protect(this.ptr);
151 Reference.reachabilityFence(this);
156 * Set this feature as optional.
158 public void set_upfront_shutdown_script_optional() {
159 bindings.NodeFeatures_set_upfront_shutdown_script_optional(this.ptr);
160 Reference.reachabilityFence(this);
164 * Set this feature as required.
166 public void set_upfront_shutdown_script_required() {
167 bindings.NodeFeatures_set_upfront_shutdown_script_required(this.ptr);
168 Reference.reachabilityFence(this);
172 * Checks if this feature is supported.
174 public boolean supports_upfront_shutdown_script() {
175 boolean ret = bindings.NodeFeatures_supports_upfront_shutdown_script(this.ptr);
176 Reference.reachabilityFence(this);
181 * Checks if this feature is required.
183 public boolean requires_upfront_shutdown_script() {
184 boolean ret = bindings.NodeFeatures_requires_upfront_shutdown_script(this.ptr);
185 Reference.reachabilityFence(this);
190 * Set this feature as optional.
192 public void set_gossip_queries_optional() {
193 bindings.NodeFeatures_set_gossip_queries_optional(this.ptr);
194 Reference.reachabilityFence(this);
198 * Set this feature as required.
200 public void set_gossip_queries_required() {
201 bindings.NodeFeatures_set_gossip_queries_required(this.ptr);
202 Reference.reachabilityFence(this);
206 * Checks if this feature is supported.
208 public boolean supports_gossip_queries() {
209 boolean ret = bindings.NodeFeatures_supports_gossip_queries(this.ptr);
210 Reference.reachabilityFence(this);
215 * Checks if this feature is required.
217 public boolean requires_gossip_queries() {
218 boolean ret = bindings.NodeFeatures_requires_gossip_queries(this.ptr);
219 Reference.reachabilityFence(this);
224 * Set this feature as optional.
226 public void set_variable_length_onion_optional() {
227 bindings.NodeFeatures_set_variable_length_onion_optional(this.ptr);
228 Reference.reachabilityFence(this);
232 * Set this feature as required.
234 public void set_variable_length_onion_required() {
235 bindings.NodeFeatures_set_variable_length_onion_required(this.ptr);
236 Reference.reachabilityFence(this);
240 * Checks if this feature is supported.
242 public boolean supports_variable_length_onion() {
243 boolean ret = bindings.NodeFeatures_supports_variable_length_onion(this.ptr);
244 Reference.reachabilityFence(this);
249 * Checks if this feature is required.
251 public boolean requires_variable_length_onion() {
252 boolean ret = bindings.NodeFeatures_requires_variable_length_onion(this.ptr);
253 Reference.reachabilityFence(this);
258 * Set this feature as optional.
260 public void set_static_remote_key_optional() {
261 bindings.NodeFeatures_set_static_remote_key_optional(this.ptr);
262 Reference.reachabilityFence(this);
266 * Set this feature as required.
268 public void set_static_remote_key_required() {
269 bindings.NodeFeatures_set_static_remote_key_required(this.ptr);
270 Reference.reachabilityFence(this);
274 * Checks if this feature is supported.
276 public boolean supports_static_remote_key() {
277 boolean ret = bindings.NodeFeatures_supports_static_remote_key(this.ptr);
278 Reference.reachabilityFence(this);
283 * Checks if this feature is required.
285 public boolean requires_static_remote_key() {
286 boolean ret = bindings.NodeFeatures_requires_static_remote_key(this.ptr);
287 Reference.reachabilityFence(this);
292 * Set this feature as optional.
294 public void set_payment_secret_optional() {
295 bindings.NodeFeatures_set_payment_secret_optional(this.ptr);
296 Reference.reachabilityFence(this);
300 * Set this feature as required.
302 public void set_payment_secret_required() {
303 bindings.NodeFeatures_set_payment_secret_required(this.ptr);
304 Reference.reachabilityFence(this);
308 * Checks if this feature is supported.
310 public boolean supports_payment_secret() {
311 boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
312 Reference.reachabilityFence(this);
317 * Checks if this feature is required.
319 public boolean requires_payment_secret() {
320 boolean ret = bindings.NodeFeatures_requires_payment_secret(this.ptr);
321 Reference.reachabilityFence(this);
326 * Set this feature as optional.
328 public void set_basic_mpp_optional() {
329 bindings.NodeFeatures_set_basic_mpp_optional(this.ptr);
330 Reference.reachabilityFence(this);
334 * Set this feature as required.
336 public void set_basic_mpp_required() {
337 bindings.NodeFeatures_set_basic_mpp_required(this.ptr);
338 Reference.reachabilityFence(this);
342 * Checks if this feature is supported.
344 public boolean supports_basic_mpp() {
345 boolean ret = bindings.NodeFeatures_supports_basic_mpp(this.ptr);
346 Reference.reachabilityFence(this);
351 * Checks if this feature is required.
353 public boolean requires_basic_mpp() {
354 boolean ret = bindings.NodeFeatures_requires_basic_mpp(this.ptr);
355 Reference.reachabilityFence(this);
360 * Set this feature as optional.
362 public void set_wumbo_optional() {
363 bindings.NodeFeatures_set_wumbo_optional(this.ptr);
364 Reference.reachabilityFence(this);
368 * Set this feature as required.
370 public void set_wumbo_required() {
371 bindings.NodeFeatures_set_wumbo_required(this.ptr);
372 Reference.reachabilityFence(this);
376 * Checks if this feature is supported.
378 public boolean supports_wumbo() {
379 boolean ret = bindings.NodeFeatures_supports_wumbo(this.ptr);
380 Reference.reachabilityFence(this);
385 * Checks if this feature is required.
387 public boolean requires_wumbo() {
388 boolean ret = bindings.NodeFeatures_requires_wumbo(this.ptr);
389 Reference.reachabilityFence(this);
394 * Set this feature as optional.
396 public void set_shutdown_any_segwit_optional() {
397 bindings.NodeFeatures_set_shutdown_any_segwit_optional(this.ptr);
398 Reference.reachabilityFence(this);
402 * Set this feature as required.
404 public void set_shutdown_any_segwit_required() {
405 bindings.NodeFeatures_set_shutdown_any_segwit_required(this.ptr);
406 Reference.reachabilityFence(this);
410 * Checks if this feature is supported.
412 public boolean supports_shutdown_anysegwit() {
413 boolean ret = bindings.NodeFeatures_supports_shutdown_anysegwit(this.ptr);
414 Reference.reachabilityFence(this);
419 * Checks if this feature is required.
421 public boolean requires_shutdown_anysegwit() {
422 boolean ret = bindings.NodeFeatures_requires_shutdown_anysegwit(this.ptr);
423 Reference.reachabilityFence(this);
428 * Set this feature as optional.
430 public void set_onion_messages_optional() {
431 bindings.NodeFeatures_set_onion_messages_optional(this.ptr);
432 Reference.reachabilityFence(this);
436 * Set this feature as required.
438 public void set_onion_messages_required() {
439 bindings.NodeFeatures_set_onion_messages_required(this.ptr);
440 Reference.reachabilityFence(this);
444 * Checks if this feature is supported.
446 public boolean supports_onion_messages() {
447 boolean ret = bindings.NodeFeatures_supports_onion_messages(this.ptr);
448 Reference.reachabilityFence(this);
453 * Checks if this feature is required.
455 public boolean requires_onion_messages() {
456 boolean ret = bindings.NodeFeatures_requires_onion_messages(this.ptr);
457 Reference.reachabilityFence(this);
462 * Set this feature as optional.
464 public void set_channel_type_optional() {
465 bindings.NodeFeatures_set_channel_type_optional(this.ptr);
466 Reference.reachabilityFence(this);
470 * Set this feature as required.
472 public void set_channel_type_required() {
473 bindings.NodeFeatures_set_channel_type_required(this.ptr);
474 Reference.reachabilityFence(this);
478 * Checks if this feature is supported.
480 public boolean supports_channel_type() {
481 boolean ret = bindings.NodeFeatures_supports_channel_type(this.ptr);
482 Reference.reachabilityFence(this);
487 * Checks if this feature is required.
489 public boolean requires_channel_type() {
490 boolean ret = bindings.NodeFeatures_requires_channel_type(this.ptr);
491 Reference.reachabilityFence(this);
496 * Set this feature as optional.
498 public void set_scid_privacy_optional() {
499 bindings.NodeFeatures_set_scid_privacy_optional(this.ptr);
500 Reference.reachabilityFence(this);
504 * Set this feature as required.
506 public void set_scid_privacy_required() {
507 bindings.NodeFeatures_set_scid_privacy_required(this.ptr);
508 Reference.reachabilityFence(this);
512 * Checks if this feature is supported.
514 public boolean supports_scid_privacy() {
515 boolean ret = bindings.NodeFeatures_supports_scid_privacy(this.ptr);
516 Reference.reachabilityFence(this);
521 * Checks if this feature is required.
523 public boolean requires_scid_privacy() {
524 boolean ret = bindings.NodeFeatures_requires_scid_privacy(this.ptr);
525 Reference.reachabilityFence(this);
530 * Set this feature as optional.
532 public void set_zero_conf_optional() {
533 bindings.NodeFeatures_set_zero_conf_optional(this.ptr);
534 Reference.reachabilityFence(this);
538 * Set this feature as required.
540 public void set_zero_conf_required() {
541 bindings.NodeFeatures_set_zero_conf_required(this.ptr);
542 Reference.reachabilityFence(this);
546 * Checks if this feature is supported.
548 public boolean supports_zero_conf() {
549 boolean ret = bindings.NodeFeatures_supports_zero_conf(this.ptr);
550 Reference.reachabilityFence(this);
555 * Checks if this feature is required.
557 public boolean requires_zero_conf() {
558 boolean ret = bindings.NodeFeatures_requires_zero_conf(this.ptr);
559 Reference.reachabilityFence(this);
564 * Set this feature as optional.
566 public void set_keysend_optional() {
567 bindings.NodeFeatures_set_keysend_optional(this.ptr);
568 Reference.reachabilityFence(this);
572 * Set this feature as required.
574 public void set_keysend_required() {
575 bindings.NodeFeatures_set_keysend_required(this.ptr);
576 Reference.reachabilityFence(this);
580 * Checks if this feature is supported.
582 public boolean supports_keysend() {
583 boolean ret = bindings.NodeFeatures_supports_keysend(this.ptr);
584 Reference.reachabilityFence(this);
589 * Checks if this feature is required.
591 public boolean requires_keysend() {
592 boolean ret = bindings.NodeFeatures_requires_keysend(this.ptr);
593 Reference.reachabilityFence(this);