6 namespace org { namespace ldk { namespace structs {
10 * Features used within the channel_type field in an OpenChannel message.
12 * A channel is always of some known \"type\", describing the transaction formats used and the exact
13 * semantics of our interaction with our peer.
15 * Note that because a channel is a specific type which is proposed by the opener and accepted by
16 * the counterparty, only required features are allowed here.
18 * This is serialized differently from other feature types - it is not prefixed by a length, and
19 * thus must only appear inside a TLV where its length is known in advance.
21 public class ChannelTypeFeatures : CommonBase {
22 internal ChannelTypeFeatures(object _dummy, long ptr) : base(ptr) { }
23 ~ChannelTypeFeatures() {
24 if (ptr != 0) { bindings.ChannelTypeFeatures_free(ptr); }
28 * Checks if two ChannelTypeFeaturess contain equal inner contents.
29 * This ignores pointers and is_owned flags and looks at the values in fields.
30 * Two objects with NULL inner values will be considered "equal" here.
32 public bool eq(org.ldk.structs.ChannelTypeFeatures b) {
33 bool ret = bindings.ChannelTypeFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
36 if (this != null) { this.ptrs_to.AddLast(b); };
40 public override bool Equals(object o) {
41 if (!(o is ChannelTypeFeatures)) return false;
42 return this.eq((ChannelTypeFeatures)o);
44 internal long clone_ptr() {
45 long ret = bindings.ChannelTypeFeatures_clone_ptr(this.ptr);
51 * Creates a copy of the ChannelTypeFeatures
53 public ChannelTypeFeatures clone() {
54 long ret = bindings.ChannelTypeFeatures_clone(this.ptr);
56 if (ret >= 0 && ret <= 4096) { return null; }
57 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
58 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
63 * Create a blank Features with no features set
65 public static ChannelTypeFeatures empty() {
66 long ret = bindings.ChannelTypeFeatures_empty();
67 if (ret >= 0 && ret <= 4096) { return null; }
68 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
74 * Returns true if this `Features` object contains required features unknown by `other`.
76 public bool requires_unknown_bits_from(org.ldk.structs.ChannelTypeFeatures other) {
77 bool ret = bindings.ChannelTypeFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
80 if (this != null) { this.ptrs_to.AddLast(other); };
85 * Returns true if this `Features` object contains unknown feature flags which are set as
88 public bool requires_unknown_bits() {
89 bool ret = bindings.ChannelTypeFeatures_requires_unknown_bits(this.ptr);
95 * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
96 * by [bLIP 2] or if it is a known `T` feature.
98 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
99 * be set instead (i.e., `bit - 1`).
101 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
103 public Result_NoneNoneZ set_required_custom_bit(long bit) {
104 long ret = bindings.ChannelTypeFeatures_set_required_custom_bit(this.ptr, bit);
107 if (ret >= 0 && ret <= 4096) { return null; }
108 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
113 * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
114 * by [bLIP 2] or if it is a known `T` feature.
116 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
117 * set instead (i.e., `bit + 1`).
119 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
121 public Result_NoneNoneZ set_optional_custom_bit(long bit) {
122 long ret = bindings.ChannelTypeFeatures_set_optional_custom_bit(this.ptr, bit);
125 if (ret >= 0 && ret <= 4096) { return null; }
126 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
131 * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
133 public byte[] write() {
134 byte[] ret = bindings.ChannelTypeFeatures_write(this.ptr);
140 * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
142 public static Result_ChannelTypeFeaturesDecodeErrorZ read(byte[] ser) {
143 long ret = bindings.ChannelTypeFeatures_read(ser);
145 if (ret >= 0 && ret <= 4096) { return null; }
146 Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret);
151 * Set this feature as optional.
153 public void set_static_remote_key_optional() {
154 bindings.ChannelTypeFeatures_set_static_remote_key_optional(this.ptr);
159 * Set this feature as required.
161 public void set_static_remote_key_required() {
162 bindings.ChannelTypeFeatures_set_static_remote_key_required(this.ptr);
167 * Checks if this feature is supported.
169 public bool supports_static_remote_key() {
170 bool ret = bindings.ChannelTypeFeatures_supports_static_remote_key(this.ptr);
176 * Checks if this feature is required.
178 public bool requires_static_remote_key() {
179 bool ret = bindings.ChannelTypeFeatures_requires_static_remote_key(this.ptr);
185 * Set this feature as optional.
187 public void set_anchors_nonzero_fee_htlc_tx_optional() {
188 bindings.ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(this.ptr);
193 * Set this feature as required.
195 public void set_anchors_nonzero_fee_htlc_tx_required() {
196 bindings.ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(this.ptr);
201 * Checks if this feature is supported.
203 public bool supports_anchors_nonzero_fee_htlc_tx() {
204 bool ret = bindings.ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(this.ptr);
210 * Checks if this feature is required.
212 public bool requires_anchors_nonzero_fee_htlc_tx() {
213 bool ret = bindings.ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(this.ptr);
219 * Set this feature as optional.
221 public void set_anchors_zero_fee_htlc_tx_optional() {
222 bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
227 * Set this feature as required.
229 public void set_anchors_zero_fee_htlc_tx_required() {
230 bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
235 * Checks if this feature is supported.
237 public bool supports_anchors_zero_fee_htlc_tx() {
238 bool ret = bindings.ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
244 * Checks if this feature is required.
246 public bool requires_anchors_zero_fee_htlc_tx() {
247 bool ret = bindings.ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
253 * Set this feature as optional.
255 public void set_scid_privacy_optional() {
256 bindings.ChannelTypeFeatures_set_scid_privacy_optional(this.ptr);
261 * Set this feature as required.
263 public void set_scid_privacy_required() {
264 bindings.ChannelTypeFeatures_set_scid_privacy_required(this.ptr);
269 * Checks if this feature is supported.
271 public bool supports_scid_privacy() {
272 bool ret = bindings.ChannelTypeFeatures_supports_scid_privacy(this.ptr);
278 * Checks if this feature is required.
280 public bool requires_scid_privacy() {
281 bool ret = bindings.ChannelTypeFeatures_requires_scid_privacy(this.ptr);
287 * Set this feature as optional.
289 public void set_zero_conf_optional() {
290 bindings.ChannelTypeFeatures_set_zero_conf_optional(this.ptr);
295 * Set this feature as required.
297 public void set_zero_conf_required() {
298 bindings.ChannelTypeFeatures_set_zero_conf_required(this.ptr);
303 * Checks if this feature is supported.
305 public bool supports_zero_conf() {
306 bool ret = bindings.ChannelTypeFeatures_supports_zero_conf(this.ptr);
312 * Checks if this feature is required.
314 public bool requires_zero_conf() {
315 bool ret = bindings.ChannelTypeFeatures_requires_zero_conf(this.ptr);