6 namespace org { namespace ldk { namespace structs {
10 * An [`accept_channel`] message to be sent to or received from a peer.
12 * Used in V1 channel establishment
14 * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
16 public class AcceptChannel : CommonBase {
17 internal AcceptChannel(object _dummy, long ptr) : base(ptr) { }
19 if (ptr != 0) { bindings.AcceptChannel_free(ptr); }
23 * A temporary channel ID, until the funding outpoint is announced
25 public byte[] get_temporary_channel_id() {
26 long ret = bindings.AcceptChannel_get_temporary_channel_id(this.ptr);
28 if (ret >= 0 && ret <= 4096) { return null; }
29 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
34 * A temporary channel ID, until the funding outpoint is announced
36 public void set_temporary_channel_id(byte[] val) {
37 bindings.AcceptChannel_set_temporary_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
43 * The threshold below which outputs on transactions broadcast by sender will be omitted
45 public long get_dust_limit_satoshis() {
46 long ret = bindings.AcceptChannel_get_dust_limit_satoshis(this.ptr);
52 * The threshold below which outputs on transactions broadcast by sender will be omitted
54 public void set_dust_limit_satoshis(long val) {
55 bindings.AcceptChannel_set_dust_limit_satoshis(this.ptr, val);
61 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
63 public long get_max_htlc_value_in_flight_msat() {
64 long ret = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this.ptr);
70 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
72 public void set_max_htlc_value_in_flight_msat(long val) {
73 bindings.AcceptChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
79 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
81 public long get_channel_reserve_satoshis() {
82 long ret = bindings.AcceptChannel_get_channel_reserve_satoshis(this.ptr);
88 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
90 public void set_channel_reserve_satoshis(long val) {
91 bindings.AcceptChannel_set_channel_reserve_satoshis(this.ptr, val);
97 * The minimum HTLC size incoming to sender, in milli-satoshi
99 public long get_htlc_minimum_msat() {
100 long ret = bindings.AcceptChannel_get_htlc_minimum_msat(this.ptr);
106 * The minimum HTLC size incoming to sender, in milli-satoshi
108 public void set_htlc_minimum_msat(long val) {
109 bindings.AcceptChannel_set_htlc_minimum_msat(this.ptr, val);
115 * Minimum depth of the funding transaction before the channel is considered open
117 public int get_minimum_depth() {
118 int ret = bindings.AcceptChannel_get_minimum_depth(this.ptr);
124 * Minimum depth of the funding transaction before the channel is considered open
126 public void set_minimum_depth(int val) {
127 bindings.AcceptChannel_set_minimum_depth(this.ptr, val);
133 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
135 public short get_to_self_delay() {
136 short ret = bindings.AcceptChannel_get_to_self_delay(this.ptr);
142 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
144 public void set_to_self_delay(short val) {
145 bindings.AcceptChannel_set_to_self_delay(this.ptr, val);
151 * The maximum number of inbound HTLCs towards sender
153 public short get_max_accepted_htlcs() {
154 short ret = bindings.AcceptChannel_get_max_accepted_htlcs(this.ptr);
160 * The maximum number of inbound HTLCs towards sender
162 public void set_max_accepted_htlcs(short val) {
163 bindings.AcceptChannel_set_max_accepted_htlcs(this.ptr, val);
169 * The sender's key controlling the funding transaction
171 public byte[] get_funding_pubkey() {
172 long ret = bindings.AcceptChannel_get_funding_pubkey(this.ptr);
174 if (ret >= 0 && ret <= 4096) { return null; }
175 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
180 * The sender's key controlling the funding transaction
182 public void set_funding_pubkey(byte[] val) {
183 bindings.AcceptChannel_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
189 * Used to derive a revocation key for transactions broadcast by counterparty
191 public byte[] get_revocation_basepoint() {
192 long ret = bindings.AcceptChannel_get_revocation_basepoint(this.ptr);
194 if (ret >= 0 && ret <= 4096) { return null; }
195 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
200 * Used to derive a revocation key for transactions broadcast by counterparty
202 public void set_revocation_basepoint(byte[] val) {
203 bindings.AcceptChannel_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
209 * A payment key to sender for transactions broadcast by counterparty
211 public byte[] get_payment_point() {
212 long ret = bindings.AcceptChannel_get_payment_point(this.ptr);
214 if (ret >= 0 && ret <= 4096) { return null; }
215 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
220 * A payment key to sender for transactions broadcast by counterparty
222 public void set_payment_point(byte[] val) {
223 bindings.AcceptChannel_set_payment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
229 * Used to derive a payment key to sender for transactions broadcast by sender
231 public byte[] get_delayed_payment_basepoint() {
232 long ret = bindings.AcceptChannel_get_delayed_payment_basepoint(this.ptr);
234 if (ret >= 0 && ret <= 4096) { return null; }
235 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
240 * Used to derive a payment key to sender for transactions broadcast by sender
242 public void set_delayed_payment_basepoint(byte[] val) {
243 bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
249 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
251 public byte[] get_htlc_basepoint() {
252 long ret = bindings.AcceptChannel_get_htlc_basepoint(this.ptr);
254 if (ret >= 0 && ret <= 4096) { return null; }
255 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
260 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
262 public void set_htlc_basepoint(byte[] val) {
263 bindings.AcceptChannel_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
269 * The first to-be-broadcast-by-sender transaction's per commitment point
271 public byte[] get_first_per_commitment_point() {
272 long ret = bindings.AcceptChannel_get_first_per_commitment_point(this.ptr);
274 if (ret >= 0 && ret <= 4096) { return null; }
275 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
280 * The first to-be-broadcast-by-sender transaction's per commitment point
282 public void set_first_per_commitment_point(byte[] val) {
283 bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
289 * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close
291 public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
292 long ret = bindings.AcceptChannel_get_shutdown_scriptpubkey(this.ptr);
294 if (ret >= 0 && ret <= 4096) { return null; }
295 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
296 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
301 * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close
303 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
304 bindings.AcceptChannel_set_shutdown_scriptpubkey(this.ptr, val.ptr);
307 if (this != null) { this.ptrs_to.AddLast(val); };
311 * The channel type that this channel will represent.
313 * If this is `None`, we derive the channel type from the intersection of
314 * our feature bits with our counterparty's feature bits from the [`Init`] message.
315 * This is required to match the equivalent field in [`OpenChannel::channel_type`].
317 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
319 public ChannelTypeFeatures get_channel_type() {
320 long ret = bindings.AcceptChannel_get_channel_type(this.ptr);
322 if (ret >= 0 && ret <= 4096) { return null; }
323 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
324 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
329 * The channel type that this channel will represent.
331 * If this is `None`, we derive the channel type from the intersection of
332 * our feature bits with our counterparty's feature bits from the [`Init`] message.
333 * This is required to match the equivalent field in [`OpenChannel::channel_type`].
335 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
337 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
338 bindings.AcceptChannel_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
341 if (this != null) { this.ptrs_to.AddLast(val); };
345 * Constructs a new AcceptChannel given each field
347 * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
349 public static AcceptChannel of(byte[] temporary_channel_id_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long channel_reserve_satoshis_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_point_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) {
350 long ret = bindings.AcceptChannel_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(temporary_channel_id_arg, 32)), dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_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_point_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);
351 GC.KeepAlive(temporary_channel_id_arg);
352 GC.KeepAlive(dust_limit_satoshis_arg);
353 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
354 GC.KeepAlive(channel_reserve_satoshis_arg);
355 GC.KeepAlive(htlc_minimum_msat_arg);
356 GC.KeepAlive(minimum_depth_arg);
357 GC.KeepAlive(to_self_delay_arg);
358 GC.KeepAlive(max_accepted_htlcs_arg);
359 GC.KeepAlive(funding_pubkey_arg);
360 GC.KeepAlive(revocation_basepoint_arg);
361 GC.KeepAlive(payment_point_arg);
362 GC.KeepAlive(delayed_payment_basepoint_arg);
363 GC.KeepAlive(htlc_basepoint_arg);
364 GC.KeepAlive(first_per_commitment_point_arg);
365 GC.KeepAlive(shutdown_scriptpubkey_arg);
366 GC.KeepAlive(channel_type_arg);
367 if (ret >= 0 && ret <= 4096) { return null; }
368 org.ldk.structs.AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannel(null, ret); }
369 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
370 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
371 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
375 internal long clone_ptr() {
376 long ret = bindings.AcceptChannel_clone_ptr(this.ptr);
382 * Creates a copy of the AcceptChannel
384 public AcceptChannel clone() {
385 long ret = bindings.AcceptChannel_clone(this.ptr);
387 if (ret >= 0 && ret <= 4096) { return null; }
388 org.ldk.structs.AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannel(null, ret); }
389 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
394 * Checks if two AcceptChannels contain equal inner contents.
395 * This ignores pointers and is_owned flags and looks at the values in fields.
396 * Two objects with NULL inner values will be considered "equal" here.
398 public bool eq(org.ldk.structs.AcceptChannel b) {
399 bool ret = bindings.AcceptChannel_eq(this.ptr, b == null ? 0 : b.ptr);
402 if (this != null) { this.ptrs_to.AddLast(b); };
406 public override bool Equals(object o) {
407 if (!(o is AcceptChannel)) return false;
408 return this.eq((AcceptChannel)o);
411 * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
413 public byte[] write() {
414 long ret = bindings.AcceptChannel_write(this.ptr);
416 if (ret >= 0 && ret <= 4096) { return null; }
417 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
422 * Read a AcceptChannel from a byte array, created by AcceptChannel_write
424 public static Result_AcceptChannelDecodeErrorZ read(byte[] ser) {
425 long ret = bindings.AcceptChannel_read(InternalUtils.encodeUint8Array(ser));
427 if (ret >= 0 && ret <= 4096) { return null; }
428 Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret);