1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelDetails extends CommonBase {
16 ChannelDetails(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.ChannelDetails_free(ptr); }
24 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
25 * thereafter this is the txid of the funding transaction xor the funding transaction output).
26 * Note that this means this value is *not* persistent - it can change once during the
27 * lifetime of the channel.
29 public ChannelId get_channel_id() {
30 long ret = bindings.ChannelDetails_get_channel_id(this.ptr);
31 Reference.reachabilityFence(this);
32 if (ret >= 0 && ret <= 4096) { return null; }
33 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
34 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
39 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
40 * thereafter this is the txid of the funding transaction xor the funding transaction output).
41 * Note that this means this value is *not* persistent - it can change once during the
42 * lifetime of the channel.
44 public void set_channel_id(org.ldk.structs.ChannelId val) {
45 bindings.ChannelDetails_set_channel_id(this.ptr, val.ptr);
46 Reference.reachabilityFence(this);
47 Reference.reachabilityFence(val);
48 if (this != null) { this.ptrs_to.add(val); };
52 * Parameters which apply to our counterparty. See individual fields for more information.
54 public ChannelCounterparty get_counterparty() {
55 long ret = bindings.ChannelDetails_get_counterparty(this.ptr);
56 Reference.reachabilityFence(this);
57 if (ret >= 0 && ret <= 4096) { return null; }
58 org.ldk.structs.ChannelCounterparty ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelCounterparty(null, ret); }
59 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
64 * Parameters which apply to our counterparty. See individual fields for more information.
66 public void set_counterparty(org.ldk.structs.ChannelCounterparty val) {
67 bindings.ChannelDetails_set_counterparty(this.ptr, val.ptr);
68 Reference.reachabilityFence(this);
69 Reference.reachabilityFence(val);
70 if (this != null) { this.ptrs_to.add(val); };
74 * The Channel's funding transaction output, if we've negotiated the funding transaction with
75 * our counterparty already.
77 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
80 public OutPoint get_funding_txo() {
81 long ret = bindings.ChannelDetails_get_funding_txo(this.ptr);
82 Reference.reachabilityFence(this);
83 if (ret >= 0 && ret <= 4096) { return null; }
84 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
85 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
90 * The Channel's funding transaction output, if we've negotiated the funding transaction with
91 * our counterparty already.
93 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
95 public void set_funding_txo(@Nullable org.ldk.structs.OutPoint val) {
96 bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr);
97 Reference.reachabilityFence(this);
98 Reference.reachabilityFence(val);
99 if (this != null) { this.ptrs_to.add(val); };
103 * The features which this channel operates with. See individual features for more info.
105 * `None` until negotiation completes and the channel type is finalized.
107 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
110 public ChannelTypeFeatures get_channel_type() {
111 long ret = bindings.ChannelDetails_get_channel_type(this.ptr);
112 Reference.reachabilityFence(this);
113 if (ret >= 0 && ret <= 4096) { return null; }
114 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
115 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
120 * The features which this channel operates with. See individual features for more info.
122 * `None` until negotiation completes and the channel type is finalized.
124 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
126 public void set_channel_type(@Nullable org.ldk.structs.ChannelTypeFeatures val) {
127 bindings.ChannelDetails_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
128 Reference.reachabilityFence(this);
129 Reference.reachabilityFence(val);
130 if (this != null) { this.ptrs_to.add(val); };
134 * The position of the funding transaction in the chain. None if the funding transaction has
135 * not yet been confirmed and the channel fully opened.
137 * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
138 * payments instead of this. See [`get_inbound_payment_scid`].
140 * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
141 * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
143 * [`inbound_scid_alias`]: Self::inbound_scid_alias
144 * [`outbound_scid_alias`]: Self::outbound_scid_alias
145 * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
146 * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
147 * [`confirmations_required`]: Self::confirmations_required
149 public Option_u64Z get_short_channel_id() {
150 long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr);
151 Reference.reachabilityFence(this);
152 if (ret >= 0 && ret <= 4096) { return null; }
153 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
159 * The position of the funding transaction in the chain. None if the funding transaction has
160 * not yet been confirmed and the channel fully opened.
162 * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
163 * payments instead of this. See [`get_inbound_payment_scid`].
165 * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
166 * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
168 * [`inbound_scid_alias`]: Self::inbound_scid_alias
169 * [`outbound_scid_alias`]: Self::outbound_scid_alias
170 * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
171 * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
172 * [`confirmations_required`]: Self::confirmations_required
174 public void set_short_channel_id(org.ldk.structs.Option_u64Z val) {
175 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
176 Reference.reachabilityFence(this);
177 Reference.reachabilityFence(val);
178 if (this != null) { this.ptrs_to.add(val); };
182 * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
183 * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
184 * the channel has not yet been confirmed (as long as [`confirmations_required`] is
187 * This will be `None` as long as the channel is not available for routing outbound payments.
189 * [`short_channel_id`]: Self::short_channel_id
190 * [`confirmations_required`]: Self::confirmations_required
192 public Option_u64Z get_outbound_scid_alias() {
193 long ret = bindings.ChannelDetails_get_outbound_scid_alias(this.ptr);
194 Reference.reachabilityFence(this);
195 if (ret >= 0 && ret <= 4096) { return null; }
196 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
197 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
202 * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
203 * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
204 * the channel has not yet been confirmed (as long as [`confirmations_required`] is
207 * This will be `None` as long as the channel is not available for routing outbound payments.
209 * [`short_channel_id`]: Self::short_channel_id
210 * [`confirmations_required`]: Self::confirmations_required
212 public void set_outbound_scid_alias(org.ldk.structs.Option_u64Z val) {
213 bindings.ChannelDetails_set_outbound_scid_alias(this.ptr, val.ptr);
214 Reference.reachabilityFence(this);
215 Reference.reachabilityFence(val);
216 if (this != null) { this.ptrs_to.add(val); };
220 * An optional [`short_channel_id`] alias for this channel, randomly generated by our
221 * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
222 * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
223 * when they see a payment to be routed to us.
225 * Our counterparty may choose to rotate this value at any time, though will always recognize
226 * previous values for inbound payment forwarding.
228 * [`short_channel_id`]: Self::short_channel_id
230 public Option_u64Z get_inbound_scid_alias() {
231 long ret = bindings.ChannelDetails_get_inbound_scid_alias(this.ptr);
232 Reference.reachabilityFence(this);
233 if (ret >= 0 && ret <= 4096) { return null; }
234 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
235 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
240 * An optional [`short_channel_id`] alias for this channel, randomly generated by our
241 * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
242 * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
243 * when they see a payment to be routed to us.
245 * Our counterparty may choose to rotate this value at any time, though will always recognize
246 * previous values for inbound payment forwarding.
248 * [`short_channel_id`]: Self::short_channel_id
250 public void set_inbound_scid_alias(org.ldk.structs.Option_u64Z val) {
251 bindings.ChannelDetails_set_inbound_scid_alias(this.ptr, val.ptr);
252 Reference.reachabilityFence(this);
253 Reference.reachabilityFence(val);
254 if (this != null) { this.ptrs_to.add(val); };
258 * The value, in satoshis, of this channel as appears in the funding output
260 public long get_channel_value_satoshis() {
261 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
262 Reference.reachabilityFence(this);
267 * The value, in satoshis, of this channel as appears in the funding output
269 public void set_channel_value_satoshis(long val) {
270 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
271 Reference.reachabilityFence(this);
272 Reference.reachabilityFence(val);
276 * The value, in satoshis, that must always be held in the channel for us. This value ensures
277 * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
278 * this value on chain.
280 * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
282 * This value will be `None` for outbound channels until the counterparty accepts the channel.
284 * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
286 public Option_u64Z get_unspendable_punishment_reserve() {
287 long ret = bindings.ChannelDetails_get_unspendable_punishment_reserve(this.ptr);
288 Reference.reachabilityFence(this);
289 if (ret >= 0 && ret <= 4096) { return null; }
290 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
291 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
296 * The value, in satoshis, that must always be held in the channel for us. This value ensures
297 * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
298 * this value on chain.
300 * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
302 * This value will be `None` for outbound channels until the counterparty accepts the channel.
304 * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
306 public void set_unspendable_punishment_reserve(org.ldk.structs.Option_u64Z val) {
307 bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr);
308 Reference.reachabilityFence(this);
309 Reference.reachabilityFence(val);
310 if (this != null) { this.ptrs_to.add(val); };
314 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
315 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
316 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
317 * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects
318 * serialized with LDK versions prior to 0.0.113.
320 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
321 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
322 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
324 public UInt128 get_user_channel_id() {
325 byte[] ret = bindings.ChannelDetails_get_user_channel_id(this.ptr);
326 Reference.reachabilityFence(this);
327 org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
332 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
333 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
334 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
335 * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects
336 * serialized with LDK versions prior to 0.0.113.
338 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
339 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
340 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
342 public void set_user_channel_id(org.ldk.util.UInt128 val) {
343 bindings.ChannelDetails_set_user_channel_id(this.ptr, val.getLEBytes());
344 Reference.reachabilityFence(this);
345 Reference.reachabilityFence(val);
349 * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
350 * which is applied to commitment and HTLC transactions.
352 * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
354 public Option_u32Z get_feerate_sat_per_1000_weight() {
355 long ret = bindings.ChannelDetails_get_feerate_sat_per_1000_weight(this.ptr);
356 Reference.reachabilityFence(this);
357 if (ret >= 0 && ret <= 4096) { return null; }
358 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
359 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
364 * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
365 * which is applied to commitment and HTLC transactions.
367 * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
369 public void set_feerate_sat_per_1000_weight(org.ldk.structs.Option_u32Z val) {
370 bindings.ChannelDetails_set_feerate_sat_per_1000_weight(this.ptr, val.ptr);
371 Reference.reachabilityFence(this);
372 Reference.reachabilityFence(val);
373 if (this != null) { this.ptrs_to.add(val); };
377 * Our total balance. This is the amount we would get if we close the channel.
378 * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
379 * amount is not likely to be recoverable on close.
381 * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
382 * balance is not available for inclusion in new outbound HTLCs). This further does not include
383 * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
384 * This does not consider any on-chain fees.
386 * See also [`ChannelDetails::outbound_capacity_msat`]
388 public long get_balance_msat() {
389 long ret = bindings.ChannelDetails_get_balance_msat(this.ptr);
390 Reference.reachabilityFence(this);
395 * Our total balance. This is the amount we would get if we close the channel.
396 * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
397 * amount is not likely to be recoverable on close.
399 * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
400 * balance is not available for inclusion in new outbound HTLCs). This further does not include
401 * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
402 * This does not consider any on-chain fees.
404 * See also [`ChannelDetails::outbound_capacity_msat`]
406 public void set_balance_msat(long val) {
407 bindings.ChannelDetails_set_balance_msat(this.ptr, val);
408 Reference.reachabilityFence(this);
409 Reference.reachabilityFence(val);
413 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
414 * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
415 * available for inclusion in new outbound HTLCs). This further does not include any pending
416 * outgoing HTLCs which are awaiting some other resolution to be sent.
418 * See also [`ChannelDetails::balance_msat`]
420 * This value is not exact. Due to various in-flight changes, feerate changes, and our
421 * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
422 * should be able to spend nearly this amount.
424 public long get_outbound_capacity_msat() {
425 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
426 Reference.reachabilityFence(this);
431 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
432 * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
433 * available for inclusion in new outbound HTLCs). This further does not include any pending
434 * outgoing HTLCs which are awaiting some other resolution to be sent.
436 * See also [`ChannelDetails::balance_msat`]
438 * This value is not exact. Due to various in-flight changes, feerate changes, and our
439 * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
440 * should be able to spend nearly this amount.
442 public void set_outbound_capacity_msat(long val) {
443 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
444 Reference.reachabilityFence(this);
445 Reference.reachabilityFence(val);
449 * The available outbound capacity for sending a single HTLC to the remote peer. This is
450 * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
451 * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
452 * to use a limit as close as possible to the HTLC limit we can currently send.
454 * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
455 * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
457 public long get_next_outbound_htlc_limit_msat() {
458 long ret = bindings.ChannelDetails_get_next_outbound_htlc_limit_msat(this.ptr);
459 Reference.reachabilityFence(this);
464 * The available outbound capacity for sending a single HTLC to the remote peer. This is
465 * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
466 * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
467 * to use a limit as close as possible to the HTLC limit we can currently send.
469 * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
470 * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
472 public void set_next_outbound_htlc_limit_msat(long val) {
473 bindings.ChannelDetails_set_next_outbound_htlc_limit_msat(this.ptr, val);
474 Reference.reachabilityFence(this);
475 Reference.reachabilityFence(val);
479 * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
480 * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
481 * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
482 * route which is valid.
484 public long get_next_outbound_htlc_minimum_msat() {
485 long ret = bindings.ChannelDetails_get_next_outbound_htlc_minimum_msat(this.ptr);
486 Reference.reachabilityFence(this);
491 * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
492 * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
493 * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
494 * route which is valid.
496 public void set_next_outbound_htlc_minimum_msat(long val) {
497 bindings.ChannelDetails_set_next_outbound_htlc_minimum_msat(this.ptr, val);
498 Reference.reachabilityFence(this);
499 Reference.reachabilityFence(val);
503 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
504 * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
505 * available for inclusion in new inbound HTLCs).
506 * Note that there are some corner cases not fully handled here, so the actual available
507 * inbound capacity may be slightly higher than this.
509 * This value is not exact. Due to various in-flight changes, feerate changes, and our
510 * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
511 * However, our counterparty should be able to spend nearly this amount.
513 public long get_inbound_capacity_msat() {
514 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
515 Reference.reachabilityFence(this);
520 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
521 * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
522 * available for inclusion in new inbound HTLCs).
523 * Note that there are some corner cases not fully handled here, so the actual available
524 * inbound capacity may be slightly higher than this.
526 * This value is not exact. Due to various in-flight changes, feerate changes, and our
527 * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
528 * However, our counterparty should be able to spend nearly this amount.
530 public void set_inbound_capacity_msat(long val) {
531 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
532 Reference.reachabilityFence(this);
533 Reference.reachabilityFence(val);
537 * The number of required confirmations on the funding transaction before the funding will be
538 * considered \"locked\". This number is selected by the channel fundee (i.e. us if
539 * [`is_outbound`] is *not* set), and can be selected for inbound channels with
540 * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
541 * [`ChannelHandshakeLimits::max_minimum_depth`].
543 * This value will be `None` for outbound channels until the counterparty accepts the channel.
545 * [`is_outbound`]: ChannelDetails::is_outbound
546 * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
547 * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
549 public Option_u32Z get_confirmations_required() {
550 long ret = bindings.ChannelDetails_get_confirmations_required(this.ptr);
551 Reference.reachabilityFence(this);
552 if (ret >= 0 && ret <= 4096) { return null; }
553 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
554 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
559 * The number of required confirmations on the funding transaction before the funding will be
560 * considered \"locked\". This number is selected by the channel fundee (i.e. us if
561 * [`is_outbound`] is *not* set), and can be selected for inbound channels with
562 * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
563 * [`ChannelHandshakeLimits::max_minimum_depth`].
565 * This value will be `None` for outbound channels until the counterparty accepts the channel.
567 * [`is_outbound`]: ChannelDetails::is_outbound
568 * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
569 * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
571 public void set_confirmations_required(org.ldk.structs.Option_u32Z val) {
572 bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr);
573 Reference.reachabilityFence(this);
574 Reference.reachabilityFence(val);
575 if (this != null) { this.ptrs_to.add(val); };
579 * The current number of confirmations on the funding transaction.
581 * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
583 public Option_u32Z get_confirmations() {
584 long ret = bindings.ChannelDetails_get_confirmations(this.ptr);
585 Reference.reachabilityFence(this);
586 if (ret >= 0 && ret <= 4096) { return null; }
587 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
588 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
593 * The current number of confirmations on the funding transaction.
595 * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
597 public void set_confirmations(org.ldk.structs.Option_u32Z val) {
598 bindings.ChannelDetails_set_confirmations(this.ptr, val.ptr);
599 Reference.reachabilityFence(this);
600 Reference.reachabilityFence(val);
601 if (this != null) { this.ptrs_to.add(val); };
605 * The number of blocks (after our commitment transaction confirms) that we will need to wait
606 * until we can claim our funds after we force-close the channel. During this time our
607 * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
608 * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
609 * time to claim our non-HTLC-encumbered funds.
611 * This value will be `None` for outbound channels until the counterparty accepts the channel.
613 public Option_u16Z get_force_close_spend_delay() {
614 long ret = bindings.ChannelDetails_get_force_close_spend_delay(this.ptr);
615 Reference.reachabilityFence(this);
616 if (ret >= 0 && ret <= 4096) { return null; }
617 org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret);
618 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
623 * The number of blocks (after our commitment transaction confirms) that we will need to wait
624 * until we can claim our funds after we force-close the channel. During this time our
625 * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
626 * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
627 * time to claim our non-HTLC-encumbered funds.
629 * This value will be `None` for outbound channels until the counterparty accepts the channel.
631 public void set_force_close_spend_delay(org.ldk.structs.Option_u16Z val) {
632 bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr);
633 Reference.reachabilityFence(this);
634 Reference.reachabilityFence(val);
635 if (this != null) { this.ptrs_to.add(val); };
639 * True if the channel was initiated (and thus funded) by us.
641 public boolean get_is_outbound() {
642 boolean ret = bindings.ChannelDetails_get_is_outbound(this.ptr);
643 Reference.reachabilityFence(this);
648 * True if the channel was initiated (and thus funded) by us.
650 public void set_is_outbound(boolean val) {
651 bindings.ChannelDetails_set_is_outbound(this.ptr, val);
652 Reference.reachabilityFence(this);
653 Reference.reachabilityFence(val);
657 * True if the channel is confirmed, channel_ready messages have been exchanged, and the
658 * channel is not currently being shut down. `channel_ready` message exchange implies the
659 * required confirmation count has been reached (and we were connected to the peer at some
660 * point after the funding transaction received enough confirmations). The required
661 * confirmation count is provided in [`confirmations_required`].
663 * [`confirmations_required`]: ChannelDetails::confirmations_required
665 public boolean get_is_channel_ready() {
666 boolean ret = bindings.ChannelDetails_get_is_channel_ready(this.ptr);
667 Reference.reachabilityFence(this);
672 * True if the channel is confirmed, channel_ready messages have been exchanged, and the
673 * channel is not currently being shut down. `channel_ready` message exchange implies the
674 * required confirmation count has been reached (and we were connected to the peer at some
675 * point after the funding transaction received enough confirmations). The required
676 * confirmation count is provided in [`confirmations_required`].
678 * [`confirmations_required`]: ChannelDetails::confirmations_required
680 public void set_is_channel_ready(boolean val) {
681 bindings.ChannelDetails_set_is_channel_ready(this.ptr, val);
682 Reference.reachabilityFence(this);
683 Reference.reachabilityFence(val);
687 * The stage of the channel's shutdown.
688 * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
690 * Returns a copy of the field.
692 public Option_ChannelShutdownStateZ get_channel_shutdown_state() {
693 long ret = bindings.ChannelDetails_get_channel_shutdown_state(this.ptr);
694 Reference.reachabilityFence(this);
695 if (ret >= 0 && ret <= 4096) { return null; }
696 org.ldk.structs.Option_ChannelShutdownStateZ ret_hu_conv = org.ldk.structs.Option_ChannelShutdownStateZ.constr_from_ptr(ret);
697 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
702 * The stage of the channel's shutdown.
703 * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
705 public void set_channel_shutdown_state(org.ldk.structs.Option_ChannelShutdownStateZ val) {
706 bindings.ChannelDetails_set_channel_shutdown_state(this.ptr, val.ptr);
707 Reference.reachabilityFence(this);
708 Reference.reachabilityFence(val);
709 if (this != null) { this.ptrs_to.add(val); };
713 * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
714 * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
716 * This is a strict superset of `is_channel_ready`.
718 public boolean get_is_usable() {
719 boolean ret = bindings.ChannelDetails_get_is_usable(this.ptr);
720 Reference.reachabilityFence(this);
725 * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
726 * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
728 * This is a strict superset of `is_channel_ready`.
730 public void set_is_usable(boolean val) {
731 bindings.ChannelDetails_set_is_usable(this.ptr, val);
732 Reference.reachabilityFence(this);
733 Reference.reachabilityFence(val);
737 * True if this channel is (or will be) publicly-announced.
739 public boolean get_is_public() {
740 boolean ret = bindings.ChannelDetails_get_is_public(this.ptr);
741 Reference.reachabilityFence(this);
746 * True if this channel is (or will be) publicly-announced.
748 public void set_is_public(boolean val) {
749 bindings.ChannelDetails_set_is_public(this.ptr, val);
750 Reference.reachabilityFence(this);
751 Reference.reachabilityFence(val);
755 * The smallest value HTLC (in msat) we will accept, for this channel. This field
756 * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
758 public Option_u64Z get_inbound_htlc_minimum_msat() {
759 long ret = bindings.ChannelDetails_get_inbound_htlc_minimum_msat(this.ptr);
760 Reference.reachabilityFence(this);
761 if (ret >= 0 && ret <= 4096) { return null; }
762 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
763 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
768 * The smallest value HTLC (in msat) we will accept, for this channel. This field
769 * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
771 public void set_inbound_htlc_minimum_msat(org.ldk.structs.Option_u64Z val) {
772 bindings.ChannelDetails_set_inbound_htlc_minimum_msat(this.ptr, val.ptr);
773 Reference.reachabilityFence(this);
774 Reference.reachabilityFence(val);
775 if (this != null) { this.ptrs_to.add(val); };
779 * The largest value HTLC (in msat) we currently will accept, for this channel.
781 public Option_u64Z get_inbound_htlc_maximum_msat() {
782 long ret = bindings.ChannelDetails_get_inbound_htlc_maximum_msat(this.ptr);
783 Reference.reachabilityFence(this);
784 if (ret >= 0 && ret <= 4096) { return null; }
785 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
786 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
791 * The largest value HTLC (in msat) we currently will accept, for this channel.
793 public void set_inbound_htlc_maximum_msat(org.ldk.structs.Option_u64Z val) {
794 bindings.ChannelDetails_set_inbound_htlc_maximum_msat(this.ptr, val.ptr);
795 Reference.reachabilityFence(this);
796 Reference.reachabilityFence(val);
797 if (this != null) { this.ptrs_to.add(val); };
801 * Set of configurable parameters that affect channel operation.
803 * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
805 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
808 public ChannelConfig get_config() {
809 long ret = bindings.ChannelDetails_get_config(this.ptr);
810 Reference.reachabilityFence(this);
811 if (ret >= 0 && ret <= 4096) { return null; }
812 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
813 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
818 * Set of configurable parameters that affect channel operation.
820 * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
822 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
824 public void set_config(@Nullable org.ldk.structs.ChannelConfig val) {
825 bindings.ChannelDetails_set_config(this.ptr, val == null ? 0 : val.ptr);
826 Reference.reachabilityFence(this);
827 Reference.reachabilityFence(val);
828 if (this != null) { this.ptrs_to.add(val); };
832 long ret = bindings.ChannelDetails_clone_ptr(this.ptr);
833 Reference.reachabilityFence(this);
838 * Creates a copy of the ChannelDetails
840 public ChannelDetails clone() {
841 long ret = bindings.ChannelDetails_clone(this.ptr);
842 Reference.reachabilityFence(this);
843 if (ret >= 0 && ret <= 4096) { return null; }
844 org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); }
845 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
850 * Gets the current SCID which should be used to identify this channel for inbound payments.
851 * This should be used for providing invoice hints or in any other context where our
852 * counterparty will forward a payment to us.
854 * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
855 * [`ChannelDetails::short_channel_id`]. See those for more information.
857 public Option_u64Z get_inbound_payment_scid() {
858 long ret = bindings.ChannelDetails_get_inbound_payment_scid(this.ptr);
859 Reference.reachabilityFence(this);
860 if (ret >= 0 && ret <= 4096) { return null; }
861 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
862 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
867 * Gets the current SCID which should be used to identify this channel for outbound payments.
868 * This should be used in [`Route`]s to describe the first hop or in other contexts where
869 * we're sending or forwarding a payment outbound over this channel.
871 * This is either the [`ChannelDetails::short_channel_id`], if set, or the
872 * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
874 public Option_u64Z get_outbound_payment_scid() {
875 long ret = bindings.ChannelDetails_get_outbound_payment_scid(this.ptr);
876 Reference.reachabilityFence(this);
877 if (ret >= 0 && ret <= 4096) { return null; }
878 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
879 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
884 * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
886 public byte[] write() {
887 byte[] ret = bindings.ChannelDetails_write(this.ptr);
888 Reference.reachabilityFence(this);
893 * Read a ChannelDetails from a byte array, created by ChannelDetails_write
895 public static Result_ChannelDetailsDecodeErrorZ read(byte[] ser) {
896 long ret = bindings.ChannelDetails_read(ser);
897 Reference.reachabilityFence(ser);
898 if (ret >= 0 && ret <= 4096) { return null; }
899 Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret);