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 position of the funding transaction in the chain. None if the funding transaction has
44 * not yet been confirmed and the channel fully opened.
46 public Option_u64Z get_short_channel_id() {
47 long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr);
48 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
49 ret_hu_conv.ptrs_to.add(this);
54 * The position of the funding transaction in the chain. None if the funding transaction has
55 * not yet been confirmed and the channel fully opened.
57 public void set_short_channel_id(Option_u64Z val) {
58 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
62 * The node_id of our counterparty
64 public byte[] get_remote_network_id() {
65 byte[] ret = bindings.ChannelDetails_get_remote_network_id(this.ptr);
70 * The node_id of our counterparty
72 public void set_remote_network_id(byte[] val) {
73 bindings.ChannelDetails_set_remote_network_id(this.ptr, val);
77 * The Features the channel counterparty provided upon last connection.
78 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
79 * many routing-relevant features are present in the init context.
81 public InitFeatures get_counterparty_features() {
82 long ret = bindings.ChannelDetails_get_counterparty_features(this.ptr);
83 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
84 ret_hu_conv.ptrs_to.add(this);
89 * The Features the channel counterparty provided upon last connection.
90 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
91 * many routing-relevant features are present in the init context.
93 public void set_counterparty_features(InitFeatures val) {
94 bindings.ChannelDetails_set_counterparty_features(this.ptr, val == null ? 0 : val.ptr & ~1);
95 this.ptrs_to.add(val);
99 * The value, in satoshis, of this channel as appears in the funding output
101 public long get_channel_value_satoshis() {
102 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
107 * The value, in satoshis, of this channel as appears in the funding output
109 public void set_channel_value_satoshis(long val) {
110 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
114 * The user_id passed in to create_channel, or 0 if the channel was inbound.
116 public long get_user_id() {
117 long ret = bindings.ChannelDetails_get_user_id(this.ptr);
122 * The user_id passed in to create_channel, or 0 if the channel was inbound.
124 public void set_user_id(long val) {
125 bindings.ChannelDetails_set_user_id(this.ptr, val);
129 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
130 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
131 * available for inclusion in new outbound HTLCs). This further does not include any pending
132 * outgoing HTLCs which are awaiting some other resolution to be sent.
134 public long get_outbound_capacity_msat() {
135 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
140 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
141 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
142 * available for inclusion in new outbound HTLCs). This further does not include any pending
143 * outgoing HTLCs which are awaiting some other resolution to be sent.
145 public void set_outbound_capacity_msat(long val) {
146 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
150 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
151 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
152 * available for inclusion in new inbound HTLCs).
153 * Note that there are some corner cases not fully handled here, so the actual available
154 * inbound capacity may be slightly higher than this.
156 public long get_inbound_capacity_msat() {
157 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
162 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
163 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
164 * available for inclusion in new inbound HTLCs).
165 * Note that there are some corner cases not fully handled here, so the actual available
166 * inbound capacity may be slightly higher than this.
168 public void set_inbound_capacity_msat(long val) {
169 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
173 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
174 * the peer is connected, and (c) no monitor update failure is pending resolution.
176 public boolean get_is_live() {
177 boolean ret = bindings.ChannelDetails_get_is_live(this.ptr);
182 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
183 * the peer is connected, and (c) no monitor update failure is pending resolution.
185 public void set_is_live(boolean val) {
186 bindings.ChannelDetails_set_is_live(this.ptr, val);
190 * Creates a copy of the ChannelDetails
192 public ChannelDetails clone() {
193 long ret = bindings.ChannelDetails_clone(this.ptr);
194 ChannelDetails ret_hu_conv = new ChannelDetails(null, ret);
195 ret_hu_conv.ptrs_to.add(this);