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(org.ldk.structs.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 * Create a blank Features with no features set
61 public static NodeFeatures empty() {
62 long ret = bindings.NodeFeatures_empty();
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 * Returns true if this `Features` object contains unknown feature flags which are set as
73 public boolean requires_unknown_bits() {
74 boolean ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
75 Reference.reachabilityFence(this);
80 * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
82 public byte[] write() {
83 byte[] ret = bindings.NodeFeatures_write(this.ptr);
84 Reference.reachabilityFence(this);
89 * Read a NodeFeatures from a byte array, created by NodeFeatures_write
91 public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
92 long ret = bindings.NodeFeatures_read(ser);
93 Reference.reachabilityFence(ser);
94 if (ret >= 0 && ret <= 4096) { return null; }
95 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
100 * Set this feature as optional.
102 public void set_data_loss_protect_optional() {
103 bindings.NodeFeatures_set_data_loss_protect_optional(this.ptr);
104 Reference.reachabilityFence(this);
108 * Set this feature as required.
110 public void set_data_loss_protect_required() {
111 bindings.NodeFeatures_set_data_loss_protect_required(this.ptr);
112 Reference.reachabilityFence(this);
116 * Checks if this feature is supported.
118 public boolean supports_data_loss_protect() {
119 boolean ret = bindings.NodeFeatures_supports_data_loss_protect(this.ptr);
120 Reference.reachabilityFence(this);
125 * Checks if this feature is required.
127 public boolean requires_data_loss_protect() {
128 boolean ret = bindings.NodeFeatures_requires_data_loss_protect(this.ptr);
129 Reference.reachabilityFence(this);
134 * Set this feature as optional.
136 public void set_upfront_shutdown_script_optional() {
137 bindings.NodeFeatures_set_upfront_shutdown_script_optional(this.ptr);
138 Reference.reachabilityFence(this);
142 * Set this feature as required.
144 public void set_upfront_shutdown_script_required() {
145 bindings.NodeFeatures_set_upfront_shutdown_script_required(this.ptr);
146 Reference.reachabilityFence(this);
150 * Checks if this feature is supported.
152 public boolean supports_upfront_shutdown_script() {
153 boolean ret = bindings.NodeFeatures_supports_upfront_shutdown_script(this.ptr);
154 Reference.reachabilityFence(this);
159 * Checks if this feature is required.
161 public boolean requires_upfront_shutdown_script() {
162 boolean ret = bindings.NodeFeatures_requires_upfront_shutdown_script(this.ptr);
163 Reference.reachabilityFence(this);
168 * Set this feature as optional.
170 public void set_gossip_queries_optional() {
171 bindings.NodeFeatures_set_gossip_queries_optional(this.ptr);
172 Reference.reachabilityFence(this);
176 * Set this feature as required.
178 public void set_gossip_queries_required() {
179 bindings.NodeFeatures_set_gossip_queries_required(this.ptr);
180 Reference.reachabilityFence(this);
184 * Checks if this feature is supported.
186 public boolean supports_gossip_queries() {
187 boolean ret = bindings.NodeFeatures_supports_gossip_queries(this.ptr);
188 Reference.reachabilityFence(this);
193 * Checks if this feature is required.
195 public boolean requires_gossip_queries() {
196 boolean ret = bindings.NodeFeatures_requires_gossip_queries(this.ptr);
197 Reference.reachabilityFence(this);
202 * Set this feature as optional.
204 public void set_variable_length_onion_optional() {
205 bindings.NodeFeatures_set_variable_length_onion_optional(this.ptr);
206 Reference.reachabilityFence(this);
210 * Set this feature as required.
212 public void set_variable_length_onion_required() {
213 bindings.NodeFeatures_set_variable_length_onion_required(this.ptr);
214 Reference.reachabilityFence(this);
218 * Checks if this feature is supported.
220 public boolean supports_variable_length_onion() {
221 boolean ret = bindings.NodeFeatures_supports_variable_length_onion(this.ptr);
222 Reference.reachabilityFence(this);
227 * Checks if this feature is required.
229 public boolean requires_variable_length_onion() {
230 boolean ret = bindings.NodeFeatures_requires_variable_length_onion(this.ptr);
231 Reference.reachabilityFence(this);
236 * Set this feature as optional.
238 public void set_static_remote_key_optional() {
239 bindings.NodeFeatures_set_static_remote_key_optional(this.ptr);
240 Reference.reachabilityFence(this);
244 * Set this feature as required.
246 public void set_static_remote_key_required() {
247 bindings.NodeFeatures_set_static_remote_key_required(this.ptr);
248 Reference.reachabilityFence(this);
252 * Checks if this feature is supported.
254 public boolean supports_static_remote_key() {
255 boolean ret = bindings.NodeFeatures_supports_static_remote_key(this.ptr);
256 Reference.reachabilityFence(this);
261 * Checks if this feature is required.
263 public boolean requires_static_remote_key() {
264 boolean ret = bindings.NodeFeatures_requires_static_remote_key(this.ptr);
265 Reference.reachabilityFence(this);
270 * Set this feature as optional.
272 public void set_payment_secret_optional() {
273 bindings.NodeFeatures_set_payment_secret_optional(this.ptr);
274 Reference.reachabilityFence(this);
278 * Set this feature as required.
280 public void set_payment_secret_required() {
281 bindings.NodeFeatures_set_payment_secret_required(this.ptr);
282 Reference.reachabilityFence(this);
286 * Checks if this feature is supported.
288 public boolean supports_payment_secret() {
289 boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
290 Reference.reachabilityFence(this);
295 * Checks if this feature is required.
297 public boolean requires_payment_secret() {
298 boolean ret = bindings.NodeFeatures_requires_payment_secret(this.ptr);
299 Reference.reachabilityFence(this);
304 * Set this feature as optional.
306 public void set_basic_mpp_optional() {
307 bindings.NodeFeatures_set_basic_mpp_optional(this.ptr);
308 Reference.reachabilityFence(this);
312 * Set this feature as required.
314 public void set_basic_mpp_required() {
315 bindings.NodeFeatures_set_basic_mpp_required(this.ptr);
316 Reference.reachabilityFence(this);
320 * Checks if this feature is supported.
322 public boolean supports_basic_mpp() {
323 boolean ret = bindings.NodeFeatures_supports_basic_mpp(this.ptr);
324 Reference.reachabilityFence(this);
329 * Checks if this feature is required.
331 public boolean requires_basic_mpp() {
332 boolean ret = bindings.NodeFeatures_requires_basic_mpp(this.ptr);
333 Reference.reachabilityFence(this);
338 * Set this feature as optional.
340 public void set_wumbo_optional() {
341 bindings.NodeFeatures_set_wumbo_optional(this.ptr);
342 Reference.reachabilityFence(this);
346 * Set this feature as required.
348 public void set_wumbo_required() {
349 bindings.NodeFeatures_set_wumbo_required(this.ptr);
350 Reference.reachabilityFence(this);
354 * Checks if this feature is supported.
356 public boolean supports_wumbo() {
357 boolean ret = bindings.NodeFeatures_supports_wumbo(this.ptr);
358 Reference.reachabilityFence(this);
363 * Checks if this feature is required.
365 public boolean requires_wumbo() {
366 boolean ret = bindings.NodeFeatures_requires_wumbo(this.ptr);
367 Reference.reachabilityFence(this);
372 * Set this feature as optional.
374 public void set_anchors_zero_fee_htlc_tx_optional() {
375 bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
376 Reference.reachabilityFence(this);
380 * Set this feature as required.
382 public void set_anchors_zero_fee_htlc_tx_required() {
383 bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
384 Reference.reachabilityFence(this);
388 * Checks if this feature is supported.
390 public boolean supports_anchors_zero_fee_htlc_tx() {
391 boolean ret = bindings.NodeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
392 Reference.reachabilityFence(this);
397 * Checks if this feature is required.
399 public boolean requires_anchors_zero_fee_htlc_tx() {
400 boolean ret = bindings.NodeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
401 Reference.reachabilityFence(this);
406 * Set this feature as optional.
408 public void set_shutdown_any_segwit_optional() {
409 bindings.NodeFeatures_set_shutdown_any_segwit_optional(this.ptr);
410 Reference.reachabilityFence(this);
414 * Set this feature as required.
416 public void set_shutdown_any_segwit_required() {
417 bindings.NodeFeatures_set_shutdown_any_segwit_required(this.ptr);
418 Reference.reachabilityFence(this);
422 * Checks if this feature is supported.
424 public boolean supports_shutdown_anysegwit() {
425 boolean ret = bindings.NodeFeatures_supports_shutdown_anysegwit(this.ptr);
426 Reference.reachabilityFence(this);
431 * Checks if this feature is required.
433 public boolean requires_shutdown_anysegwit() {
434 boolean ret = bindings.NodeFeatures_requires_shutdown_anysegwit(this.ptr);
435 Reference.reachabilityFence(this);
440 * Set this feature as optional.
442 public void set_onion_messages_optional() {
443 bindings.NodeFeatures_set_onion_messages_optional(this.ptr);
444 Reference.reachabilityFence(this);
448 * Set this feature as required.
450 public void set_onion_messages_required() {
451 bindings.NodeFeatures_set_onion_messages_required(this.ptr);
452 Reference.reachabilityFence(this);
456 * Checks if this feature is supported.
458 public boolean supports_onion_messages() {
459 boolean ret = bindings.NodeFeatures_supports_onion_messages(this.ptr);
460 Reference.reachabilityFence(this);
465 * Checks if this feature is required.
467 public boolean requires_onion_messages() {
468 boolean ret = bindings.NodeFeatures_requires_onion_messages(this.ptr);
469 Reference.reachabilityFence(this);
474 * Set this feature as optional.
476 public void set_channel_type_optional() {
477 bindings.NodeFeatures_set_channel_type_optional(this.ptr);
478 Reference.reachabilityFence(this);
482 * Set this feature as required.
484 public void set_channel_type_required() {
485 bindings.NodeFeatures_set_channel_type_required(this.ptr);
486 Reference.reachabilityFence(this);
490 * Checks if this feature is supported.
492 public boolean supports_channel_type() {
493 boolean ret = bindings.NodeFeatures_supports_channel_type(this.ptr);
494 Reference.reachabilityFence(this);
499 * Checks if this feature is required.
501 public boolean requires_channel_type() {
502 boolean ret = bindings.NodeFeatures_requires_channel_type(this.ptr);
503 Reference.reachabilityFence(this);
508 * Set this feature as optional.
510 public void set_scid_privacy_optional() {
511 bindings.NodeFeatures_set_scid_privacy_optional(this.ptr);
512 Reference.reachabilityFence(this);
516 * Set this feature as required.
518 public void set_scid_privacy_required() {
519 bindings.NodeFeatures_set_scid_privacy_required(this.ptr);
520 Reference.reachabilityFence(this);
524 * Checks if this feature is supported.
526 public boolean supports_scid_privacy() {
527 boolean ret = bindings.NodeFeatures_supports_scid_privacy(this.ptr);
528 Reference.reachabilityFence(this);
533 * Checks if this feature is required.
535 public boolean requires_scid_privacy() {
536 boolean ret = bindings.NodeFeatures_requires_scid_privacy(this.ptr);
537 Reference.reachabilityFence(this);
542 * Set this feature as optional.
544 public void set_zero_conf_optional() {
545 bindings.NodeFeatures_set_zero_conf_optional(this.ptr);
546 Reference.reachabilityFence(this);
550 * Set this feature as required.
552 public void set_zero_conf_required() {
553 bindings.NodeFeatures_set_zero_conf_required(this.ptr);
554 Reference.reachabilityFence(this);
558 * Checks if this feature is supported.
560 public boolean supports_zero_conf() {
561 boolean ret = bindings.NodeFeatures_supports_zero_conf(this.ptr);
562 Reference.reachabilityFence(this);
567 * Checks if this feature is required.
569 public boolean requires_zero_conf() {
570 boolean ret = bindings.NodeFeatures_requires_zero_conf(this.ptr);
571 Reference.reachabilityFence(this);
576 * Set this feature as optional.
578 public void set_keysend_optional() {
579 bindings.NodeFeatures_set_keysend_optional(this.ptr);
580 Reference.reachabilityFence(this);
584 * Set this feature as required.
586 public void set_keysend_required() {
587 bindings.NodeFeatures_set_keysend_required(this.ptr);
588 Reference.reachabilityFence(this);
592 * Checks if this feature is supported.
594 public boolean supports_keysend() {
595 boolean ret = bindings.NodeFeatures_supports_keysend(this.ptr);
596 Reference.reachabilityFence(this);
601 * Checks if this feature is required.
603 public boolean requires_keysend() {
604 boolean ret = bindings.NodeFeatures_requires_keysend(this.ptr);
605 Reference.reachabilityFence(this);