6 namespace org { namespace ldk { namespace structs {
10 * Contains fields that are both common to [`open_channel`] and `open_channel2` messages.
12 * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
14 public class CommonOpenChannelFields : CommonBase {
15 internal CommonOpenChannelFields(object _dummy, long ptr) : base(ptr) { }
16 ~CommonOpenChannelFields() {
17 if (ptr != 0) { bindings.CommonOpenChannelFields_free(ptr); }
21 * The genesis hash of the blockchain where the channel is to be opened
23 public byte[] get_chain_hash() {
24 long ret = bindings.CommonOpenChannelFields_get_chain_hash(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
32 * The genesis hash of the blockchain where the channel is to be opened
34 public void set_chain_hash(byte[] val) {
35 bindings.CommonOpenChannelFields_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
41 * A temporary channel ID
42 * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint
43 * For V1 channels: a temporary channel ID, until the funding outpoint is announced
45 public ChannelId get_temporary_channel_id() {
46 long ret = bindings.CommonOpenChannelFields_get_temporary_channel_id(this.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
55 * A temporary channel ID
56 * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint
57 * For V1 channels: a temporary channel ID, until the funding outpoint is announced
59 public void set_temporary_channel_id(org.ldk.structs.ChannelId val) {
60 bindings.CommonOpenChannelFields_set_temporary_channel_id(this.ptr, val.ptr);
63 if (this != null) { this.ptrs_to.AddLast(val); };
67 * For V1 channels: The channel value
68 * For V2 channels: Part of the channel value contributed by the channel initiator
70 public long get_funding_satoshis() {
71 long ret = bindings.CommonOpenChannelFields_get_funding_satoshis(this.ptr);
77 * For V1 channels: The channel value
78 * For V2 channels: Part of the channel value contributed by the channel initiator
80 public void set_funding_satoshis(long val) {
81 bindings.CommonOpenChannelFields_set_funding_satoshis(this.ptr, val);
87 * The threshold below which outputs on transactions broadcast by the channel initiator will be
90 public long get_dust_limit_satoshis() {
91 long ret = bindings.CommonOpenChannelFields_get_dust_limit_satoshis(this.ptr);
97 * The threshold below which outputs on transactions broadcast by the channel initiator will be
100 public void set_dust_limit_satoshis(long val) {
101 bindings.CommonOpenChannelFields_set_dust_limit_satoshis(this.ptr, val);
107 * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
109 public long get_max_htlc_value_in_flight_msat() {
110 long ret = bindings.CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(this.ptr);
116 * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
118 public void set_max_htlc_value_in_flight_msat(long val) {
119 bindings.CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(this.ptr, val);
125 * The minimum HTLC size incoming to channel initiator, in milli-satoshi
127 public long get_htlc_minimum_msat() {
128 long ret = bindings.CommonOpenChannelFields_get_htlc_minimum_msat(this.ptr);
134 * The minimum HTLC size incoming to channel initiator, in milli-satoshi
136 public void set_htlc_minimum_msat(long val) {
137 bindings.CommonOpenChannelFields_set_htlc_minimum_msat(this.ptr, val);
143 * The feerate for the commitment transaction set by the channel initiator until updated by
146 public int get_commitment_feerate_sat_per_1000_weight() {
147 int ret = bindings.CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(this.ptr);
153 * The feerate for the commitment transaction set by the channel initiator until updated by
156 public void set_commitment_feerate_sat_per_1000_weight(int val) {
157 bindings.CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(this.ptr, val);
163 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
164 * broadcast a commitment transaction
166 public short get_to_self_delay() {
167 short ret = bindings.CommonOpenChannelFields_get_to_self_delay(this.ptr);
173 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
174 * broadcast a commitment transaction
176 public void set_to_self_delay(short val) {
177 bindings.CommonOpenChannelFields_set_to_self_delay(this.ptr, val);
183 * The maximum number of inbound HTLCs towards channel initiator
185 public short get_max_accepted_htlcs() {
186 short ret = bindings.CommonOpenChannelFields_get_max_accepted_htlcs(this.ptr);
192 * The maximum number of inbound HTLCs towards channel initiator
194 public void set_max_accepted_htlcs(short val) {
195 bindings.CommonOpenChannelFields_set_max_accepted_htlcs(this.ptr, val);
201 * The channel initiator's key controlling the funding transaction
203 public byte[] get_funding_pubkey() {
204 long ret = bindings.CommonOpenChannelFields_get_funding_pubkey(this.ptr);
206 if (ret >= 0 && ret <= 4096) { return null; }
207 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
212 * The channel initiator's key controlling the funding transaction
214 public void set_funding_pubkey(byte[] val) {
215 bindings.CommonOpenChannelFields_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
221 * Used to derive a revocation key for transactions broadcast by counterparty
223 public byte[] get_revocation_basepoint() {
224 long ret = bindings.CommonOpenChannelFields_get_revocation_basepoint(this.ptr);
226 if (ret >= 0 && ret <= 4096) { return null; }
227 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
232 * Used to derive a revocation key for transactions broadcast by counterparty
234 public void set_revocation_basepoint(byte[] val) {
235 bindings.CommonOpenChannelFields_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
241 * A payment key to channel initiator for transactions broadcast by counterparty
243 public byte[] get_payment_basepoint() {
244 long ret = bindings.CommonOpenChannelFields_get_payment_basepoint(this.ptr);
246 if (ret >= 0 && ret <= 4096) { return null; }
247 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
252 * A payment key to channel initiator for transactions broadcast by counterparty
254 public void set_payment_basepoint(byte[] val) {
255 bindings.CommonOpenChannelFields_set_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
261 * Used to derive a payment key to channel initiator for transactions broadcast by channel
264 public byte[] get_delayed_payment_basepoint() {
265 long ret = bindings.CommonOpenChannelFields_get_delayed_payment_basepoint(this.ptr);
267 if (ret >= 0 && ret <= 4096) { return null; }
268 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
273 * Used to derive a payment key to channel initiator for transactions broadcast by channel
276 public void set_delayed_payment_basepoint(byte[] val) {
277 bindings.CommonOpenChannelFields_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
283 * Used to derive an HTLC payment key to channel initiator
285 public byte[] get_htlc_basepoint() {
286 long ret = bindings.CommonOpenChannelFields_get_htlc_basepoint(this.ptr);
288 if (ret >= 0 && ret <= 4096) { return null; }
289 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
294 * Used to derive an HTLC payment key to channel initiator
296 public void set_htlc_basepoint(byte[] val) {
297 bindings.CommonOpenChannelFields_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
303 * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
305 public byte[] get_first_per_commitment_point() {
306 long ret = bindings.CommonOpenChannelFields_get_first_per_commitment_point(this.ptr);
308 if (ret >= 0 && ret <= 4096) { return null; }
309 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
314 * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
316 public void set_first_per_commitment_point(byte[] val) {
317 bindings.CommonOpenChannelFields_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
323 * The channel flags to be used
325 public byte get_channel_flags() {
326 byte ret = bindings.CommonOpenChannelFields_get_channel_flags(this.ptr);
332 * The channel flags to be used
334 public void set_channel_flags(byte val) {
335 bindings.CommonOpenChannelFields_set_channel_flags(this.ptr, val);
341 * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
342 * collaboratively close
344 public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
345 long ret = bindings.CommonOpenChannelFields_get_shutdown_scriptpubkey(this.ptr);
347 if (ret >= 0 && ret <= 4096) { return null; }
348 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
349 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
354 * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
355 * collaboratively close
357 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
358 bindings.CommonOpenChannelFields_set_shutdown_scriptpubkey(this.ptr, val.ptr);
361 if (this != null) { this.ptrs_to.AddLast(val); };
365 * The channel type that this channel will represent
367 * If this is `None`, we derive the channel type from the intersection of our
368 * feature bits with our counterparty's feature bits from the [`Init`] message.
370 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
372 public ChannelTypeFeatures get_channel_type() {
373 long ret = bindings.CommonOpenChannelFields_get_channel_type(this.ptr);
375 if (ret >= 0 && ret <= 4096) { return null; }
376 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
377 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
382 * The channel type that this channel will represent
384 * If this is `None`, we derive the channel type from the intersection of our
385 * feature bits with our counterparty's feature bits from the [`Init`] message.
387 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
389 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
390 bindings.CommonOpenChannelFields_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
393 if (this != null) { this.ptrs_to.AddLast(val); };
397 * Constructs a new CommonOpenChannelFields given each field
399 * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
401 public static CommonOpenChannelFields of(byte[] chain_hash_arg, org.ldk.structs.ChannelId temporary_channel_id_arg, long funding_satoshis_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long htlc_minimum_msat_arg, int commitment_feerate_sat_per_1000_weight_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_basepoint_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg, byte[] first_per_commitment_point_arg, byte channel_flags_arg, org.ldk.structs.Option_CVec_u8ZZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
402 long ret = bindings.CommonOpenChannelFields_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), temporary_channel_id_arg.ptr, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, commitment_feerate_sat_per_1000_weight_arg, to_self_delay_arg, max_accepted_htlcs_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(revocation_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(htlc_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(first_per_commitment_point_arg, 33)), channel_flags_arg, shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
403 GC.KeepAlive(chain_hash_arg);
404 GC.KeepAlive(temporary_channel_id_arg);
405 GC.KeepAlive(funding_satoshis_arg);
406 GC.KeepAlive(dust_limit_satoshis_arg);
407 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
408 GC.KeepAlive(htlc_minimum_msat_arg);
409 GC.KeepAlive(commitment_feerate_sat_per_1000_weight_arg);
410 GC.KeepAlive(to_self_delay_arg);
411 GC.KeepAlive(max_accepted_htlcs_arg);
412 GC.KeepAlive(funding_pubkey_arg);
413 GC.KeepAlive(revocation_basepoint_arg);
414 GC.KeepAlive(payment_basepoint_arg);
415 GC.KeepAlive(delayed_payment_basepoint_arg);
416 GC.KeepAlive(htlc_basepoint_arg);
417 GC.KeepAlive(first_per_commitment_point_arg);
418 GC.KeepAlive(channel_flags_arg);
419 GC.KeepAlive(shutdown_scriptpubkey_arg);
420 GC.KeepAlive(channel_type_arg);
421 if (ret >= 0 && ret <= 4096) { return null; }
422 org.ldk.structs.CommonOpenChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonOpenChannelFields(null, ret); }
423 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
424 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(temporary_channel_id_arg); };
425 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
426 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
430 internal long clone_ptr() {
431 long ret = bindings.CommonOpenChannelFields_clone_ptr(this.ptr);
437 * Creates a copy of the CommonOpenChannelFields
439 public CommonOpenChannelFields clone() {
440 long ret = bindings.CommonOpenChannelFields_clone(this.ptr);
442 if (ret >= 0 && ret <= 4096) { return null; }
443 org.ldk.structs.CommonOpenChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonOpenChannelFields(null, ret); }
444 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
449 * Generates a non-cryptographic 64-bit hash of the CommonOpenChannelFields.
452 long ret = bindings.CommonOpenChannelFields_hash(this.ptr);
457 public override int GetHashCode() {
458 return (int)this.hash();
461 * Checks if two CommonOpenChannelFieldss contain equal inner contents.
462 * This ignores pointers and is_owned flags and looks at the values in fields.
463 * Two objects with NULL inner values will be considered "equal" here.
465 public bool eq(org.ldk.structs.CommonOpenChannelFields b) {
466 bool ret = bindings.CommonOpenChannelFields_eq(this.ptr, b.ptr);
469 if (this != null) { this.ptrs_to.AddLast(b); };
473 public override bool Equals(object o) {
474 if (!(o is CommonOpenChannelFields)) return false;
475 return this.eq((CommonOpenChannelFields)o);