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 * Proposed use of a channel passed as a parameter to [`ScoreLookUp::channel_penalty_msat`].
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelUsage extends CommonBase {
16 ChannelUsage(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.ChannelUsage_free(ptr); }
24 * The amount to send through the channel, denominated in millisatoshis.
26 public long get_amount_msat() {
27 long ret = bindings.ChannelUsage_get_amount_msat(this.ptr);
28 Reference.reachabilityFence(this);
33 * The amount to send through the channel, denominated in millisatoshis.
35 public void set_amount_msat(long val) {
36 bindings.ChannelUsage_set_amount_msat(this.ptr, val);
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * Total amount, denominated in millisatoshis, already allocated to send through the channel
43 * as part of a multi-path payment.
45 public long get_inflight_htlc_msat() {
46 long ret = bindings.ChannelUsage_get_inflight_htlc_msat(this.ptr);
47 Reference.reachabilityFence(this);
52 * Total amount, denominated in millisatoshis, already allocated to send through the channel
53 * as part of a multi-path payment.
55 public void set_inflight_htlc_msat(long val) {
56 bindings.ChannelUsage_set_inflight_htlc_msat(this.ptr, val);
57 Reference.reachabilityFence(this);
58 Reference.reachabilityFence(val);
62 * The effective capacity of the channel.
64 public EffectiveCapacity get_effective_capacity() {
65 long ret = bindings.ChannelUsage_get_effective_capacity(this.ptr);
66 Reference.reachabilityFence(this);
67 if (ret >= 0 && ret <= 4096) { return null; }
68 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
74 * The effective capacity of the channel.
76 public void set_effective_capacity(org.ldk.structs.EffectiveCapacity val) {
77 bindings.ChannelUsage_set_effective_capacity(this.ptr, val.ptr);
78 Reference.reachabilityFence(this);
79 Reference.reachabilityFence(val);
80 if (this != null) { this.ptrs_to.add(val); };
84 * Constructs a new ChannelUsage given each field
86 public static ChannelUsage of(long amount_msat_arg, long inflight_htlc_msat_arg, org.ldk.structs.EffectiveCapacity effective_capacity_arg) {
87 long ret = bindings.ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg.ptr);
88 Reference.reachabilityFence(amount_msat_arg);
89 Reference.reachabilityFence(inflight_htlc_msat_arg);
90 Reference.reachabilityFence(effective_capacity_arg);
91 if (ret >= 0 && ret <= 4096) { return null; }
92 org.ldk.structs.ChannelUsage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUsage(null, ret); }
93 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
94 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(effective_capacity_arg); };
99 long ret = bindings.ChannelUsage_clone_ptr(this.ptr);
100 Reference.reachabilityFence(this);
105 * Creates a copy of the ChannelUsage
107 public ChannelUsage clone() {
108 long ret = bindings.ChannelUsage_clone(this.ptr);
109 Reference.reachabilityFence(this);
110 if (ret >= 0 && ret <= 4096) { return null; }
111 org.ldk.structs.ChannelUsage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUsage(null, ret); }
112 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };