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 Channel's funding transaction output, if we've negotiated the funding transaction with
44 * our counterparty already.
46 * Note that, if this has been set, `channel_id` will be equivalent to
47 * `funding_txo.unwrap().to_channel_id()`.
49 public OutPoint get_funding_txo() {
50 long ret = bindings.ChannelDetails_get_funding_txo(this.ptr);
51 OutPoint ret_hu_conv = new OutPoint(null, ret);
52 ret_hu_conv.ptrs_to.add(this);
57 * The Channel's funding transaction output, if we've negotiated the funding transaction with
58 * our counterparty already.
60 * Note that, if this has been set, `channel_id` will be equivalent to
61 * `funding_txo.unwrap().to_channel_id()`.
63 public void set_funding_txo(OutPoint val) {
64 bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr & ~1);
65 this.ptrs_to.add(val);
69 * The position of the funding transaction in the chain. None if the funding transaction has
70 * not yet been confirmed and the channel fully opened.
72 public Option_u64Z get_short_channel_id() {
73 long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr);
74 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
75 ret_hu_conv.ptrs_to.add(this);
80 * The position of the funding transaction in the chain. None if the funding transaction has
81 * not yet been confirmed and the channel fully opened.
83 public void set_short_channel_id(Option_u64Z val) {
84 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
88 * The node_id of our counterparty
90 public byte[] get_remote_network_id() {
91 byte[] ret = bindings.ChannelDetails_get_remote_network_id(this.ptr);
96 * The node_id of our counterparty
98 public void set_remote_network_id(byte[] val) {
99 bindings.ChannelDetails_set_remote_network_id(this.ptr, val);
103 * The Features the channel counterparty provided upon last connection.
104 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
105 * many routing-relevant features are present in the init context.
107 public InitFeatures get_counterparty_features() {
108 long ret = bindings.ChannelDetails_get_counterparty_features(this.ptr);
109 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
110 ret_hu_conv.ptrs_to.add(this);
115 * The Features the channel counterparty provided upon last connection.
116 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
117 * many routing-relevant features are present in the init context.
119 public void set_counterparty_features(InitFeatures val) {
120 bindings.ChannelDetails_set_counterparty_features(this.ptr, val == null ? 0 : val.ptr & ~1);
121 this.ptrs_to.add(val);
125 * The value, in satoshis, of this channel as appears in the funding output
127 public long get_channel_value_satoshis() {
128 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
133 * The value, in satoshis, of this channel as appears in the funding output
135 public void set_channel_value_satoshis(long val) {
136 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
140 * The user_id passed in to create_channel, or 0 if the channel was inbound.
142 public long get_user_id() {
143 long ret = bindings.ChannelDetails_get_user_id(this.ptr);
148 * The user_id passed in to create_channel, or 0 if the channel was inbound.
150 public void set_user_id(long val) {
151 bindings.ChannelDetails_set_user_id(this.ptr, val);
155 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
156 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
157 * available for inclusion in new outbound HTLCs). This further does not include any pending
158 * outgoing HTLCs which are awaiting some other resolution to be sent.
160 public long get_outbound_capacity_msat() {
161 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
166 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
167 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
168 * available for inclusion in new outbound HTLCs). This further does not include any pending
169 * outgoing HTLCs which are awaiting some other resolution to be sent.
171 public void set_outbound_capacity_msat(long val) {
172 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
176 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
177 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
178 * available for inclusion in new inbound HTLCs).
179 * Note that there are some corner cases not fully handled here, so the actual available
180 * inbound capacity may be slightly higher than this.
182 public long get_inbound_capacity_msat() {
183 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
188 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
189 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
190 * available for inclusion in new inbound HTLCs).
191 * Note that there are some corner cases not fully handled here, so the actual available
192 * inbound capacity may be slightly higher than this.
194 public void set_inbound_capacity_msat(long val) {
195 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
199 * True if the channel was initiated (and thus funded) by us.
201 public boolean get_is_outbound() {
202 boolean ret = bindings.ChannelDetails_get_is_outbound(this.ptr);
207 * True if the channel was initiated (and thus funded) by us.
209 public void set_is_outbound(boolean val) {
210 bindings.ChannelDetails_set_is_outbound(this.ptr, val);
214 * True if the channel is confirmed, funding_locked messages have been exchanged, and the
215 * channel is not currently being shut down. `funding_locked` message exchange implies the
216 * required confirmation count has been reached (and we were connected to the peer at some
217 * point after the funding transaction received enough confirmations).
219 public boolean get_is_funding_locked() {
220 boolean ret = bindings.ChannelDetails_get_is_funding_locked(this.ptr);
225 * True if the channel is confirmed, funding_locked messages have been exchanged, and the
226 * channel is not currently being shut down. `funding_locked` message exchange implies the
227 * required confirmation count has been reached (and we were connected to the peer at some
228 * point after the funding transaction received enough confirmations).
230 public void set_is_funding_locked(boolean val) {
231 bindings.ChannelDetails_set_is_funding_locked(this.ptr, val);
235 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
236 * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
237 * channel is not currently negotiating a shutdown.
239 * This is a strict superset of `is_funding_locked`.
241 public boolean get_is_usable() {
242 boolean ret = bindings.ChannelDetails_get_is_usable(this.ptr);
247 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
248 * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
249 * channel is not currently negotiating a shutdown.
251 * This is a strict superset of `is_funding_locked`.
253 public void set_is_usable(boolean val) {
254 bindings.ChannelDetails_set_is_usable(this.ptr, val);
258 * True if this channel is (or will be) publicly-announced.
260 public boolean get_is_public() {
261 boolean ret = bindings.ChannelDetails_get_is_public(this.ptr);
266 * True if this channel is (or will be) publicly-announced.
268 public void set_is_public(boolean val) {
269 bindings.ChannelDetails_set_is_public(this.ptr, val);
273 * Creates a copy of the ChannelDetails
275 public ChannelDetails clone() {
276 long ret = bindings.ChannelDetails_clone(this.ptr);
277 ChannelDetails ret_hu_conv = new ChannelDetails(null, ret);
278 ret_hu_conv.ptrs_to.add(this);