6 namespace org { namespace ldk { namespace structs {
10 * Features used within a `node_announcement` message.
12 public class NodeFeatures : CommonBase {
13 internal NodeFeatures(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.NodeFeatures_free(ptr); }
19 * Checks if two NodeFeaturess contain equal inner contents.
20 * This ignores pointers and is_owned flags and looks at the values in fields.
21 * Two objects with NULL inner values will be considered "equal" here.
23 public bool eq(org.ldk.structs.NodeFeatures b) {
24 bool ret = bindings.NodeFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
27 if (this != null) { this.ptrs_to.AddLast(b); };
31 public override bool Equals(object o) {
32 if (!(o is NodeFeatures)) return false;
33 return this.eq((NodeFeatures)o);
35 internal long clone_ptr() {
36 long ret = bindings.NodeFeatures_clone_ptr(this.ptr);
42 * Creates a copy of the NodeFeatures
44 public NodeFeatures clone() {
45 long ret = bindings.NodeFeatures_clone(this.ptr);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
54 * Create a blank Features with no features set
56 public static NodeFeatures empty() {
57 long ret = bindings.NodeFeatures_empty();
58 if (ret >= 0 && ret <= 4096) { return null; }
59 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
60 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
65 * Returns true if this `Features` object contains required features unknown by `other`.
67 public bool requires_unknown_bits_from(org.ldk.structs.NodeFeatures other) {
68 bool ret = bindings.NodeFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
71 if (this != null) { this.ptrs_to.AddLast(other); };
76 * Returns true if this `Features` object contains unknown feature flags which are set as
79 public bool requires_unknown_bits() {
80 bool ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
86 * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
89 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
90 * be set instead (i.e., `bit - 1`).
92 * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
94 public Result_NoneNoneZ set_required_feature_bit(long bit) {
95 long ret = bindings.NodeFeatures_set_required_feature_bit(this.ptr, bit);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
104 * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
107 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
108 * set instead (i.e., `bit + 1`).
110 * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
112 public Result_NoneNoneZ set_optional_feature_bit(long bit) {
113 long ret = bindings.NodeFeatures_set_optional_feature_bit(this.ptr, bit);
116 if (ret >= 0 && ret <= 4096) { return null; }
117 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
122 * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
123 * by [bLIP 2] or if it is a known `T` feature.
125 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
126 * be set instead (i.e., `bit - 1`).
128 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
130 public Result_NoneNoneZ set_required_custom_bit(long bit) {
131 long ret = bindings.NodeFeatures_set_required_custom_bit(this.ptr, bit);
134 if (ret >= 0 && ret <= 4096) { return null; }
135 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
140 * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
141 * by [bLIP 2] or if it is a known `T` feature.
143 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
144 * set instead (i.e., `bit + 1`).
146 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
148 public Result_NoneNoneZ set_optional_custom_bit(long bit) {
149 long ret = bindings.NodeFeatures_set_optional_custom_bit(this.ptr, bit);
152 if (ret >= 0 && ret <= 4096) { return null; }
153 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
158 * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
160 public byte[] write() {
161 long ret = bindings.NodeFeatures_write(this.ptr);
163 if (ret >= 0 && ret <= 4096) { return null; }
164 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
169 * Read a NodeFeatures from a byte array, created by NodeFeatures_write
171 public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
172 long ret = bindings.NodeFeatures_read(InternalUtils.encodeUint8Array(ser));
174 if (ret >= 0 && ret <= 4096) { return null; }
175 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
180 * Set this feature as optional.
182 public void set_data_loss_protect_optional() {
183 bindings.NodeFeatures_set_data_loss_protect_optional(this.ptr);
188 * Set this feature as required.
190 public void set_data_loss_protect_required() {
191 bindings.NodeFeatures_set_data_loss_protect_required(this.ptr);
196 * Checks if this feature is supported.
198 public bool supports_data_loss_protect() {
199 bool ret = bindings.NodeFeatures_supports_data_loss_protect(this.ptr);
205 * Checks if this feature is required.
207 public bool requires_data_loss_protect() {
208 bool ret = bindings.NodeFeatures_requires_data_loss_protect(this.ptr);
214 * Set this feature as optional.
216 public void set_upfront_shutdown_script_optional() {
217 bindings.NodeFeatures_set_upfront_shutdown_script_optional(this.ptr);
222 * Set this feature as required.
224 public void set_upfront_shutdown_script_required() {
225 bindings.NodeFeatures_set_upfront_shutdown_script_required(this.ptr);
230 * Checks if this feature is supported.
232 public bool supports_upfront_shutdown_script() {
233 bool ret = bindings.NodeFeatures_supports_upfront_shutdown_script(this.ptr);
239 * Checks if this feature is required.
241 public bool requires_upfront_shutdown_script() {
242 bool ret = bindings.NodeFeatures_requires_upfront_shutdown_script(this.ptr);
248 * Set this feature as optional.
250 public void set_gossip_queries_optional() {
251 bindings.NodeFeatures_set_gossip_queries_optional(this.ptr);
256 * Set this feature as required.
258 public void set_gossip_queries_required() {
259 bindings.NodeFeatures_set_gossip_queries_required(this.ptr);
264 * Checks if this feature is supported.
266 public bool supports_gossip_queries() {
267 bool ret = bindings.NodeFeatures_supports_gossip_queries(this.ptr);
273 * Checks if this feature is required.
275 public bool requires_gossip_queries() {
276 bool ret = bindings.NodeFeatures_requires_gossip_queries(this.ptr);
282 * Set this feature as optional.
284 public void set_variable_length_onion_optional() {
285 bindings.NodeFeatures_set_variable_length_onion_optional(this.ptr);
290 * Set this feature as required.
292 public void set_variable_length_onion_required() {
293 bindings.NodeFeatures_set_variable_length_onion_required(this.ptr);
298 * Checks if this feature is supported.
300 public bool supports_variable_length_onion() {
301 bool ret = bindings.NodeFeatures_supports_variable_length_onion(this.ptr);
307 * Checks if this feature is required.
309 public bool requires_variable_length_onion() {
310 bool ret = bindings.NodeFeatures_requires_variable_length_onion(this.ptr);
316 * Set this feature as optional.
318 public void set_static_remote_key_optional() {
319 bindings.NodeFeatures_set_static_remote_key_optional(this.ptr);
324 * Set this feature as required.
326 public void set_static_remote_key_required() {
327 bindings.NodeFeatures_set_static_remote_key_required(this.ptr);
332 * Checks if this feature is supported.
334 public bool supports_static_remote_key() {
335 bool ret = bindings.NodeFeatures_supports_static_remote_key(this.ptr);
341 * Checks if this feature is required.
343 public bool requires_static_remote_key() {
344 bool ret = bindings.NodeFeatures_requires_static_remote_key(this.ptr);
350 * Set this feature as optional.
352 public void set_payment_secret_optional() {
353 bindings.NodeFeatures_set_payment_secret_optional(this.ptr);
358 * Set this feature as required.
360 public void set_payment_secret_required() {
361 bindings.NodeFeatures_set_payment_secret_required(this.ptr);
366 * Checks if this feature is supported.
368 public bool supports_payment_secret() {
369 bool ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
375 * Checks if this feature is required.
377 public bool requires_payment_secret() {
378 bool ret = bindings.NodeFeatures_requires_payment_secret(this.ptr);
384 * Set this feature as optional.
386 public void set_basic_mpp_optional() {
387 bindings.NodeFeatures_set_basic_mpp_optional(this.ptr);
392 * Set this feature as required.
394 public void set_basic_mpp_required() {
395 bindings.NodeFeatures_set_basic_mpp_required(this.ptr);
400 * Checks if this feature is supported.
402 public bool supports_basic_mpp() {
403 bool ret = bindings.NodeFeatures_supports_basic_mpp(this.ptr);
409 * Checks if this feature is required.
411 public bool requires_basic_mpp() {
412 bool ret = bindings.NodeFeatures_requires_basic_mpp(this.ptr);
418 * Set this feature as optional.
420 public void set_wumbo_optional() {
421 bindings.NodeFeatures_set_wumbo_optional(this.ptr);
426 * Set this feature as required.
428 public void set_wumbo_required() {
429 bindings.NodeFeatures_set_wumbo_required(this.ptr);
434 * Checks if this feature is supported.
436 public bool supports_wumbo() {
437 bool ret = bindings.NodeFeatures_supports_wumbo(this.ptr);
443 * Checks if this feature is required.
445 public bool requires_wumbo() {
446 bool ret = bindings.NodeFeatures_requires_wumbo(this.ptr);
452 * Set this feature as optional.
454 public void set_anchors_nonzero_fee_htlc_tx_optional() {
455 bindings.NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(this.ptr);
460 * Set this feature as required.
462 public void set_anchors_nonzero_fee_htlc_tx_required() {
463 bindings.NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(this.ptr);
468 * Checks if this feature is supported.
470 public bool supports_anchors_nonzero_fee_htlc_tx() {
471 bool ret = bindings.NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(this.ptr);
477 * Checks if this feature is required.
479 public bool requires_anchors_nonzero_fee_htlc_tx() {
480 bool ret = bindings.NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(this.ptr);
486 * Set this feature as optional.
488 public void set_anchors_zero_fee_htlc_tx_optional() {
489 bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
494 * Set this feature as required.
496 public void set_anchors_zero_fee_htlc_tx_required() {
497 bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
502 * Checks if this feature is supported.
504 public bool supports_anchors_zero_fee_htlc_tx() {
505 bool ret = bindings.NodeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
511 * Checks if this feature is required.
513 public bool requires_anchors_zero_fee_htlc_tx() {
514 bool ret = bindings.NodeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
520 * Set this feature as optional.
522 public void set_shutdown_any_segwit_optional() {
523 bindings.NodeFeatures_set_shutdown_any_segwit_optional(this.ptr);
528 * Set this feature as required.
530 public void set_shutdown_any_segwit_required() {
531 bindings.NodeFeatures_set_shutdown_any_segwit_required(this.ptr);
536 * Checks if this feature is supported.
538 public bool supports_shutdown_anysegwit() {
539 bool ret = bindings.NodeFeatures_supports_shutdown_anysegwit(this.ptr);
545 * Checks if this feature is required.
547 public bool requires_shutdown_anysegwit() {
548 bool ret = bindings.NodeFeatures_requires_shutdown_anysegwit(this.ptr);
554 * Set this feature as optional.
556 public void set_taproot_optional() {
557 bindings.NodeFeatures_set_taproot_optional(this.ptr);
562 * Set this feature as required.
564 public void set_taproot_required() {
565 bindings.NodeFeatures_set_taproot_required(this.ptr);
570 * Checks if this feature is supported.
572 public bool supports_taproot() {
573 bool ret = bindings.NodeFeatures_supports_taproot(this.ptr);
579 * Checks if this feature is required.
581 public bool requires_taproot() {
582 bool ret = bindings.NodeFeatures_requires_taproot(this.ptr);
588 * Set this feature as optional.
590 public void set_onion_messages_optional() {
591 bindings.NodeFeatures_set_onion_messages_optional(this.ptr);
596 * Set this feature as required.
598 public void set_onion_messages_required() {
599 bindings.NodeFeatures_set_onion_messages_required(this.ptr);
604 * Checks if this feature is supported.
606 public bool supports_onion_messages() {
607 bool ret = bindings.NodeFeatures_supports_onion_messages(this.ptr);
613 * Checks if this feature is required.
615 public bool requires_onion_messages() {
616 bool ret = bindings.NodeFeatures_requires_onion_messages(this.ptr);
622 * Set this feature as optional.
624 public void set_channel_type_optional() {
625 bindings.NodeFeatures_set_channel_type_optional(this.ptr);
630 * Set this feature as required.
632 public void set_channel_type_required() {
633 bindings.NodeFeatures_set_channel_type_required(this.ptr);
638 * Checks if this feature is supported.
640 public bool supports_channel_type() {
641 bool ret = bindings.NodeFeatures_supports_channel_type(this.ptr);
647 * Checks if this feature is required.
649 public bool requires_channel_type() {
650 bool ret = bindings.NodeFeatures_requires_channel_type(this.ptr);
656 * Set this feature as optional.
658 public void set_scid_privacy_optional() {
659 bindings.NodeFeatures_set_scid_privacy_optional(this.ptr);
664 * Set this feature as required.
666 public void set_scid_privacy_required() {
667 bindings.NodeFeatures_set_scid_privacy_required(this.ptr);
672 * Checks if this feature is supported.
674 public bool supports_scid_privacy() {
675 bool ret = bindings.NodeFeatures_supports_scid_privacy(this.ptr);
681 * Checks if this feature is required.
683 public bool requires_scid_privacy() {
684 bool ret = bindings.NodeFeatures_requires_scid_privacy(this.ptr);
690 * Set this feature as optional.
692 public void set_zero_conf_optional() {
693 bindings.NodeFeatures_set_zero_conf_optional(this.ptr);
698 * Set this feature as required.
700 public void set_zero_conf_required() {
701 bindings.NodeFeatures_set_zero_conf_required(this.ptr);
706 * Checks if this feature is supported.
708 public bool supports_zero_conf() {
709 bool ret = bindings.NodeFeatures_supports_zero_conf(this.ptr);
715 * Checks if this feature is required.
717 public bool requires_zero_conf() {
718 bool ret = bindings.NodeFeatures_requires_zero_conf(this.ptr);
724 * Set this feature as optional.
726 public void set_keysend_optional() {
727 bindings.NodeFeatures_set_keysend_optional(this.ptr);
732 * Set this feature as required.
734 public void set_keysend_required() {
735 bindings.NodeFeatures_set_keysend_required(this.ptr);
740 * Checks if this feature is supported.
742 public bool supports_keysend() {
743 bool ret = bindings.NodeFeatures_supports_keysend(this.ptr);
749 * Checks if this feature is required.
751 public bool requires_keysend() {
752 bool ret = bindings.NodeFeatures_requires_keysend(this.ptr);