6 namespace org { namespace ldk { namespace structs {
10 * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
12 public class ChannelDetails : CommonBase {
13 internal ChannelDetails(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.ChannelDetails_free(ptr); }
19 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
20 * thereafter this is the txid of the funding transaction xor the funding transaction output).
21 * Note that this means this value is *not* persistent - it can change once during the
22 * lifetime of the channel.
24 public byte[] get_channel_id() {
25 long ret = bindings.ChannelDetails_get_channel_id(this.ptr);
27 if (ret >= 0 && ret <= 4096) { return null; }
28 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
33 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
34 * thereafter this is the txid of the funding transaction xor the funding transaction output).
35 * Note that this means this value is *not* persistent - it can change once during the
36 * lifetime of the channel.
38 public void set_channel_id(byte[] val) {
39 bindings.ChannelDetails_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
45 * Parameters which apply to our counterparty. See individual fields for more information.
47 public ChannelCounterparty get_counterparty() {
48 long ret = bindings.ChannelDetails_get_counterparty(this.ptr);
50 if (ret >= 0 && ret <= 4096) { return null; }
51 org.ldk.structs.ChannelCounterparty ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelCounterparty(null, ret); }
52 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
57 * Parameters which apply to our counterparty. See individual fields for more information.
59 public void set_counterparty(org.ldk.structs.ChannelCounterparty val) {
60 bindings.ChannelDetails_set_counterparty(this.ptr, val == null ? 0 : val.ptr);
63 if (this != null) { this.ptrs_to.AddLast(val); };
67 * The Channel's funding transaction output, if we've negotiated the funding transaction with
68 * our counterparty already.
70 * Note that, if this has been set, `channel_id` will be equivalent to
71 * `funding_txo.unwrap().to_channel_id()`.
73 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
75 public OutPoint get_funding_txo() {
76 long ret = bindings.ChannelDetails_get_funding_txo(this.ptr);
78 if (ret >= 0 && ret <= 4096) { return null; }
79 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
80 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
85 * The Channel's funding transaction output, if we've negotiated the funding transaction with
86 * our counterparty already.
88 * Note that, if this has been set, `channel_id` will be equivalent to
89 * `funding_txo.unwrap().to_channel_id()`.
91 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
93 public void set_funding_txo(org.ldk.structs.OutPoint val) {
94 bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr);
97 if (this != null) { this.ptrs_to.AddLast(val); };
101 * The features which this channel operates with. See individual features for more info.
103 * `None` until negotiation completes and the channel type is finalized.
105 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
107 public ChannelTypeFeatures get_channel_type() {
108 long ret = bindings.ChannelDetails_get_channel_type(this.ptr);
110 if (ret >= 0 && ret <= 4096) { return null; }
111 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
112 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
117 * The features which this channel operates with. See individual features for more info.
119 * `None` until negotiation completes and the channel type is finalized.
121 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
123 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
124 bindings.ChannelDetails_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
127 if (this != null) { this.ptrs_to.AddLast(val); };
131 * The position of the funding transaction in the chain. None if the funding transaction has
132 * not yet been confirmed and the channel fully opened.
134 * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
135 * payments instead of this. See [`get_inbound_payment_scid`].
137 * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
138 * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
140 * [`inbound_scid_alias`]: Self::inbound_scid_alias
141 * [`outbound_scid_alias`]: Self::outbound_scid_alias
142 * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
143 * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
144 * [`confirmations_required`]: Self::confirmations_required
146 public Option_u64Z get_short_channel_id() {
147 long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr);
149 if (ret >= 0 && ret <= 4096) { return null; }
150 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
151 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
156 * The position of the funding transaction in the chain. None if the funding transaction has
157 * not yet been confirmed and the channel fully opened.
159 * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
160 * payments instead of this. See [`get_inbound_payment_scid`].
162 * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
163 * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
165 * [`inbound_scid_alias`]: Self::inbound_scid_alias
166 * [`outbound_scid_alias`]: Self::outbound_scid_alias
167 * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
168 * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
169 * [`confirmations_required`]: Self::confirmations_required
171 public void set_short_channel_id(org.ldk.structs.Option_u64Z val) {
172 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
175 if (this != null) { this.ptrs_to.AddLast(val); };
179 * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
180 * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
181 * the channel has not yet been confirmed (as long as [`confirmations_required`] is
184 * This will be `None` as long as the channel is not available for routing outbound payments.
186 * [`short_channel_id`]: Self::short_channel_id
187 * [`confirmations_required`]: Self::confirmations_required
189 public Option_u64Z get_outbound_scid_alias() {
190 long ret = bindings.ChannelDetails_get_outbound_scid_alias(this.ptr);
192 if (ret >= 0 && ret <= 4096) { return null; }
193 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
194 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
199 * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
200 * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
201 * the channel has not yet been confirmed (as long as [`confirmations_required`] is
204 * This will be `None` as long as the channel is not available for routing outbound payments.
206 * [`short_channel_id`]: Self::short_channel_id
207 * [`confirmations_required`]: Self::confirmations_required
209 public void set_outbound_scid_alias(org.ldk.structs.Option_u64Z val) {
210 bindings.ChannelDetails_set_outbound_scid_alias(this.ptr, val.ptr);
213 if (this != null) { this.ptrs_to.AddLast(val); };
217 * An optional [`short_channel_id`] alias for this channel, randomly generated by our
218 * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
219 * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
220 * when they see a payment to be routed to us.
222 * Our counterparty may choose to rotate this value at any time, though will always recognize
223 * previous values for inbound payment forwarding.
225 * [`short_channel_id`]: Self::short_channel_id
227 public Option_u64Z get_inbound_scid_alias() {
228 long ret = bindings.ChannelDetails_get_inbound_scid_alias(this.ptr);
230 if (ret >= 0 && ret <= 4096) { return null; }
231 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
232 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
237 * An optional [`short_channel_id`] alias for this channel, randomly generated by our
238 * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
239 * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
240 * when they see a payment to be routed to us.
242 * Our counterparty may choose to rotate this value at any time, though will always recognize
243 * previous values for inbound payment forwarding.
245 * [`short_channel_id`]: Self::short_channel_id
247 public void set_inbound_scid_alias(org.ldk.structs.Option_u64Z val) {
248 bindings.ChannelDetails_set_inbound_scid_alias(this.ptr, val.ptr);
251 if (this != null) { this.ptrs_to.AddLast(val); };
255 * The value, in satoshis, of this channel as appears in the funding output
257 public long get_channel_value_satoshis() {
258 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
264 * The value, in satoshis, of this channel as appears in the funding output
266 public void set_channel_value_satoshis(long val) {
267 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
273 * The value, in satoshis, that must always be held in the channel for us. This value ensures
274 * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
275 * this value on chain.
277 * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
279 * This value will be `None` for outbound channels until the counterparty accepts the channel.
281 * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
283 public Option_u64Z get_unspendable_punishment_reserve() {
284 long ret = bindings.ChannelDetails_get_unspendable_punishment_reserve(this.ptr);
286 if (ret >= 0 && ret <= 4096) { return null; }
287 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
288 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
293 * The value, in satoshis, that must always be held in the channel for us. This value ensures
294 * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
295 * this value on chain.
297 * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
299 * This value will be `None` for outbound channels until the counterparty accepts the channel.
301 * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
303 public void set_unspendable_punishment_reserve(org.ldk.structs.Option_u64Z val) {
304 bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr);
307 if (this != null) { this.ptrs_to.AddLast(val); };
311 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
312 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
313 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
314 * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects
315 * serialized with LDK versions prior to 0.0.113.
317 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
318 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
319 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
321 public UInt128 get_user_channel_id() {
322 long ret = bindings.ChannelDetails_get_user_channel_id(this.ptr);
324 if (ret >= 0 && ret <= 4096) { return null; }
325 org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
330 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
331 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
332 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
333 * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects
334 * serialized with LDK versions prior to 0.0.113.
336 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
337 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
338 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
340 public void set_user_channel_id(org.ldk.util.UInt128 val) {
341 bindings.ChannelDetails_set_user_channel_id(this.ptr, InternalUtils.encodeUint8Array(val.getLEBytes()));
347 * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
348 * which is applied to commitment and HTLC transactions.
350 * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
352 public Option_u32Z get_feerate_sat_per_1000_weight() {
353 long ret = bindings.ChannelDetails_get_feerate_sat_per_1000_weight(this.ptr);
355 if (ret >= 0 && ret <= 4096) { return null; }
356 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
357 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
362 * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
363 * which is applied to commitment and HTLC transactions.
365 * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
367 public void set_feerate_sat_per_1000_weight(org.ldk.structs.Option_u32Z val) {
368 bindings.ChannelDetails_set_feerate_sat_per_1000_weight(this.ptr, val.ptr);
371 if (this != null) { this.ptrs_to.AddLast(val); };
375 * Our total balance. This is the amount we would get if we close the channel.
376 * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
377 * amount is not likely to be recoverable on close.
379 * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
380 * balance is not available for inclusion in new outbound HTLCs). This further does not include
381 * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
382 * This does not consider any on-chain fees.
384 * See also [`ChannelDetails::outbound_capacity_msat`]
386 public long get_balance_msat() {
387 long ret = bindings.ChannelDetails_get_balance_msat(this.ptr);
393 * Our total balance. This is the amount we would get if we close the channel.
394 * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
395 * amount is not likely to be recoverable on close.
397 * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
398 * balance is not available for inclusion in new outbound HTLCs). This further does not include
399 * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
400 * This does not consider any on-chain fees.
402 * See also [`ChannelDetails::outbound_capacity_msat`]
404 public void set_balance_msat(long val) {
405 bindings.ChannelDetails_set_balance_msat(this.ptr, val);
411 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
412 * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
413 * available for inclusion in new outbound HTLCs). This further does not include any pending
414 * outgoing HTLCs which are awaiting some other resolution to be sent.
416 * See also [`ChannelDetails::balance_msat`]
418 * This value is not exact. Due to various in-flight changes, feerate changes, and our
419 * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
420 * should be able to spend nearly this amount.
422 public long get_outbound_capacity_msat() {
423 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
429 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
430 * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
431 * available for inclusion in new outbound HTLCs). This further does not include any pending
432 * outgoing HTLCs which are awaiting some other resolution to be sent.
434 * See also [`ChannelDetails::balance_msat`]
436 * This value is not exact. Due to various in-flight changes, feerate changes, and our
437 * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
438 * should be able to spend nearly this amount.
440 public void set_outbound_capacity_msat(long val) {
441 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
447 * The available outbound capacity for sending a single HTLC to the remote peer. This is
448 * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
449 * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
450 * to use a limit as close as possible to the HTLC limit we can currently send.
452 * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
453 * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
455 public long get_next_outbound_htlc_limit_msat() {
456 long ret = bindings.ChannelDetails_get_next_outbound_htlc_limit_msat(this.ptr);
462 * The available outbound capacity for sending a single HTLC to the remote peer. This is
463 * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
464 * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
465 * to use a limit as close as possible to the HTLC limit we can currently send.
467 * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
468 * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
470 public void set_next_outbound_htlc_limit_msat(long val) {
471 bindings.ChannelDetails_set_next_outbound_htlc_limit_msat(this.ptr, val);
477 * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
478 * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
479 * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
480 * route which is valid.
482 public long get_next_outbound_htlc_minimum_msat() {
483 long ret = bindings.ChannelDetails_get_next_outbound_htlc_minimum_msat(this.ptr);
489 * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
490 * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
491 * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
492 * route which is valid.
494 public void set_next_outbound_htlc_minimum_msat(long val) {
495 bindings.ChannelDetails_set_next_outbound_htlc_minimum_msat(this.ptr, val);
501 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
502 * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
503 * available for inclusion in new inbound HTLCs).
504 * Note that there are some corner cases not fully handled here, so the actual available
505 * inbound capacity may be slightly higher than this.
507 * This value is not exact. Due to various in-flight changes, feerate changes, and our
508 * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
509 * However, our counterparty should be able to spend nearly this amount.
511 public long get_inbound_capacity_msat() {
512 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
518 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
519 * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
520 * available for inclusion in new inbound HTLCs).
521 * Note that there are some corner cases not fully handled here, so the actual available
522 * inbound capacity may be slightly higher than this.
524 * This value is not exact. Due to various in-flight changes, feerate changes, and our
525 * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
526 * However, our counterparty should be able to spend nearly this amount.
528 public void set_inbound_capacity_msat(long val) {
529 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
535 * The number of required confirmations on the funding transaction before the funding will be
536 * considered \"locked\". This number is selected by the channel fundee (i.e. us if
537 * [`is_outbound`] is *not* set), and can be selected for inbound channels with
538 * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
539 * [`ChannelHandshakeLimits::max_minimum_depth`].
541 * This value will be `None` for outbound channels until the counterparty accepts the channel.
543 * [`is_outbound`]: ChannelDetails::is_outbound
544 * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
545 * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
547 public Option_u32Z get_confirmations_required() {
548 long ret = bindings.ChannelDetails_get_confirmations_required(this.ptr);
550 if (ret >= 0 && ret <= 4096) { return null; }
551 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
552 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
557 * The number of required confirmations on the funding transaction before the funding will be
558 * considered \"locked\". This number is selected by the channel fundee (i.e. us if
559 * [`is_outbound`] is *not* set), and can be selected for inbound channels with
560 * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
561 * [`ChannelHandshakeLimits::max_minimum_depth`].
563 * This value will be `None` for outbound channels until the counterparty accepts the channel.
565 * [`is_outbound`]: ChannelDetails::is_outbound
566 * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
567 * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
569 public void set_confirmations_required(org.ldk.structs.Option_u32Z val) {
570 bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr);
573 if (this != null) { this.ptrs_to.AddLast(val); };
577 * The current number of confirmations on the funding transaction.
579 * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
581 public Option_u32Z get_confirmations() {
582 long ret = bindings.ChannelDetails_get_confirmations(this.ptr);
584 if (ret >= 0 && ret <= 4096) { return null; }
585 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
586 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
591 * The current number of confirmations on the funding transaction.
593 * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
595 public void set_confirmations(org.ldk.structs.Option_u32Z val) {
596 bindings.ChannelDetails_set_confirmations(this.ptr, val.ptr);
599 if (this != null) { this.ptrs_to.AddLast(val); };
603 * The number of blocks (after our commitment transaction confirms) that we will need to wait
604 * until we can claim our funds after we force-close the channel. During this time our
605 * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
606 * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
607 * time to claim our non-HTLC-encumbered funds.
609 * This value will be `None` for outbound channels until the counterparty accepts the channel.
611 public Option_u16Z get_force_close_spend_delay() {
612 long ret = bindings.ChannelDetails_get_force_close_spend_delay(this.ptr);
614 if (ret >= 0 && ret <= 4096) { return null; }
615 org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret);
616 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
621 * The number of blocks (after our commitment transaction confirms) that we will need to wait
622 * until we can claim our funds after we force-close the channel. During this time our
623 * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
624 * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
625 * time to claim our non-HTLC-encumbered funds.
627 * This value will be `None` for outbound channels until the counterparty accepts the channel.
629 public void set_force_close_spend_delay(org.ldk.structs.Option_u16Z val) {
630 bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr);
633 if (this != null) { this.ptrs_to.AddLast(val); };
637 * True if the channel was initiated (and thus funded) by us.
639 public bool get_is_outbound() {
640 bool ret = bindings.ChannelDetails_get_is_outbound(this.ptr);
646 * True if the channel was initiated (and thus funded) by us.
648 public void set_is_outbound(bool val) {
649 bindings.ChannelDetails_set_is_outbound(this.ptr, val);
655 * True if the channel is confirmed, channel_ready messages have been exchanged, and the
656 * channel is not currently being shut down. `channel_ready` message exchange implies the
657 * required confirmation count has been reached (and we were connected to the peer at some
658 * point after the funding transaction received enough confirmations). The required
659 * confirmation count is provided in [`confirmations_required`].
661 * [`confirmations_required`]: ChannelDetails::confirmations_required
663 public bool get_is_channel_ready() {
664 bool ret = bindings.ChannelDetails_get_is_channel_ready(this.ptr);
670 * True if the channel is confirmed, channel_ready messages have been exchanged, and the
671 * channel is not currently being shut down. `channel_ready` message exchange implies the
672 * required confirmation count has been reached (and we were connected to the peer at some
673 * point after the funding transaction received enough confirmations). The required
674 * confirmation count is provided in [`confirmations_required`].
676 * [`confirmations_required`]: ChannelDetails::confirmations_required
678 public void set_is_channel_ready(bool val) {
679 bindings.ChannelDetails_set_is_channel_ready(this.ptr, val);
685 * The stage of the channel's shutdown.
686 * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
688 * Returns a copy of the field.
690 public Option_ChannelShutdownStateZ get_channel_shutdown_state() {
691 long ret = bindings.ChannelDetails_get_channel_shutdown_state(this.ptr);
693 if (ret >= 0 && ret <= 4096) { return null; }
694 org.ldk.structs.Option_ChannelShutdownStateZ ret_hu_conv = org.ldk.structs.Option_ChannelShutdownStateZ.constr_from_ptr(ret);
695 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
700 * The stage of the channel's shutdown.
701 * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
703 public void set_channel_shutdown_state(org.ldk.structs.Option_ChannelShutdownStateZ val) {
704 bindings.ChannelDetails_set_channel_shutdown_state(this.ptr, val.ptr);
707 if (this != null) { this.ptrs_to.AddLast(val); };
711 * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
712 * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
714 * This is a strict superset of `is_channel_ready`.
716 public bool get_is_usable() {
717 bool ret = bindings.ChannelDetails_get_is_usable(this.ptr);
723 * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
724 * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
726 * This is a strict superset of `is_channel_ready`.
728 public void set_is_usable(bool val) {
729 bindings.ChannelDetails_set_is_usable(this.ptr, val);
735 * True if this channel is (or will be) publicly-announced.
737 public bool get_is_public() {
738 bool ret = bindings.ChannelDetails_get_is_public(this.ptr);
744 * True if this channel is (or will be) publicly-announced.
746 public void set_is_public(bool val) {
747 bindings.ChannelDetails_set_is_public(this.ptr, val);
753 * The smallest value HTLC (in msat) we will accept, for this channel. This field
754 * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
756 public Option_u64Z get_inbound_htlc_minimum_msat() {
757 long ret = bindings.ChannelDetails_get_inbound_htlc_minimum_msat(this.ptr);
759 if (ret >= 0 && ret <= 4096) { return null; }
760 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
761 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
766 * The smallest value HTLC (in msat) we will accept, for this channel. This field
767 * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
769 public void set_inbound_htlc_minimum_msat(org.ldk.structs.Option_u64Z val) {
770 bindings.ChannelDetails_set_inbound_htlc_minimum_msat(this.ptr, val.ptr);
773 if (this != null) { this.ptrs_to.AddLast(val); };
777 * The largest value HTLC (in msat) we currently will accept, for this channel.
779 public Option_u64Z get_inbound_htlc_maximum_msat() {
780 long ret = bindings.ChannelDetails_get_inbound_htlc_maximum_msat(this.ptr);
782 if (ret >= 0 && ret <= 4096) { return null; }
783 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
784 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
789 * The largest value HTLC (in msat) we currently will accept, for this channel.
791 public void set_inbound_htlc_maximum_msat(org.ldk.structs.Option_u64Z val) {
792 bindings.ChannelDetails_set_inbound_htlc_maximum_msat(this.ptr, val.ptr);
795 if (this != null) { this.ptrs_to.AddLast(val); };
799 * Set of configurable parameters that affect channel operation.
801 * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
803 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
805 public ChannelConfig get_config() {
806 long ret = bindings.ChannelDetails_get_config(this.ptr);
808 if (ret >= 0 && ret <= 4096) { return null; }
809 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
810 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
815 * Set of configurable parameters that affect channel operation.
817 * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
819 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
821 public void set_config(org.ldk.structs.ChannelConfig val) {
822 bindings.ChannelDetails_set_config(this.ptr, val == null ? 0 : val.ptr);
825 if (this != null) { this.ptrs_to.AddLast(val); };
829 * Constructs a new ChannelDetails given each field
831 * Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
832 * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
833 * Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
835 public static ChannelDetails of(byte[] channel_id_arg, org.ldk.structs.ChannelCounterparty counterparty_arg, org.ldk.structs.OutPoint funding_txo_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg, org.ldk.structs.Option_u64Z short_channel_id_arg, org.ldk.structs.Option_u64Z outbound_scid_alias_arg, org.ldk.structs.Option_u64Z inbound_scid_alias_arg, long channel_value_satoshis_arg, org.ldk.structs.Option_u64Z unspendable_punishment_reserve_arg, org.ldk.util.UInt128 user_channel_id_arg, org.ldk.structs.Option_u32Z feerate_sat_per_1000_weight_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long next_outbound_htlc_limit_msat_arg, long next_outbound_htlc_minimum_msat_arg, long inbound_capacity_msat_arg, org.ldk.structs.Option_u32Z confirmations_required_arg, org.ldk.structs.Option_u32Z confirmations_arg, org.ldk.structs.Option_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, org.ldk.structs.Option_ChannelShutdownStateZ channel_shutdown_state_arg, bool is_usable_arg, bool is_public_arg, org.ldk.structs.Option_u64Z inbound_htlc_minimum_msat_arg, org.ldk.structs.Option_u64Z inbound_htlc_maximum_msat_arg, org.ldk.structs.ChannelConfig config_arg) {
836 long ret = bindings.ChannelDetails_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), counterparty_arg == null ? 0 : counterparty_arg.ptr, funding_txo_arg == null ? 0 : funding_txo_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr, short_channel_id_arg.ptr, outbound_scid_alias_arg.ptr, inbound_scid_alias_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, InternalUtils.encodeUint8Array(user_channel_id_arg.getLEBytes()), feerate_sat_per_1000_weight_arg.ptr, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, confirmations_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg.ptr, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg.ptr, inbound_htlc_maximum_msat_arg.ptr, config_arg == null ? 0 : config_arg.ptr);
837 GC.KeepAlive(channel_id_arg);
838 GC.KeepAlive(counterparty_arg);
839 GC.KeepAlive(funding_txo_arg);
840 GC.KeepAlive(channel_type_arg);
841 GC.KeepAlive(short_channel_id_arg);
842 GC.KeepAlive(outbound_scid_alias_arg);
843 GC.KeepAlive(inbound_scid_alias_arg);
844 GC.KeepAlive(channel_value_satoshis_arg);
845 GC.KeepAlive(unspendable_punishment_reserve_arg);
846 GC.KeepAlive(user_channel_id_arg);
847 GC.KeepAlive(feerate_sat_per_1000_weight_arg);
848 GC.KeepAlive(balance_msat_arg);
849 GC.KeepAlive(outbound_capacity_msat_arg);
850 GC.KeepAlive(next_outbound_htlc_limit_msat_arg);
851 GC.KeepAlive(next_outbound_htlc_minimum_msat_arg);
852 GC.KeepAlive(inbound_capacity_msat_arg);
853 GC.KeepAlive(confirmations_required_arg);
854 GC.KeepAlive(confirmations_arg);
855 GC.KeepAlive(force_close_spend_delay_arg);
856 GC.KeepAlive(is_outbound_arg);
857 GC.KeepAlive(is_channel_ready_arg);
858 GC.KeepAlive(channel_shutdown_state_arg);
859 GC.KeepAlive(is_usable_arg);
860 GC.KeepAlive(is_public_arg);
861 GC.KeepAlive(inbound_htlc_minimum_msat_arg);
862 GC.KeepAlive(inbound_htlc_maximum_msat_arg);
863 GC.KeepAlive(config_arg);
864 if (ret >= 0 && ret <= 4096) { return null; }
865 org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); }
866 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
867 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(counterparty_arg); };
868 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_txo_arg); };
869 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
870 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(short_channel_id_arg); };
871 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outbound_scid_alias_arg); };
872 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(inbound_scid_alias_arg); };
873 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(unspendable_punishment_reserve_arg); };
874 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(feerate_sat_per_1000_weight_arg); };
875 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(confirmations_required_arg); };
876 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(confirmations_arg); };
877 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(force_close_spend_delay_arg); };
878 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_shutdown_state_arg); };
879 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(inbound_htlc_minimum_msat_arg); };
880 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(inbound_htlc_maximum_msat_arg); };
881 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(config_arg); };
885 internal long clone_ptr() {
886 long ret = bindings.ChannelDetails_clone_ptr(this.ptr);
892 * Creates a copy of the ChannelDetails
894 public ChannelDetails clone() {
895 long ret = bindings.ChannelDetails_clone(this.ptr);
897 if (ret >= 0 && ret <= 4096) { return null; }
898 org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); }
899 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
904 * Gets the current SCID which should be used to identify this channel for inbound payments.
905 * This should be used for providing invoice hints or in any other context where our
906 * counterparty will forward a payment to us.
908 * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
909 * [`ChannelDetails::short_channel_id`]. See those for more information.
911 public Option_u64Z get_inbound_payment_scid() {
912 long ret = bindings.ChannelDetails_get_inbound_payment_scid(this.ptr);
914 if (ret >= 0 && ret <= 4096) { return null; }
915 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
916 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
921 * Gets the current SCID which should be used to identify this channel for outbound payments.
922 * This should be used in [`Route`]s to describe the first hop or in other contexts where
923 * we're sending or forwarding a payment outbound over this channel.
925 * This is either the [`ChannelDetails::short_channel_id`], if set, or the
926 * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
928 public Option_u64Z get_outbound_payment_scid() {
929 long ret = bindings.ChannelDetails_get_outbound_payment_scid(this.ptr);
931 if (ret >= 0 && ret <= 4096) { return null; }
932 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
933 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
938 * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
940 public byte[] write() {
941 long ret = bindings.ChannelDetails_write(this.ptr);
943 if (ret >= 0 && ret <= 4096) { return null; }
944 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
949 * Read a ChannelDetails from a byte array, created by ChannelDetails_write
951 public static Result_ChannelDetailsDecodeErrorZ read(byte[] ser) {
952 long ret = bindings.ChannelDetails_read(InternalUtils.encodeUint8Array(ser));
954 if (ret >= 0 && ret <= 4096) { return null; }
955 Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret);