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 byte[] ret = bindings.AcceptChannel_get_temporary_channel_id(this.ptr);
32 * A temporary channel ID, until the funding outpoint is announced
34 public void set_temporary_channel_id(byte[] val) {
35 bindings.AcceptChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
41 * The threshold below which outputs on transactions broadcast by sender will be omitted
43 public long get_dust_limit_satoshis() {
44 long ret = bindings.AcceptChannel_get_dust_limit_satoshis(this.ptr);
50 * The threshold below which outputs on transactions broadcast by sender will be omitted
52 public void set_dust_limit_satoshis(long val) {
53 bindings.AcceptChannel_set_dust_limit_satoshis(this.ptr, val);
59 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
61 public long get_max_htlc_value_in_flight_msat() {
62 long ret = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this.ptr);
68 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
70 public void set_max_htlc_value_in_flight_msat(long val) {
71 bindings.AcceptChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
77 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
79 public long get_channel_reserve_satoshis() {
80 long ret = bindings.AcceptChannel_get_channel_reserve_satoshis(this.ptr);
86 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
88 public void set_channel_reserve_satoshis(long val) {
89 bindings.AcceptChannel_set_channel_reserve_satoshis(this.ptr, val);
95 * The minimum HTLC size incoming to sender, in milli-satoshi
97 public long get_htlc_minimum_msat() {
98 long ret = bindings.AcceptChannel_get_htlc_minimum_msat(this.ptr);
104 * The minimum HTLC size incoming to sender, in milli-satoshi
106 public void set_htlc_minimum_msat(long val) {
107 bindings.AcceptChannel_set_htlc_minimum_msat(this.ptr, val);
113 * Minimum depth of the funding transaction before the channel is considered open
115 public int get_minimum_depth() {
116 int ret = bindings.AcceptChannel_get_minimum_depth(this.ptr);
122 * Minimum depth of the funding transaction before the channel is considered open
124 public void set_minimum_depth(int val) {
125 bindings.AcceptChannel_set_minimum_depth(this.ptr, val);
131 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
133 public short get_to_self_delay() {
134 short ret = bindings.AcceptChannel_get_to_self_delay(this.ptr);
140 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
142 public void set_to_self_delay(short val) {
143 bindings.AcceptChannel_set_to_self_delay(this.ptr, val);
149 * The maximum number of inbound HTLCs towards sender
151 public short get_max_accepted_htlcs() {
152 short ret = bindings.AcceptChannel_get_max_accepted_htlcs(this.ptr);
158 * The maximum number of inbound HTLCs towards sender
160 public void set_max_accepted_htlcs(short val) {
161 bindings.AcceptChannel_set_max_accepted_htlcs(this.ptr, val);
167 * The sender's key controlling the funding transaction
169 public byte[] get_funding_pubkey() {
170 byte[] ret = bindings.AcceptChannel_get_funding_pubkey(this.ptr);
176 * The sender's key controlling the funding transaction
178 public void set_funding_pubkey(byte[] val) {
179 bindings.AcceptChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
185 * Used to derive a revocation key for transactions broadcast by counterparty
187 public byte[] get_revocation_basepoint() {
188 byte[] ret = bindings.AcceptChannel_get_revocation_basepoint(this.ptr);
194 * Used to derive a revocation key for transactions broadcast by counterparty
196 public void set_revocation_basepoint(byte[] val) {
197 bindings.AcceptChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
203 * A payment key to sender for transactions broadcast by counterparty
205 public byte[] get_payment_point() {
206 byte[] ret = bindings.AcceptChannel_get_payment_point(this.ptr);
212 * A payment key to sender for transactions broadcast by counterparty
214 public void set_payment_point(byte[] val) {
215 bindings.AcceptChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
221 * Used to derive a payment key to sender for transactions broadcast by sender
223 public byte[] get_delayed_payment_basepoint() {
224 byte[] ret = bindings.AcceptChannel_get_delayed_payment_basepoint(this.ptr);
230 * Used to derive a payment key to sender for transactions broadcast by sender
232 public void set_delayed_payment_basepoint(byte[] val) {
233 bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
239 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
241 public byte[] get_htlc_basepoint() {
242 byte[] ret = bindings.AcceptChannel_get_htlc_basepoint(this.ptr);
248 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
250 public void set_htlc_basepoint(byte[] val) {
251 bindings.AcceptChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
257 * The first to-be-broadcast-by-sender transaction's per commitment point
259 public byte[] get_first_per_commitment_point() {
260 byte[] ret = bindings.AcceptChannel_get_first_per_commitment_point(this.ptr);
266 * The first to-be-broadcast-by-sender transaction's per commitment point
268 public void set_first_per_commitment_point(byte[] val) {
269 bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
275 * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close
277 public Option_ScriptZ get_shutdown_scriptpubkey() {
278 long ret = bindings.AcceptChannel_get_shutdown_scriptpubkey(this.ptr);
280 if (ret >= 0 && ret <= 4096) { return null; }
281 org.ldk.structs.Option_ScriptZ ret_hu_conv = org.ldk.structs.Option_ScriptZ.constr_from_ptr(ret);
282 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
287 * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close
289 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_ScriptZ val) {
290 bindings.AcceptChannel_set_shutdown_scriptpubkey(this.ptr, val.ptr);
293 if (this != null) { this.ptrs_to.AddLast(val); };
297 * The channel type that this channel will represent.
299 * If this is `None`, we derive the channel type from the intersection of
300 * our feature bits with our counterparty's feature bits from the [`Init`] message.
301 * This is required to match the equivalent field in [`OpenChannel::channel_type`].
303 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
305 public ChannelTypeFeatures get_channel_type() {
306 long ret = bindings.AcceptChannel_get_channel_type(this.ptr);
308 if (ret >= 0 && ret <= 4096) { return null; }
309 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
310 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
315 * The channel type that this channel will represent.
317 * If this is `None`, we derive the channel type from the intersection of
318 * our feature bits with our counterparty's feature bits from the [`Init`] message.
319 * This is required to match the equivalent field in [`OpenChannel::channel_type`].
321 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
323 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
324 bindings.AcceptChannel_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
327 if (this != null) { this.ptrs_to.AddLast(val); };
331 * Constructs a new AcceptChannel given each field
333 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_ScriptZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
334 long ret = bindings.AcceptChannel_new(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.check_arr_len(funding_pubkey_arg, 33), InternalUtils.check_arr_len(revocation_basepoint_arg, 33), InternalUtils.check_arr_len(payment_point_arg, 33), InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33), InternalUtils.check_arr_len(htlc_basepoint_arg, 33), InternalUtils.check_arr_len(first_per_commitment_point_arg, 33), shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
335 GC.KeepAlive(temporary_channel_id_arg);
336 GC.KeepAlive(dust_limit_satoshis_arg);
337 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
338 GC.KeepAlive(channel_reserve_satoshis_arg);
339 GC.KeepAlive(htlc_minimum_msat_arg);
340 GC.KeepAlive(minimum_depth_arg);
341 GC.KeepAlive(to_self_delay_arg);
342 GC.KeepAlive(max_accepted_htlcs_arg);
343 GC.KeepAlive(funding_pubkey_arg);
344 GC.KeepAlive(revocation_basepoint_arg);
345 GC.KeepAlive(payment_point_arg);
346 GC.KeepAlive(delayed_payment_basepoint_arg);
347 GC.KeepAlive(htlc_basepoint_arg);
348 GC.KeepAlive(first_per_commitment_point_arg);
349 GC.KeepAlive(shutdown_scriptpubkey_arg);
350 GC.KeepAlive(channel_type_arg);
351 if (ret >= 0 && ret <= 4096) { return null; }
352 org.ldk.structs.AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannel(null, ret); }
353 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
354 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
355 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
359 internal long clone_ptr() {
360 long ret = bindings.AcceptChannel_clone_ptr(this.ptr);
366 * Creates a copy of the AcceptChannel
368 public AcceptChannel clone() {
369 long ret = bindings.AcceptChannel_clone(this.ptr);
371 if (ret >= 0 && ret <= 4096) { return null; }
372 org.ldk.structs.AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannel(null, ret); }
373 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
378 * Checks if two AcceptChannels contain equal inner contents.
379 * This ignores pointers and is_owned flags and looks at the values in fields.
380 * Two objects with NULL inner values will be considered "equal" here.
382 public bool eq(org.ldk.structs.AcceptChannel b) {
383 bool ret = bindings.AcceptChannel_eq(this.ptr, b == null ? 0 : b.ptr);
386 if (this != null) { this.ptrs_to.AddLast(b); };
390 public override bool Equals(object o) {
391 if (!(o is AcceptChannel)) return false;
392 return this.eq((AcceptChannel)o);
395 * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
397 public byte[] write() {
398 byte[] ret = bindings.AcceptChannel_write(this.ptr);
404 * Read a AcceptChannel from a byte array, created by AcceptChannel_write
406 public static Result_AcceptChannelDecodeErrorZ read(byte[] ser) {
407 long ret = bindings.AcceptChannel_read(ser);
409 if (ret >= 0 && ret <= 4096) { return null; }
410 Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret);