6 namespace org { namespace ldk { namespace structs {
10 * Contains fields that are both common to [`accept_channel`] and `accept_channel2` messages.
12 * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
14 public class CommonAcceptChannelFields : CommonBase {
15 internal CommonAcceptChannelFields(object _dummy, long ptr) : base(ptr) { }
16 ~CommonAcceptChannelFields() {
17 if (ptr != 0) { bindings.CommonAcceptChannelFields_free(ptr); }
21 * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message.
23 public ChannelId get_temporary_channel_id() {
24 long ret = bindings.CommonAcceptChannelFields_get_temporary_channel_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
28 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
33 * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message.
35 public void set_temporary_channel_id(org.ldk.structs.ChannelId val) {
36 bindings.CommonAcceptChannelFields_set_temporary_channel_id(this.ptr, val.ptr);
39 if (this != null) { this.ptrs_to.AddLast(val); };
43 * The threshold below which outputs on transactions broadcast by the channel acceptor will be
46 public long get_dust_limit_satoshis() {
47 long ret = bindings.CommonAcceptChannelFields_get_dust_limit_satoshis(this.ptr);
53 * The threshold below which outputs on transactions broadcast by the channel acceptor will be
56 public void set_dust_limit_satoshis(long val) {
57 bindings.CommonAcceptChannelFields_set_dust_limit_satoshis(this.ptr, val);
63 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
65 public long get_max_htlc_value_in_flight_msat() {
66 long ret = bindings.CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(this.ptr);
72 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
74 public void set_max_htlc_value_in_flight_msat(long val) {
75 bindings.CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(this.ptr, val);
81 * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
83 public long get_htlc_minimum_msat() {
84 long ret = bindings.CommonAcceptChannelFields_get_htlc_minimum_msat(this.ptr);
90 * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
92 public void set_htlc_minimum_msat(long val) {
93 bindings.CommonAcceptChannelFields_set_htlc_minimum_msat(this.ptr, val);
99 * Minimum depth of the funding transaction before the channel is considered open
101 public int get_minimum_depth() {
102 int ret = bindings.CommonAcceptChannelFields_get_minimum_depth(this.ptr);
108 * Minimum depth of the funding transaction before the channel is considered open
110 public void set_minimum_depth(int val) {
111 bindings.CommonAcceptChannelFields_set_minimum_depth(this.ptr, val);
117 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
118 * broadcast a commitment transaction
120 public short get_to_self_delay() {
121 short ret = bindings.CommonAcceptChannelFields_get_to_self_delay(this.ptr);
127 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
128 * broadcast a commitment transaction
130 public void set_to_self_delay(short val) {
131 bindings.CommonAcceptChannelFields_set_to_self_delay(this.ptr, val);
137 * The maximum number of inbound HTLCs towards channel acceptor
139 public short get_max_accepted_htlcs() {
140 short ret = bindings.CommonAcceptChannelFields_get_max_accepted_htlcs(this.ptr);
146 * The maximum number of inbound HTLCs towards channel acceptor
148 public void set_max_accepted_htlcs(short val) {
149 bindings.CommonAcceptChannelFields_set_max_accepted_htlcs(this.ptr, val);
155 * The channel acceptor's key controlling the funding transaction
157 public byte[] get_funding_pubkey() {
158 long ret = bindings.CommonAcceptChannelFields_get_funding_pubkey(this.ptr);
160 if (ret >= 0 && ret <= 4096) { return null; }
161 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
166 * The channel acceptor's key controlling the funding transaction
168 public void set_funding_pubkey(byte[] val) {
169 bindings.CommonAcceptChannelFields_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
175 * Used to derive a revocation key for transactions broadcast by counterparty
177 public byte[] get_revocation_basepoint() {
178 long ret = bindings.CommonAcceptChannelFields_get_revocation_basepoint(this.ptr);
180 if (ret >= 0 && ret <= 4096) { return null; }
181 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
186 * Used to derive a revocation key for transactions broadcast by counterparty
188 public void set_revocation_basepoint(byte[] val) {
189 bindings.CommonAcceptChannelFields_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
195 * A payment key to channel acceptor for transactions broadcast by counterparty
197 public byte[] get_payment_basepoint() {
198 long ret = bindings.CommonAcceptChannelFields_get_payment_basepoint(this.ptr);
200 if (ret >= 0 && ret <= 4096) { return null; }
201 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
206 * A payment key to channel acceptor for transactions broadcast by counterparty
208 public void set_payment_basepoint(byte[] val) {
209 bindings.CommonAcceptChannelFields_set_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
215 * Used to derive a payment key to channel acceptor for transactions broadcast by channel
218 public byte[] get_delayed_payment_basepoint() {
219 long ret = bindings.CommonAcceptChannelFields_get_delayed_payment_basepoint(this.ptr);
221 if (ret >= 0 && ret <= 4096) { return null; }
222 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
227 * Used to derive a payment key to channel acceptor for transactions broadcast by channel
230 public void set_delayed_payment_basepoint(byte[] val) {
231 bindings.CommonAcceptChannelFields_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
237 * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
239 public byte[] get_htlc_basepoint() {
240 long ret = bindings.CommonAcceptChannelFields_get_htlc_basepoint(this.ptr);
242 if (ret >= 0 && ret <= 4096) { return null; }
243 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
248 * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
250 public void set_htlc_basepoint(byte[] val) {
251 bindings.CommonAcceptChannelFields_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
257 * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
259 public byte[] get_first_per_commitment_point() {
260 long ret = bindings.CommonAcceptChannelFields_get_first_per_commitment_point(this.ptr);
262 if (ret >= 0 && ret <= 4096) { return null; }
263 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
268 * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
270 public void set_first_per_commitment_point(byte[] val) {
271 bindings.CommonAcceptChannelFields_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
277 * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
278 * collaboratively close
280 public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
281 long ret = bindings.CommonAcceptChannelFields_get_shutdown_scriptpubkey(this.ptr);
283 if (ret >= 0 && ret <= 4096) { return null; }
284 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
285 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
290 * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
291 * collaboratively close
293 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
294 bindings.CommonAcceptChannelFields_set_shutdown_scriptpubkey(this.ptr, val.ptr);
297 if (this != null) { this.ptrs_to.AddLast(val); };
301 * The channel type that this channel will represent. If none is set, we derive the channel
302 * type from the intersection of our feature bits with our counterparty's feature bits from
305 * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s
306 * [`CommonOpenChannelFields::channel_type`].
308 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
310 public ChannelTypeFeatures get_channel_type() {
311 long ret = bindings.CommonAcceptChannelFields_get_channel_type(this.ptr);
313 if (ret >= 0 && ret <= 4096) { return null; }
314 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
315 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
320 * The channel type that this channel will represent. If none is set, we derive the channel
321 * type from the intersection of our feature bits with our counterparty's feature bits from
324 * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s
325 * [`CommonOpenChannelFields::channel_type`].
327 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
329 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
330 bindings.CommonAcceptChannelFields_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
333 if (this != null) { this.ptrs_to.AddLast(val); };
337 * Constructs a new CommonAcceptChannelFields given each field
339 * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
341 public static CommonAcceptChannelFields of(org.ldk.structs.ChannelId temporary_channel_id_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long htlc_minimum_msat_arg, int minimum_depth_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, org.ldk.structs.Option_CVec_u8ZZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
342 long ret = bindings.CommonAcceptChannelFields_new(temporary_channel_id_arg.ptr, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_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)), shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
343 GC.KeepAlive(temporary_channel_id_arg);
344 GC.KeepAlive(dust_limit_satoshis_arg);
345 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
346 GC.KeepAlive(htlc_minimum_msat_arg);
347 GC.KeepAlive(minimum_depth_arg);
348 GC.KeepAlive(to_self_delay_arg);
349 GC.KeepAlive(max_accepted_htlcs_arg);
350 GC.KeepAlive(funding_pubkey_arg);
351 GC.KeepAlive(revocation_basepoint_arg);
352 GC.KeepAlive(payment_basepoint_arg);
353 GC.KeepAlive(delayed_payment_basepoint_arg);
354 GC.KeepAlive(htlc_basepoint_arg);
355 GC.KeepAlive(first_per_commitment_point_arg);
356 GC.KeepAlive(shutdown_scriptpubkey_arg);
357 GC.KeepAlive(channel_type_arg);
358 if (ret >= 0 && ret <= 4096) { return null; }
359 org.ldk.structs.CommonAcceptChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonAcceptChannelFields(null, ret); }
360 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
361 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(temporary_channel_id_arg); };
362 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
363 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
367 internal long clone_ptr() {
368 long ret = bindings.CommonAcceptChannelFields_clone_ptr(this.ptr);
374 * Creates a copy of the CommonAcceptChannelFields
376 public CommonAcceptChannelFields clone() {
377 long ret = bindings.CommonAcceptChannelFields_clone(this.ptr);
379 if (ret >= 0 && ret <= 4096) { return null; }
380 org.ldk.structs.CommonAcceptChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonAcceptChannelFields(null, ret); }
381 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
386 * Generates a non-cryptographic 64-bit hash of the CommonAcceptChannelFields.
389 long ret = bindings.CommonAcceptChannelFields_hash(this.ptr);
394 public override int GetHashCode() {
395 return (int)this.hash();
398 * Checks if two CommonAcceptChannelFieldss contain equal inner contents.
399 * This ignores pointers and is_owned flags and looks at the values in fields.
400 * Two objects with NULL inner values will be considered "equal" here.
402 public bool eq(org.ldk.structs.CommonAcceptChannelFields b) {
403 bool ret = bindings.CommonAcceptChannelFields_eq(this.ptr, b.ptr);
406 if (this != null) { this.ptrs_to.AddLast(b); };
410 public override bool Equals(object o) {
411 if (!(o is CommonAcceptChannelFields)) return false;
412 return this.eq((CommonAcceptChannelFields)o);