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 * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
13 * source node to a target node.
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class DirectedChannelInfo extends CommonBase {
17 DirectedChannelInfo(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.DirectedChannelInfo_free(ptr); }
25 long ret = bindings.DirectedChannelInfo_clone_ptr(this.ptr);
26 Reference.reachabilityFence(this);
31 * Creates a copy of the DirectedChannelInfo
33 public DirectedChannelInfo clone() {
34 long ret = bindings.DirectedChannelInfo_clone(this.ptr);
35 Reference.reachabilityFence(this);
36 if (ret >= 0 && ret <= 4096) { return null; }
37 org.ldk.structs.DirectedChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelInfo(null, ret); }
38 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
43 * Returns information for the channel.
45 public ChannelInfo channel() {
46 long ret = bindings.DirectedChannelInfo_channel(this.ptr);
47 Reference.reachabilityFence(this);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelInfo(null, ret); }
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
55 * Returns the maximum HTLC amount allowed over the channel in the direction.
57 public long htlc_maximum_msat() {
58 long ret = bindings.DirectedChannelInfo_htlc_maximum_msat(this.ptr);
59 Reference.reachabilityFence(this);
64 * Returns the [`EffectiveCapacity`] of the channel in the direction.
66 * This is either the total capacity from the funding transaction, if known, or the
67 * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
70 public EffectiveCapacity effective_capacity() {
71 long ret = bindings.DirectedChannelInfo_effective_capacity(this.ptr);
72 Reference.reachabilityFence(this);
73 if (ret >= 0 && ret <= 4096) { return null; }
74 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
75 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };