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 * Generates a non-cryptographic 64-bit hash of the NodeFeatures.
57 long ret = bindings.NodeFeatures_hash(this.ptr);
62 public override int GetHashCode() {
63 return (int)this.hash();
66 * Create a blank Features with no features set
68 public static NodeFeatures empty() {
69 long ret = bindings.NodeFeatures_empty();
70 if (ret >= 0 && ret <= 4096) { return null; }
71 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
72 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
77 * Returns true if this `Features` object contains required features unknown by `other`.
79 public bool requires_unknown_bits_from(org.ldk.structs.NodeFeatures other) {
80 bool ret = bindings.NodeFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
83 if (this != null) { this.ptrs_to.AddLast(other); };
88 * Returns true if this `Features` object contains unknown feature flags which are set as
91 public bool requires_unknown_bits() {
92 bool ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
98 * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
101 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
102 * be set instead (i.e., `bit - 1`).
104 * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
106 public Result_NoneNoneZ set_required_feature_bit(long bit) {
107 long ret = bindings.NodeFeatures_set_required_feature_bit(this.ptr, bit);
110 if (ret >= 0 && ret <= 4096) { return null; }
111 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
116 * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
119 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
120 * set instead (i.e., `bit + 1`).
122 * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
124 public Result_NoneNoneZ set_optional_feature_bit(long bit) {
125 long ret = bindings.NodeFeatures_set_optional_feature_bit(this.ptr, bit);
128 if (ret >= 0 && ret <= 4096) { return null; }
129 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
134 * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
135 * by [bLIP 2] or if it is a known `T` feature.
137 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
138 * be set instead (i.e., `bit - 1`).
140 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
142 public Result_NoneNoneZ set_required_custom_bit(long bit) {
143 long ret = bindings.NodeFeatures_set_required_custom_bit(this.ptr, bit);
146 if (ret >= 0 && ret <= 4096) { return null; }
147 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
152 * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
153 * by [bLIP 2] or if it is a known `T` feature.
155 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
156 * set instead (i.e., `bit + 1`).
158 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
160 public Result_NoneNoneZ set_optional_custom_bit(long bit) {
161 long ret = bindings.NodeFeatures_set_optional_custom_bit(this.ptr, bit);
164 if (ret >= 0 && ret <= 4096) { return null; }
165 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
170 * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
172 public byte[] write() {
173 long ret = bindings.NodeFeatures_write(this.ptr);
175 if (ret >= 0 && ret <= 4096) { return null; }
176 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
181 * Read a NodeFeatures from a byte array, created by NodeFeatures_write
183 public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
184 long ret = bindings.NodeFeatures_read(InternalUtils.encodeUint8Array(ser));
186 if (ret >= 0 && ret <= 4096) { return null; }
187 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
192 * Set this feature as optional.
194 public void set_data_loss_protect_optional() {
195 bindings.NodeFeatures_set_data_loss_protect_optional(this.ptr);
200 * Set this feature as required.
202 public void set_data_loss_protect_required() {
203 bindings.NodeFeatures_set_data_loss_protect_required(this.ptr);
208 * Checks if this feature is supported.
210 public bool supports_data_loss_protect() {
211 bool ret = bindings.NodeFeatures_supports_data_loss_protect(this.ptr);
217 * Checks if this feature is required.
219 public bool requires_data_loss_protect() {
220 bool ret = bindings.NodeFeatures_requires_data_loss_protect(this.ptr);
226 * Set this feature as optional.
228 public void set_upfront_shutdown_script_optional() {
229 bindings.NodeFeatures_set_upfront_shutdown_script_optional(this.ptr);
234 * Set this feature as required.
236 public void set_upfront_shutdown_script_required() {
237 bindings.NodeFeatures_set_upfront_shutdown_script_required(this.ptr);
242 * Checks if this feature is supported.
244 public bool supports_upfront_shutdown_script() {
245 bool ret = bindings.NodeFeatures_supports_upfront_shutdown_script(this.ptr);
251 * Checks if this feature is required.
253 public bool requires_upfront_shutdown_script() {
254 bool ret = bindings.NodeFeatures_requires_upfront_shutdown_script(this.ptr);
260 * Set this feature as optional.
262 public void set_gossip_queries_optional() {
263 bindings.NodeFeatures_set_gossip_queries_optional(this.ptr);
268 * Set this feature as required.
270 public void set_gossip_queries_required() {
271 bindings.NodeFeatures_set_gossip_queries_required(this.ptr);
276 * Checks if this feature is supported.
278 public bool supports_gossip_queries() {
279 bool ret = bindings.NodeFeatures_supports_gossip_queries(this.ptr);
285 * Checks if this feature is required.
287 public bool requires_gossip_queries() {
288 bool ret = bindings.NodeFeatures_requires_gossip_queries(this.ptr);
294 * Set this feature as optional.
296 public void set_variable_length_onion_optional() {
297 bindings.NodeFeatures_set_variable_length_onion_optional(this.ptr);
302 * Set this feature as required.
304 public void set_variable_length_onion_required() {
305 bindings.NodeFeatures_set_variable_length_onion_required(this.ptr);
310 * Checks if this feature is supported.
312 public bool supports_variable_length_onion() {
313 bool ret = bindings.NodeFeatures_supports_variable_length_onion(this.ptr);
319 * Checks if this feature is required.
321 public bool requires_variable_length_onion() {
322 bool ret = bindings.NodeFeatures_requires_variable_length_onion(this.ptr);
328 * Set this feature as optional.
330 public void set_static_remote_key_optional() {
331 bindings.NodeFeatures_set_static_remote_key_optional(this.ptr);
336 * Set this feature as required.
338 public void set_static_remote_key_required() {
339 bindings.NodeFeatures_set_static_remote_key_required(this.ptr);
344 * Checks if this feature is supported.
346 public bool supports_static_remote_key() {
347 bool ret = bindings.NodeFeatures_supports_static_remote_key(this.ptr);
353 * Checks if this feature is required.
355 public bool requires_static_remote_key() {
356 bool ret = bindings.NodeFeatures_requires_static_remote_key(this.ptr);
362 * Set this feature as optional.
364 public void set_payment_secret_optional() {
365 bindings.NodeFeatures_set_payment_secret_optional(this.ptr);
370 * Set this feature as required.
372 public void set_payment_secret_required() {
373 bindings.NodeFeatures_set_payment_secret_required(this.ptr);
378 * Checks if this feature is supported.
380 public bool supports_payment_secret() {
381 bool ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
387 * Checks if this feature is required.
389 public bool requires_payment_secret() {
390 bool ret = bindings.NodeFeatures_requires_payment_secret(this.ptr);
396 * Set this feature as optional.
398 public void set_basic_mpp_optional() {
399 bindings.NodeFeatures_set_basic_mpp_optional(this.ptr);
404 * Set this feature as required.
406 public void set_basic_mpp_required() {
407 bindings.NodeFeatures_set_basic_mpp_required(this.ptr);
412 * Checks if this feature is supported.
414 public bool supports_basic_mpp() {
415 bool ret = bindings.NodeFeatures_supports_basic_mpp(this.ptr);
421 * Checks if this feature is required.
423 public bool requires_basic_mpp() {
424 bool ret = bindings.NodeFeatures_requires_basic_mpp(this.ptr);
430 * Set this feature as optional.
432 public void set_wumbo_optional() {
433 bindings.NodeFeatures_set_wumbo_optional(this.ptr);
438 * Set this feature as required.
440 public void set_wumbo_required() {
441 bindings.NodeFeatures_set_wumbo_required(this.ptr);
446 * Checks if this feature is supported.
448 public bool supports_wumbo() {
449 bool ret = bindings.NodeFeatures_supports_wumbo(this.ptr);
455 * Checks if this feature is required.
457 public bool requires_wumbo() {
458 bool ret = bindings.NodeFeatures_requires_wumbo(this.ptr);
464 * Set this feature as optional.
466 public void set_anchors_nonzero_fee_htlc_tx_optional() {
467 bindings.NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(this.ptr);
472 * Set this feature as required.
474 public void set_anchors_nonzero_fee_htlc_tx_required() {
475 bindings.NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(this.ptr);
480 * Checks if this feature is supported.
482 public bool supports_anchors_nonzero_fee_htlc_tx() {
483 bool ret = bindings.NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(this.ptr);
489 * Checks if this feature is required.
491 public bool requires_anchors_nonzero_fee_htlc_tx() {
492 bool ret = bindings.NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(this.ptr);
498 * Set this feature as optional.
500 public void set_anchors_zero_fee_htlc_tx_optional() {
501 bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
506 * Set this feature as required.
508 public void set_anchors_zero_fee_htlc_tx_required() {
509 bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
514 * Checks if this feature is supported.
516 public bool supports_anchors_zero_fee_htlc_tx() {
517 bool ret = bindings.NodeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
523 * Checks if this feature is required.
525 public bool requires_anchors_zero_fee_htlc_tx() {
526 bool ret = bindings.NodeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
532 * Set this feature as optional.
534 public void set_route_blinding_optional() {
535 bindings.NodeFeatures_set_route_blinding_optional(this.ptr);
540 * Set this feature as required.
542 public void set_route_blinding_required() {
543 bindings.NodeFeatures_set_route_blinding_required(this.ptr);
548 * Checks if this feature is supported.
550 public bool supports_route_blinding() {
551 bool ret = bindings.NodeFeatures_supports_route_blinding(this.ptr);
557 * Checks if this feature is required.
559 public bool requires_route_blinding() {
560 bool ret = bindings.NodeFeatures_requires_route_blinding(this.ptr);
566 * Set this feature as optional.
568 public void set_shutdown_any_segwit_optional() {
569 bindings.NodeFeatures_set_shutdown_any_segwit_optional(this.ptr);
574 * Set this feature as required.
576 public void set_shutdown_any_segwit_required() {
577 bindings.NodeFeatures_set_shutdown_any_segwit_required(this.ptr);
582 * Checks if this feature is supported.
584 public bool supports_shutdown_anysegwit() {
585 bool ret = bindings.NodeFeatures_supports_shutdown_anysegwit(this.ptr);
591 * Checks if this feature is required.
593 public bool requires_shutdown_anysegwit() {
594 bool ret = bindings.NodeFeatures_requires_shutdown_anysegwit(this.ptr);
600 * Set this feature as optional.
602 public void set_taproot_optional() {
603 bindings.NodeFeatures_set_taproot_optional(this.ptr);
608 * Set this feature as required.
610 public void set_taproot_required() {
611 bindings.NodeFeatures_set_taproot_required(this.ptr);
616 * Checks if this feature is supported.
618 public bool supports_taproot() {
619 bool ret = bindings.NodeFeatures_supports_taproot(this.ptr);
625 * Checks if this feature is required.
627 public bool requires_taproot() {
628 bool ret = bindings.NodeFeatures_requires_taproot(this.ptr);
634 * Set this feature as optional.
636 public void set_onion_messages_optional() {
637 bindings.NodeFeatures_set_onion_messages_optional(this.ptr);
642 * Set this feature as required.
644 public void set_onion_messages_required() {
645 bindings.NodeFeatures_set_onion_messages_required(this.ptr);
650 * Checks if this feature is supported.
652 public bool supports_onion_messages() {
653 bool ret = bindings.NodeFeatures_supports_onion_messages(this.ptr);
659 * Checks if this feature is required.
661 public bool requires_onion_messages() {
662 bool ret = bindings.NodeFeatures_requires_onion_messages(this.ptr);
668 * Set this feature as optional.
670 public void set_channel_type_optional() {
671 bindings.NodeFeatures_set_channel_type_optional(this.ptr);
676 * Set this feature as required.
678 public void set_channel_type_required() {
679 bindings.NodeFeatures_set_channel_type_required(this.ptr);
684 * Checks if this feature is supported.
686 public bool supports_channel_type() {
687 bool ret = bindings.NodeFeatures_supports_channel_type(this.ptr);
693 * Checks if this feature is required.
695 public bool requires_channel_type() {
696 bool ret = bindings.NodeFeatures_requires_channel_type(this.ptr);
702 * Set this feature as optional.
704 public void set_scid_privacy_optional() {
705 bindings.NodeFeatures_set_scid_privacy_optional(this.ptr);
710 * Set this feature as required.
712 public void set_scid_privacy_required() {
713 bindings.NodeFeatures_set_scid_privacy_required(this.ptr);
718 * Checks if this feature is supported.
720 public bool supports_scid_privacy() {
721 bool ret = bindings.NodeFeatures_supports_scid_privacy(this.ptr);
727 * Checks if this feature is required.
729 public bool requires_scid_privacy() {
730 bool ret = bindings.NodeFeatures_requires_scid_privacy(this.ptr);
736 * Set this feature as optional.
738 public void set_zero_conf_optional() {
739 bindings.NodeFeatures_set_zero_conf_optional(this.ptr);
744 * Set this feature as required.
746 public void set_zero_conf_required() {
747 bindings.NodeFeatures_set_zero_conf_required(this.ptr);
752 * Checks if this feature is supported.
754 public bool supports_zero_conf() {
755 bool ret = bindings.NodeFeatures_supports_zero_conf(this.ptr);
761 * Checks if this feature is required.
763 public bool requires_zero_conf() {
764 bool ret = bindings.NodeFeatures_requires_zero_conf(this.ptr);
770 * Set this feature as optional.
772 public void set_keysend_optional() {
773 bindings.NodeFeatures_set_keysend_optional(this.ptr);
778 * Set this feature as required.
780 public void set_keysend_required() {
781 bindings.NodeFeatures_set_keysend_required(this.ptr);
786 * Checks if this feature is supported.
788 public bool supports_keysend() {
789 bool ret = bindings.NodeFeatures_supports_keysend(this.ptr);
795 * Checks if this feature is required.
797 public bool requires_keysend() {
798 bool ret = bindings.NodeFeatures_requires_keysend(this.ptr);