1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class ChannelDetails extends CommonBase {
14 ChannelDetails(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.ChannelDetails_free(ptr); }
22 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
23 * thereafter this is the txid of the funding transaction xor the funding transaction output).
24 * Note that this means this value is *not* persistent - it can change once during the
25 * lifetime of the channel.
27 public byte[] get_channel_id() {
28 byte[] ret = bindings.ChannelDetails_get_channel_id(this.ptr);
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, val);
43 * The node_id of our counterparty
45 public byte[] get_remote_network_id() {
46 byte[] ret = bindings.ChannelDetails_get_remote_network_id(this.ptr);
51 * The node_id of our counterparty
53 public void set_remote_network_id(byte[] val) {
54 bindings.ChannelDetails_set_remote_network_id(this.ptr, val);
58 * The Features the channel counterparty provided upon last connection.
59 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
60 * many routing-relevant features are present in the init context.
62 public InitFeatures get_counterparty_features() {
63 long ret = bindings.ChannelDetails_get_counterparty_features(this.ptr);
64 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
65 ret_hu_conv.ptrs_to.add(this);
70 * The Features the channel counterparty provided upon last connection.
71 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
72 * many routing-relevant features are present in the init context.
74 public void set_counterparty_features(InitFeatures val) {
75 bindings.ChannelDetails_set_counterparty_features(this.ptr, val == null ? 0 : val.ptr & ~1);
76 this.ptrs_to.add(val);
80 * The value, in satoshis, of this channel as appears in the funding output
82 public long get_channel_value_satoshis() {
83 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
88 * The value, in satoshis, of this channel as appears in the funding output
90 public void set_channel_value_satoshis(long val) {
91 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
95 * The user_id passed in to create_channel, or 0 if the channel was inbound.
97 public long get_user_id() {
98 long ret = bindings.ChannelDetails_get_user_id(this.ptr);
103 * The user_id passed in to create_channel, or 0 if the channel was inbound.
105 public void set_user_id(long val) {
106 bindings.ChannelDetails_set_user_id(this.ptr, val);
110 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
111 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
112 * available for inclusion in new outbound HTLCs). This further does not include any pending
113 * outgoing HTLCs which are awaiting some other resolution to be sent.
115 public long get_outbound_capacity_msat() {
116 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
121 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
122 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
123 * available for inclusion in new outbound HTLCs). This further does not include any pending
124 * outgoing HTLCs which are awaiting some other resolution to be sent.
126 public void set_outbound_capacity_msat(long val) {
127 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
131 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
132 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
133 * available for inclusion in new inbound HTLCs).
134 * Note that there are some corner cases not fully handled here, so the actual available
135 * inbound capacity may be slightly higher than this.
137 public long get_inbound_capacity_msat() {
138 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
143 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
144 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
145 * available for inclusion in new inbound HTLCs).
146 * Note that there are some corner cases not fully handled here, so the actual available
147 * inbound capacity may be slightly higher than this.
149 public void set_inbound_capacity_msat(long val) {
150 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
154 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
155 * the peer is connected, and (c) no monitor update failure is pending resolution.
157 public boolean get_is_live() {
158 boolean ret = bindings.ChannelDetails_get_is_live(this.ptr);
163 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
164 * the peer is connected, and (c) no monitor update failure is pending resolution.
166 public void set_is_live(boolean val) {
167 bindings.ChannelDetails_set_is_live(this.ptr, val);
171 * Creates a copy of the ChannelDetails
173 public ChannelDetails clone() {
174 long ret = bindings.ChannelDetails_clone(this.ptr);
175 ChannelDetails ret_hu_conv = new ChannelDetails(null, ret);
176 ret_hu_conv.ptrs_to.add(this);