X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelDetails.java;h=84f4ac7ce011c3e201955493cc84d811e483c720;hb=5d91c4ade4b5f736d100428ccf84709ad29f971d;hp=342cc52847631a735cc1210ebc9720d1393e96a7;hpb=9760d533f7ecac9bb7a8249f9b557e3f995c276d;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelDetails.java b/src/main/java/org/ldk/structs/ChannelDetails.java index 342cc528..84f4ac7c 100644 --- a/src/main/java/org/ldk/structs/ChannelDetails.java +++ b/src/main/java/org/ldk/structs/ChannelDetails.java @@ -9,7 +9,10 @@ import javax.annotation.Nullable; /** - * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] + * + * [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels + * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ChannelDetails extends CommonBase { @@ -26,10 +29,13 @@ public class ChannelDetails extends CommonBase { * Note that this means this value is *not* persistent - it can change once during the * lifetime of the channel. */ - public byte[] get_channel_id() { - byte[] ret = bindings.ChannelDetails_get_channel_id(this.ptr); + public ChannelId get_channel_id() { + long ret = bindings.ChannelDetails_get_channel_id(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** @@ -38,10 +44,11 @@ public class ChannelDetails extends CommonBase { * Note that this means this value is *not* persistent - it can change once during the * lifetime of the channel. */ - public void set_channel_id(byte[] val) { - bindings.ChannelDetails_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + public void set_channel_id(org.ldk.structs.ChannelId val) { + bindings.ChannelDetails_set_channel_id(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -52,27 +59,24 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelCounterparty ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelCounterparty(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** * Parameters which apply to our counterparty. See individual fields for more information. */ - public void set_counterparty(ChannelCounterparty val) { - bindings.ChannelDetails_set_counterparty(this.ptr, val == null ? 0 : val.ptr); + public void set_counterparty(org.ldk.structs.ChannelCounterparty val) { + bindings.ChannelDetails_set_counterparty(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); - this.ptrs_to.add(val); + if (this != null) { this.ptrs_to.add(val); }; } /** * The Channel's funding transaction output, if we've negotiated the funding transaction with * our counterparty already. * - * Note that, if this has been set, `channel_id` will be equivalent to - * `funding_txo.unwrap().to_channel_id()`. - * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable @@ -81,7 +85,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -89,16 +93,13 @@ public class ChannelDetails extends CommonBase { * The Channel's funding transaction output, if we've negotiated the funding transaction with * our counterparty already. * - * Note that, if this has been set, `channel_id` will be equivalent to - * `funding_txo.unwrap().to_channel_id()`. - * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_funding_txo(@Nullable OutPoint val) { + public void set_funding_txo(@Nullable org.ldk.structs.OutPoint val) { bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); - this.ptrs_to.add(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -114,7 +115,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -125,11 +126,11 @@ public class ChannelDetails extends CommonBase { * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_channel_type(@Nullable ChannelTypeFeatures val) { + public void set_channel_type(@Nullable org.ldk.structs.ChannelTypeFeatures val) { bindings.ChannelDetails_set_channel_type(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); - this.ptrs_to.add(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -153,7 +154,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -173,10 +174,11 @@ public class ChannelDetails extends CommonBase { * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid * [`confirmations_required`]: Self::confirmations_required */ - public void set_short_channel_id(Option_u64Z val) { + public void set_short_channel_id(org.ldk.structs.Option_u64Z val) { bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -195,7 +197,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -210,10 +212,11 @@ public class ChannelDetails extends CommonBase { * [`short_channel_id`]: Self::short_channel_id * [`confirmations_required`]: Self::confirmations_required */ - public void set_outbound_scid_alias(Option_u64Z val) { + public void set_outbound_scid_alias(org.ldk.structs.Option_u64Z val) { bindings.ChannelDetails_set_outbound_scid_alias(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -232,7 +235,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -247,10 +250,11 @@ public class ChannelDetails extends CommonBase { * * [`short_channel_id`]: Self::short_channel_id */ - public void set_inbound_scid_alias(Option_u64Z val) { + public void set_inbound_scid_alias(org.ldk.structs.Option_u64Z val) { bindings.ChannelDetails_set_inbound_scid_alias(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -287,7 +291,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -302,28 +306,74 @@ public class ChannelDetails extends CommonBase { * * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ - public void set_unspendable_punishment_reserve(Option_u64Z val) { + public void set_unspendable_punishment_reserve(org.ldk.structs.Option_u64Z val) { bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** - * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ - public long get_user_channel_id() { - long ret = bindings.ChannelDetails_get_user_channel_id(this.ptr); + public UInt128 get_user_channel_id() { + byte[] ret = bindings.ChannelDetails_get_user_channel_id(this.ptr); Reference.reachabilityFence(this); - return ret; + org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret); + return ret_conv; + } + + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + public void set_user_channel_id(org.ldk.util.UInt128 val) { + bindings.ChannelDetails_set_user_channel_id(this.ptr, val.getLEBytes()); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The currently negotiated fee rate denominated in satoshi per 1000 weight units, + * which is applied to commitment and HTLC transactions. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. + */ + public Option_u32Z get_feerate_sat_per_1000_weight() { + long ret = bindings.ChannelDetails_get_feerate_sat_per_1000_weight(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** - * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. + * The currently negotiated fee rate denominated in satoshi per 1000 weight units, + * which is applied to commitment and HTLC transactions. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. */ - public void set_user_channel_id(long val) { - bindings.ChannelDetails_set_user_channel_id(this.ptr, val); + public void set_feerate_sat_per_1000_weight(org.ldk.structs.Option_u32Z val) { + bindings.ChannelDetails_set_feerate_sat_per_1000_weight(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -404,7 +454,8 @@ public class ChannelDetails extends CommonBase { * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us * to use a limit as close as possible to the HTLC limit we can currently send. * - * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`]. + * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], + * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. */ public long get_next_outbound_htlc_limit_msat() { long ret = bindings.ChannelDetails_get_next_outbound_htlc_limit_msat(this.ptr); @@ -418,7 +469,8 @@ public class ChannelDetails extends CommonBase { * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us * to use a limit as close as possible to the HTLC limit we can currently send. * - * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`]. + * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], + * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. */ public void set_next_outbound_htlc_limit_msat(long val) { bindings.ChannelDetails_set_next_outbound_htlc_limit_msat(this.ptr, val); @@ -426,6 +478,30 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(val); } + /** + * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of + * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than + * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a + * route which is valid. + */ + public long get_next_outbound_htlc_minimum_msat() { + long ret = bindings.ChannelDetails_get_next_outbound_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of + * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than + * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a + * route which is valid. + */ + public void set_next_outbound_htlc_minimum_msat(long val) { + bindings.ChannelDetails_set_next_outbound_htlc_minimum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not @@ -478,7 +554,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -495,10 +571,37 @@ public class ChannelDetails extends CommonBase { * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ - public void set_confirmations_required(Option_u32Z val) { + public void set_confirmations_required(org.ldk.structs.Option_u32Z val) { bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; + } + + /** + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + */ + public Option_u32Z get_confirmations() { + long ret = bindings.ChannelDetails_get_confirmations(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + */ + public void set_confirmations(org.ldk.structs.Option_u32Z val) { + bindings.ChannelDetails_set_confirmations(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -515,7 +618,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -528,10 +631,11 @@ public class ChannelDetails extends CommonBase { * * This value will be `None` for outbound channels until the counterparty accepts the channel. */ - public void set_force_close_spend_delay(Option_u16Z val) { + public void set_force_close_spend_delay(org.ldk.structs.Option_u16Z val) { bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -582,6 +686,32 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(val); } + /** + * The stage of the channel's shutdown. + * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + * + * Returns a copy of the field. + */ + public Option_ChannelShutdownStateZ get_channel_shutdown_state() { + long ret = bindings.ChannelDetails_get_channel_shutdown_state(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_ChannelShutdownStateZ ret_hu_conv = org.ldk.structs.Option_ChannelShutdownStateZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * The stage of the channel's shutdown. + * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + */ + public void set_channel_shutdown_state(org.ldk.structs.Option_ChannelShutdownStateZ val) { + bindings.ChannelDetails_set_channel_shutdown_state(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; + } + /** * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) * the peer is connected, and (c) the channel is not currently negotiating a shutdown. @@ -633,7 +763,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -641,10 +771,11 @@ public class ChannelDetails extends CommonBase { * The smallest value HTLC (in msat) we will accept, for this channel. This field * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 */ - public void set_inbound_htlc_minimum_msat(Option_u64Z val) { + public void set_inbound_htlc_minimum_msat(org.ldk.structs.Option_u64Z val) { bindings.ChannelDetails_set_inbound_htlc_minimum_msat(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -655,17 +786,18 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** * The largest value HTLC (in msat) we currently will accept, for this channel. */ - public void set_inbound_htlc_maximum_msat(Option_u64Z val) { + public void set_inbound_htlc_maximum_msat(org.ldk.structs.Option_u64Z val) { bindings.ChannelDetails_set_inbound_htlc_maximum_msat(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -681,7 +813,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -692,18 +824,84 @@ public class ChannelDetails extends CommonBase { * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_config(@Nullable ChannelConfig val) { + public void set_config(@Nullable org.ldk.structs.ChannelConfig val) { bindings.ChannelDetails_set_config(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); - this.ptrs_to.add(val); + if (this != null) { this.ptrs_to.add(val); }; + } + + /** + * Pending inbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. + */ + public InboundHTLCDetails[] get_pending_inbound_htlcs() { + long[] ret = bindings.ChannelDetails_get_pending_inbound_htlcs(this.ptr); + Reference.reachabilityFence(this); + int ret_conv_20_len = ret.length; + InboundHTLCDetails[] ret_conv_20_arr = new InboundHTLCDetails[ret_conv_20_len]; + for (int u = 0; u < ret_conv_20_len; u++) { + long ret_conv_20 = ret[u]; + org.ldk.structs.InboundHTLCDetails ret_conv_20_hu_conv = null; if (ret_conv_20 < 0 || ret_conv_20 > 4096) { ret_conv_20_hu_conv = new org.ldk.structs.InboundHTLCDetails(null, ret_conv_20); } + if (ret_conv_20_hu_conv != null) { ret_conv_20_hu_conv.ptrs_to.add(this); }; + ret_conv_20_arr[u] = ret_conv_20_hu_conv; + } + return ret_conv_20_arr; + } + + /** + * Pending inbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. + */ + public void set_pending_inbound_htlcs(InboundHTLCDetails[] val) { + bindings.ChannelDetails_set_pending_inbound_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_20 -> val_conv_20.ptr).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + for (InboundHTLCDetails val_conv_20: val) { if (this != null) { this.ptrs_to.add(val_conv_20); }; }; + } + + /** + * Pending outbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. + */ + public OutboundHTLCDetails[] get_pending_outbound_htlcs() { + long[] ret = bindings.ChannelDetails_get_pending_outbound_htlcs(this.ptr); + Reference.reachabilityFence(this); + int ret_conv_21_len = ret.length; + OutboundHTLCDetails[] ret_conv_21_arr = new OutboundHTLCDetails[ret_conv_21_len]; + for (int v = 0; v < ret_conv_21_len; v++) { + long ret_conv_21 = ret[v]; + org.ldk.structs.OutboundHTLCDetails ret_conv_21_hu_conv = null; if (ret_conv_21 < 0 || ret_conv_21 > 4096) { ret_conv_21_hu_conv = new org.ldk.structs.OutboundHTLCDetails(null, ret_conv_21); } + if (ret_conv_21_hu_conv != null) { ret_conv_21_hu_conv.ptrs_to.add(this); }; + ret_conv_21_arr[v] = ret_conv_21_hu_conv; + } + return ret_conv_21_arr; + } + + /** + * Pending outbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. + */ + public void set_pending_outbound_htlcs(OutboundHTLCDetails[] val) { + bindings.ChannelDetails_set_pending_outbound_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_21 -> val_conv_21.ptr).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + for (OutboundHTLCDetails val_conv_21: val) { if (this != null) { this.ptrs_to.add(val_conv_21); }; }; } /** * Constructs a new ChannelDetails given each field + * + * Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static ChannelDetails of(byte[] channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, ChannelTypeFeatures channel_type_arg, Option_u64Z short_channel_id_arg, Option_u64Z outbound_scid_alias_arg, Option_u64Z inbound_scid_alias_arg, long channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, long user_channel_id_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long next_outbound_htlc_limit_msat_arg, long inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_channel_ready_arg, boolean is_usable_arg, boolean is_public_arg, Option_u64Z inbound_htlc_minimum_msat_arg, Option_u64Z inbound_htlc_maximum_msat_arg, ChannelConfig config_arg) { - long ret = bindings.ChannelDetails_new(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, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_channel_ready_arg, 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); + public static ChannelDetails of(org.ldk.structs.ChannelId channel_id_arg, org.ldk.structs.ChannelCounterparty counterparty_arg, @Nullable org.ldk.structs.OutPoint funding_txo_arg, @Nullable 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, boolean is_outbound_arg, boolean is_channel_ready_arg, org.ldk.structs.Option_ChannelShutdownStateZ channel_shutdown_state_arg, boolean is_usable_arg, boolean is_public_arg, org.ldk.structs.Option_u64Z inbound_htlc_minimum_msat_arg, org.ldk.structs.Option_u64Z inbound_htlc_maximum_msat_arg, @Nullable org.ldk.structs.ChannelConfig config_arg, InboundHTLCDetails[] pending_inbound_htlcs_arg, OutboundHTLCDetails[] pending_outbound_htlcs_arg) { + long ret = bindings.ChannelDetails_new(channel_id_arg.ptr, 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, 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, pending_inbound_htlcs_arg != null ? Arrays.stream(pending_inbound_htlcs_arg).mapToLong(pending_inbound_htlcs_arg_conv_20 -> pending_inbound_htlcs_arg_conv_20.ptr).toArray() : null, pending_outbound_htlcs_arg != null ? Arrays.stream(pending_outbound_htlcs_arg).mapToLong(pending_outbound_htlcs_arg_conv_21 -> pending_outbound_htlcs_arg_conv_21.ptr).toArray() : null); Reference.reachabilityFence(channel_id_arg); Reference.reachabilityFence(counterparty_arg); Reference.reachabilityFence(funding_txo_arg); @@ -714,26 +912,46 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(channel_value_satoshis_arg); Reference.reachabilityFence(unspendable_punishment_reserve_arg); Reference.reachabilityFence(user_channel_id_arg); + Reference.reachabilityFence(feerate_sat_per_1000_weight_arg); Reference.reachabilityFence(balance_msat_arg); Reference.reachabilityFence(outbound_capacity_msat_arg); Reference.reachabilityFence(next_outbound_htlc_limit_msat_arg); + Reference.reachabilityFence(next_outbound_htlc_minimum_msat_arg); Reference.reachabilityFence(inbound_capacity_msat_arg); Reference.reachabilityFence(confirmations_required_arg); + Reference.reachabilityFence(confirmations_arg); Reference.reachabilityFence(force_close_spend_delay_arg); Reference.reachabilityFence(is_outbound_arg); Reference.reachabilityFence(is_channel_ready_arg); + Reference.reachabilityFence(channel_shutdown_state_arg); Reference.reachabilityFence(is_usable_arg); Reference.reachabilityFence(is_public_arg); Reference.reachabilityFence(inbound_htlc_minimum_msat_arg); Reference.reachabilityFence(inbound_htlc_maximum_msat_arg); Reference.reachabilityFence(config_arg); + Reference.reachabilityFence(pending_inbound_htlcs_arg); + Reference.reachabilityFence(pending_outbound_htlcs_arg); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(counterparty_arg); - ret_hu_conv.ptrs_to.add(funding_txo_arg); - ret_hu_conv.ptrs_to.add(channel_type_arg); - ret_hu_conv.ptrs_to.add(config_arg); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(counterparty_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_scid_alias_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_scid_alias_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(unspendable_punishment_reserve_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(feerate_sat_per_1000_weight_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(confirmations_required_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(confirmations_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(force_close_spend_delay_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_shutdown_state_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_htlc_minimum_msat_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_htlc_maximum_msat_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(config_arg); }; + for (InboundHTLCDetails pending_inbound_htlcs_arg_conv_20: pending_inbound_htlcs_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(pending_inbound_htlcs_arg_conv_20); }; }; + for (OutboundHTLCDetails pending_outbound_htlcs_arg_conv_21: pending_outbound_htlcs_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(pending_outbound_htlcs_arg_conv_21); }; }; return ret_hu_conv; } @@ -751,7 +969,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -768,7 +986,7 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -779,13 +997,15 @@ public class ChannelDetails extends CommonBase { * * This is either the [`ChannelDetails::short_channel_id`], if set, or the * [`ChannelDetails::outbound_scid_alias`]. See those for more information. + * + * [`Route`]: crate::routing::router::Route */ public Option_u64Z get_outbound_payment_scid() { long ret = bindings.ChannelDetails_get_outbound_payment_scid(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; }