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 [`EffectiveCapacity`] of the channel in the direction.
57 * This is either the total capacity from the funding transaction, if known, or the
58 * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
61 public EffectiveCapacity effective_capacity() {
62 long ret = bindings.DirectedChannelInfo_effective_capacity(this.ptr);
63 Reference.reachabilityFence(this);
64 if (ret >= 0 && ret <= 4096) { return null; }
65 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
66 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
71 * Returns the `node_id` of the source hop.
73 * Refers to the `node_id` forwarding the payment to the next hop.
75 public NodeId source() {
76 long ret = bindings.DirectedChannelInfo_source(this.ptr);
77 Reference.reachabilityFence(this);
78 if (ret >= 0 && ret <= 4096) { return null; }
79 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
80 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
85 * Returns the `node_id` of the target hop.
87 * Refers to the `node_id` receiving the payment from the previous hop.
89 public NodeId target() {
90 long ret = bindings.DirectedChannelInfo_target(this.ptr);
91 Reference.reachabilityFence(this);
92 if (ret >= 0 && ret <= 4096) { return null; }
93 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
94 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };