6 namespace org { namespace ldk { namespace structs {
10 * Features used within an `init` message.
12 public class InitFeatures : CommonBase {
13 internal InitFeatures(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.InitFeatures_free(ptr); }
19 * Checks if two InitFeaturess 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.InitFeatures b) {
24 bool ret = bindings.InitFeatures_eq(this.ptr, b.ptr);
27 if (this != null) { this.ptrs_to.AddLast(b); };
31 public override bool Equals(object o) {
32 if (!(o is InitFeatures)) return false;
33 return this.eq((InitFeatures)o);
35 internal long clone_ptr() {
36 long ret = bindings.InitFeatures_clone_ptr(this.ptr);
42 * Creates a copy of the InitFeatures
44 public InitFeatures clone() {
45 long ret = bindings.InitFeatures_clone(this.ptr);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(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 InitFeatures.
57 long ret = bindings.InitFeatures_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 InitFeatures empty() {
69 long ret = bindings.InitFeatures_empty();
70 if (ret >= 0 && ret <= 4096) { return null; }
71 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(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.InitFeatures other) {
80 bool ret = bindings.InitFeatures_requires_unknown_bits_from(this.ptr, 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.InitFeatures_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.InitFeatures_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.InitFeatures_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.InitFeatures_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.InitFeatures_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 InitFeatures object into a byte array which can be read by InitFeatures_read
172 public byte[] write() {
173 long ret = bindings.InitFeatures_write(this.ptr);
175 if (ret >= 0 && ret <= 4096) { return null; }
176 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
181 * Read a InitFeatures from a byte array, created by InitFeatures_write
183 public static Result_InitFeaturesDecodeErrorZ read(byte[] ser) {
184 long ret = bindings.InitFeatures_read(InternalUtils.encodeUint8Array(ser));
186 if (ret >= 0 && ret <= 4096) { return null; }
187 Result_InitFeaturesDecodeErrorZ ret_hu_conv = Result_InitFeaturesDecodeErrorZ.constr_from_ptr(ret);
192 * Set this feature as optional.
194 public void set_data_loss_protect_optional() {
195 bindings.InitFeatures_set_data_loss_protect_optional(this.ptr);
200 * Set this feature as required.
202 public void set_data_loss_protect_required() {
203 bindings.InitFeatures_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.InitFeatures_supports_data_loss_protect(this.ptr);
217 * Checks if this feature is required.
219 public bool requires_data_loss_protect() {
220 bool ret = bindings.InitFeatures_requires_data_loss_protect(this.ptr);
226 * Set this feature as optional.
228 public void set_initial_routing_sync_optional() {
229 bindings.InitFeatures_set_initial_routing_sync_optional(this.ptr);
234 * Set this feature as required.
236 public void set_initial_routing_sync_required() {
237 bindings.InitFeatures_set_initial_routing_sync_required(this.ptr);
242 * Checks if this feature is supported.
244 public bool initial_routing_sync() {
245 bool ret = bindings.InitFeatures_initial_routing_sync(this.ptr);
251 * Set this feature as optional.
253 public void set_upfront_shutdown_script_optional() {
254 bindings.InitFeatures_set_upfront_shutdown_script_optional(this.ptr);
259 * Set this feature as required.
261 public void set_upfront_shutdown_script_required() {
262 bindings.InitFeatures_set_upfront_shutdown_script_required(this.ptr);
267 * Checks if this feature is supported.
269 public bool supports_upfront_shutdown_script() {
270 bool ret = bindings.InitFeatures_supports_upfront_shutdown_script(this.ptr);
276 * Checks if this feature is required.
278 public bool requires_upfront_shutdown_script() {
279 bool ret = bindings.InitFeatures_requires_upfront_shutdown_script(this.ptr);
285 * Set this feature as optional.
287 public void set_gossip_queries_optional() {
288 bindings.InitFeatures_set_gossip_queries_optional(this.ptr);
293 * Set this feature as required.
295 public void set_gossip_queries_required() {
296 bindings.InitFeatures_set_gossip_queries_required(this.ptr);
301 * Checks if this feature is supported.
303 public bool supports_gossip_queries() {
304 bool ret = bindings.InitFeatures_supports_gossip_queries(this.ptr);
310 * Checks if this feature is required.
312 public bool requires_gossip_queries() {
313 bool ret = bindings.InitFeatures_requires_gossip_queries(this.ptr);
319 * Set this feature as optional.
321 public void set_variable_length_onion_optional() {
322 bindings.InitFeatures_set_variable_length_onion_optional(this.ptr);
327 * Set this feature as required.
329 public void set_variable_length_onion_required() {
330 bindings.InitFeatures_set_variable_length_onion_required(this.ptr);
335 * Checks if this feature is supported.
337 public bool supports_variable_length_onion() {
338 bool ret = bindings.InitFeatures_supports_variable_length_onion(this.ptr);
344 * Checks if this feature is required.
346 public bool requires_variable_length_onion() {
347 bool ret = bindings.InitFeatures_requires_variable_length_onion(this.ptr);
353 * Set this feature as optional.
355 public void set_static_remote_key_optional() {
356 bindings.InitFeatures_set_static_remote_key_optional(this.ptr);
361 * Set this feature as required.
363 public void set_static_remote_key_required() {
364 bindings.InitFeatures_set_static_remote_key_required(this.ptr);
369 * Checks if this feature is supported.
371 public bool supports_static_remote_key() {
372 bool ret = bindings.InitFeatures_supports_static_remote_key(this.ptr);
378 * Checks if this feature is required.
380 public bool requires_static_remote_key() {
381 bool ret = bindings.InitFeatures_requires_static_remote_key(this.ptr);
387 * Set this feature as optional.
389 public void set_payment_secret_optional() {
390 bindings.InitFeatures_set_payment_secret_optional(this.ptr);
395 * Set this feature as required.
397 public void set_payment_secret_required() {
398 bindings.InitFeatures_set_payment_secret_required(this.ptr);
403 * Checks if this feature is supported.
405 public bool supports_payment_secret() {
406 bool ret = bindings.InitFeatures_supports_payment_secret(this.ptr);
412 * Checks if this feature is required.
414 public bool requires_payment_secret() {
415 bool ret = bindings.InitFeatures_requires_payment_secret(this.ptr);
421 * Set this feature as optional.
423 public void set_basic_mpp_optional() {
424 bindings.InitFeatures_set_basic_mpp_optional(this.ptr);
429 * Set this feature as required.
431 public void set_basic_mpp_required() {
432 bindings.InitFeatures_set_basic_mpp_required(this.ptr);
437 * Checks if this feature is supported.
439 public bool supports_basic_mpp() {
440 bool ret = bindings.InitFeatures_supports_basic_mpp(this.ptr);
446 * Checks if this feature is required.
448 public bool requires_basic_mpp() {
449 bool ret = bindings.InitFeatures_requires_basic_mpp(this.ptr);
455 * Set this feature as optional.
457 public void set_wumbo_optional() {
458 bindings.InitFeatures_set_wumbo_optional(this.ptr);
463 * Set this feature as required.
465 public void set_wumbo_required() {
466 bindings.InitFeatures_set_wumbo_required(this.ptr);
471 * Checks if this feature is supported.
473 public bool supports_wumbo() {
474 bool ret = bindings.InitFeatures_supports_wumbo(this.ptr);
480 * Checks if this feature is required.
482 public bool requires_wumbo() {
483 bool ret = bindings.InitFeatures_requires_wumbo(this.ptr);
489 * Set this feature as optional.
491 public void set_anchors_nonzero_fee_htlc_tx_optional() {
492 bindings.InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(this.ptr);
497 * Set this feature as required.
499 public void set_anchors_nonzero_fee_htlc_tx_required() {
500 bindings.InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(this.ptr);
505 * Checks if this feature is supported.
507 public bool supports_anchors_nonzero_fee_htlc_tx() {
508 bool ret = bindings.InitFeatures_supports_anchors_nonzero_fee_htlc_tx(this.ptr);
514 * Checks if this feature is required.
516 public bool requires_anchors_nonzero_fee_htlc_tx() {
517 bool ret = bindings.InitFeatures_requires_anchors_nonzero_fee_htlc_tx(this.ptr);
523 * Set this feature as optional.
525 public void set_anchors_zero_fee_htlc_tx_optional() {
526 bindings.InitFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
531 * Set this feature as required.
533 public void set_anchors_zero_fee_htlc_tx_required() {
534 bindings.InitFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
539 * Checks if this feature is supported.
541 public bool supports_anchors_zero_fee_htlc_tx() {
542 bool ret = bindings.InitFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
548 * Checks if this feature is required.
550 public bool requires_anchors_zero_fee_htlc_tx() {
551 bool ret = bindings.InitFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
557 * Set this feature as optional.
559 public void set_route_blinding_optional() {
560 bindings.InitFeatures_set_route_blinding_optional(this.ptr);
565 * Set this feature as required.
567 public void set_route_blinding_required() {
568 bindings.InitFeatures_set_route_blinding_required(this.ptr);
573 * Checks if this feature is supported.
575 public bool supports_route_blinding() {
576 bool ret = bindings.InitFeatures_supports_route_blinding(this.ptr);
582 * Checks if this feature is required.
584 public bool requires_route_blinding() {
585 bool ret = bindings.InitFeatures_requires_route_blinding(this.ptr);
591 * Set this feature as optional.
593 public void set_shutdown_any_segwit_optional() {
594 bindings.InitFeatures_set_shutdown_any_segwit_optional(this.ptr);
599 * Set this feature as required.
601 public void set_shutdown_any_segwit_required() {
602 bindings.InitFeatures_set_shutdown_any_segwit_required(this.ptr);
607 * Checks if this feature is supported.
609 public bool supports_shutdown_anysegwit() {
610 bool ret = bindings.InitFeatures_supports_shutdown_anysegwit(this.ptr);
616 * Checks if this feature is required.
618 public bool requires_shutdown_anysegwit() {
619 bool ret = bindings.InitFeatures_requires_shutdown_anysegwit(this.ptr);
625 * Set this feature as optional.
627 public void set_taproot_optional() {
628 bindings.InitFeatures_set_taproot_optional(this.ptr);
633 * Set this feature as required.
635 public void set_taproot_required() {
636 bindings.InitFeatures_set_taproot_required(this.ptr);
641 * Checks if this feature is supported.
643 public bool supports_taproot() {
644 bool ret = bindings.InitFeatures_supports_taproot(this.ptr);
650 * Checks if this feature is required.
652 public bool requires_taproot() {
653 bool ret = bindings.InitFeatures_requires_taproot(this.ptr);
659 * Set this feature as optional.
661 public void set_onion_messages_optional() {
662 bindings.InitFeatures_set_onion_messages_optional(this.ptr);
667 * Set this feature as required.
669 public void set_onion_messages_required() {
670 bindings.InitFeatures_set_onion_messages_required(this.ptr);
675 * Checks if this feature is supported.
677 public bool supports_onion_messages() {
678 bool ret = bindings.InitFeatures_supports_onion_messages(this.ptr);
684 * Checks if this feature is required.
686 public bool requires_onion_messages() {
687 bool ret = bindings.InitFeatures_requires_onion_messages(this.ptr);
693 * Set this feature as optional.
695 public void set_channel_type_optional() {
696 bindings.InitFeatures_set_channel_type_optional(this.ptr);
701 * Set this feature as required.
703 public void set_channel_type_required() {
704 bindings.InitFeatures_set_channel_type_required(this.ptr);
709 * Checks if this feature is supported.
711 public bool supports_channel_type() {
712 bool ret = bindings.InitFeatures_supports_channel_type(this.ptr);
718 * Checks if this feature is required.
720 public bool requires_channel_type() {
721 bool ret = bindings.InitFeatures_requires_channel_type(this.ptr);
727 * Set this feature as optional.
729 public void set_scid_privacy_optional() {
730 bindings.InitFeatures_set_scid_privacy_optional(this.ptr);
735 * Set this feature as required.
737 public void set_scid_privacy_required() {
738 bindings.InitFeatures_set_scid_privacy_required(this.ptr);
743 * Checks if this feature is supported.
745 public bool supports_scid_privacy() {
746 bool ret = bindings.InitFeatures_supports_scid_privacy(this.ptr);
752 * Checks if this feature is required.
754 public bool requires_scid_privacy() {
755 bool ret = bindings.InitFeatures_requires_scid_privacy(this.ptr);
761 * Set this feature as optional.
763 public void set_zero_conf_optional() {
764 bindings.InitFeatures_set_zero_conf_optional(this.ptr);
769 * Set this feature as required.
771 public void set_zero_conf_required() {
772 bindings.InitFeatures_set_zero_conf_required(this.ptr);
777 * Checks if this feature is supported.
779 public bool supports_zero_conf() {
780 bool ret = bindings.InitFeatures_supports_zero_conf(this.ptr);
786 * Checks if this feature is required.
788 public bool requires_zero_conf() {
789 bool ret = bindings.InitFeatures_requires_zero_conf(this.ptr);
795 * Set this feature as optional.
797 public void set_trampoline_routing_optional() {
798 bindings.InitFeatures_set_trampoline_routing_optional(this.ptr);
803 * Set this feature as required.
805 public void set_trampoline_routing_required() {
806 bindings.InitFeatures_set_trampoline_routing_required(this.ptr);
811 * Checks if this feature is supported.
813 public bool supports_trampoline_routing() {
814 bool ret = bindings.InitFeatures_supports_trampoline_routing(this.ptr);
820 * Checks if this feature is required.
822 public bool requires_trampoline_routing() {
823 bool ret = bindings.InitFeatures_requires_trampoline_routing(this.ptr);