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);
66 * For V1 channels: The channel value
67 * For V2 channels: Part of the channel value contributed by the channel initiator
69 public long get_funding_satoshis() {
70 long ret = bindings.CommonOpenChannelFields_get_funding_satoshis(this.ptr);
76 * For V1 channels: The channel value
77 * For V2 channels: Part of the channel value contributed by the channel initiator
79 public void set_funding_satoshis(long val) {
80 bindings.CommonOpenChannelFields_set_funding_satoshis(this.ptr, val);
86 * The threshold below which outputs on transactions broadcast by the channel initiator will be
89 public long get_dust_limit_satoshis() {
90 long ret = bindings.CommonOpenChannelFields_get_dust_limit_satoshis(this.ptr);
96 * The threshold below which outputs on transactions broadcast by the channel initiator will be
99 public void set_dust_limit_satoshis(long val) {
100 bindings.CommonOpenChannelFields_set_dust_limit_satoshis(this.ptr, val);
106 * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
108 public long get_max_htlc_value_in_flight_msat() {
109 long ret = bindings.CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(this.ptr);
115 * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
117 public void set_max_htlc_value_in_flight_msat(long val) {
118 bindings.CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(this.ptr, val);
124 * The minimum HTLC size incoming to channel initiator, in milli-satoshi
126 public long get_htlc_minimum_msat() {
127 long ret = bindings.CommonOpenChannelFields_get_htlc_minimum_msat(this.ptr);
133 * The minimum HTLC size incoming to channel initiator, in milli-satoshi
135 public void set_htlc_minimum_msat(long val) {
136 bindings.CommonOpenChannelFields_set_htlc_minimum_msat(this.ptr, val);
142 * The feerate for the commitment transaction set by the channel initiator until updated by
145 public int get_commitment_feerate_sat_per_1000_weight() {
146 int ret = bindings.CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(this.ptr);
152 * The feerate for the commitment transaction set by the channel initiator until updated by
155 public void set_commitment_feerate_sat_per_1000_weight(int val) {
156 bindings.CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(this.ptr, val);
162 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
163 * broadcast a commitment transaction
165 public short get_to_self_delay() {
166 short ret = bindings.CommonOpenChannelFields_get_to_self_delay(this.ptr);
172 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
173 * broadcast a commitment transaction
175 public void set_to_self_delay(short val) {
176 bindings.CommonOpenChannelFields_set_to_self_delay(this.ptr, val);
182 * The maximum number of inbound HTLCs towards channel initiator
184 public short get_max_accepted_htlcs() {
185 short ret = bindings.CommonOpenChannelFields_get_max_accepted_htlcs(this.ptr);
191 * The maximum number of inbound HTLCs towards channel initiator
193 public void set_max_accepted_htlcs(short val) {
194 bindings.CommonOpenChannelFields_set_max_accepted_htlcs(this.ptr, val);
200 * The channel initiator's key controlling the funding transaction
202 public byte[] get_funding_pubkey() {
203 long ret = bindings.CommonOpenChannelFields_get_funding_pubkey(this.ptr);
205 if (ret >= 0 && ret <= 4096) { return null; }
206 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
211 * The channel initiator's key controlling the funding transaction
213 public void set_funding_pubkey(byte[] val) {
214 bindings.CommonOpenChannelFields_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
220 * Used to derive a revocation key for transactions broadcast by counterparty
222 public byte[] get_revocation_basepoint() {
223 long ret = bindings.CommonOpenChannelFields_get_revocation_basepoint(this.ptr);
225 if (ret >= 0 && ret <= 4096) { return null; }
226 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
231 * Used to derive a revocation key for transactions broadcast by counterparty
233 public void set_revocation_basepoint(byte[] val) {
234 bindings.CommonOpenChannelFields_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
240 * A payment key to channel initiator for transactions broadcast by counterparty
242 public byte[] get_payment_basepoint() {
243 long ret = bindings.CommonOpenChannelFields_get_payment_basepoint(this.ptr);
245 if (ret >= 0 && ret <= 4096) { return null; }
246 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
251 * A payment key to channel initiator for transactions broadcast by counterparty
253 public void set_payment_basepoint(byte[] val) {
254 bindings.CommonOpenChannelFields_set_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
260 * Used to derive a payment key to channel initiator for transactions broadcast by channel
263 public byte[] get_delayed_payment_basepoint() {
264 long ret = bindings.CommonOpenChannelFields_get_delayed_payment_basepoint(this.ptr);
266 if (ret >= 0 && ret <= 4096) { return null; }
267 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
272 * Used to derive a payment key to channel initiator for transactions broadcast by channel
275 public void set_delayed_payment_basepoint(byte[] val) {
276 bindings.CommonOpenChannelFields_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
282 * Used to derive an HTLC payment key to channel initiator
284 public byte[] get_htlc_basepoint() {
285 long ret = bindings.CommonOpenChannelFields_get_htlc_basepoint(this.ptr);
287 if (ret >= 0 && ret <= 4096) { return null; }
288 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
293 * Used to derive an HTLC payment key to channel initiator
295 public void set_htlc_basepoint(byte[] val) {
296 bindings.CommonOpenChannelFields_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
302 * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
304 public byte[] get_first_per_commitment_point() {
305 long ret = bindings.CommonOpenChannelFields_get_first_per_commitment_point(this.ptr);
307 if (ret >= 0 && ret <= 4096) { return null; }
308 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
313 * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
315 public void set_first_per_commitment_point(byte[] val) {
316 bindings.CommonOpenChannelFields_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
322 * The channel flags to be used
324 public byte get_channel_flags() {
325 byte ret = bindings.CommonOpenChannelFields_get_channel_flags(this.ptr);
331 * The channel flags to be used
333 public void set_channel_flags(byte val) {
334 bindings.CommonOpenChannelFields_set_channel_flags(this.ptr, val);
340 * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
341 * collaboratively close
343 public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
344 long ret = bindings.CommonOpenChannelFields_get_shutdown_scriptpubkey(this.ptr);
346 if (ret >= 0 && ret <= 4096) { return null; }
347 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
348 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
353 * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
354 * collaboratively close
356 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
357 bindings.CommonOpenChannelFields_set_shutdown_scriptpubkey(this.ptr, val.ptr);
363 * The channel type that this channel will represent
365 * If this is `None`, we derive the channel type from the intersection of our
366 * feature bits with our counterparty's feature bits from the [`Init`] message.
368 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
370 public ChannelTypeFeatures get_channel_type() {
371 long ret = bindings.CommonOpenChannelFields_get_channel_type(this.ptr);
373 if (ret >= 0 && ret <= 4096) { return null; }
374 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
375 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
380 * The channel type that this channel will represent
382 * If this is `None`, we derive the channel type from the intersection of our
383 * feature bits with our counterparty's feature bits from the [`Init`] message.
385 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
387 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
388 bindings.CommonOpenChannelFields_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
394 * Constructs a new CommonOpenChannelFields given each field
396 * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
398 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) {
399 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);
400 GC.KeepAlive(chain_hash_arg);
401 GC.KeepAlive(temporary_channel_id_arg);
402 GC.KeepAlive(funding_satoshis_arg);
403 GC.KeepAlive(dust_limit_satoshis_arg);
404 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
405 GC.KeepAlive(htlc_minimum_msat_arg);
406 GC.KeepAlive(commitment_feerate_sat_per_1000_weight_arg);
407 GC.KeepAlive(to_self_delay_arg);
408 GC.KeepAlive(max_accepted_htlcs_arg);
409 GC.KeepAlive(funding_pubkey_arg);
410 GC.KeepAlive(revocation_basepoint_arg);
411 GC.KeepAlive(payment_basepoint_arg);
412 GC.KeepAlive(delayed_payment_basepoint_arg);
413 GC.KeepAlive(htlc_basepoint_arg);
414 GC.KeepAlive(first_per_commitment_point_arg);
415 GC.KeepAlive(channel_flags_arg);
416 GC.KeepAlive(shutdown_scriptpubkey_arg);
417 GC.KeepAlive(channel_type_arg);
418 if (ret >= 0 && ret <= 4096) { return null; }
419 org.ldk.structs.CommonOpenChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonOpenChannelFields(null, ret); }
420 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
424 internal long clone_ptr() {
425 long ret = bindings.CommonOpenChannelFields_clone_ptr(this.ptr);
431 * Creates a copy of the CommonOpenChannelFields
433 public CommonOpenChannelFields clone() {
434 long ret = bindings.CommonOpenChannelFields_clone(this.ptr);
436 if (ret >= 0 && ret <= 4096) { return null; }
437 org.ldk.structs.CommonOpenChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonOpenChannelFields(null, ret); }
438 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
443 * Generates a non-cryptographic 64-bit hash of the CommonOpenChannelFields.
446 long ret = bindings.CommonOpenChannelFields_hash(this.ptr);
451 public override int GetHashCode() {
452 return (int)this.hash();
455 * Checks if two CommonOpenChannelFieldss contain equal inner contents.
456 * This ignores pointers and is_owned flags and looks at the values in fields.
457 * Two objects with NULL inner values will be considered "equal" here.
459 public bool eq(org.ldk.structs.CommonOpenChannelFields b) {
460 bool ret = bindings.CommonOpenChannelFields_eq(this.ptr, b.ptr);
463 if (this != null) { this.ptrs_to.AddLast(b); };
467 public override bool Equals(object o) {
468 if (!(o is CommonOpenChannelFields)) return false;
469 return this.eq((CommonOpenChannelFields)o);
472 * The [`ChannelParameters`] for this channel.
474 public ChannelParameters channel_parameters() {
475 long ret = bindings.CommonOpenChannelFields_channel_parameters(this.ptr);
477 if (ret >= 0 && ret <= 4096) { return null; }
478 org.ldk.structs.ChannelParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelParameters(null, ret); }
479 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };