6 namespace org { namespace ldk { namespace structs {
10 * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for
11 * in-use channel liquidity.
13 public class InFlightHtlcs : CommonBase {
14 internal InFlightHtlcs(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.InFlightHtlcs_free(ptr); }
19 internal long clone_ptr() {
20 long ret = bindings.InFlightHtlcs_clone_ptr(this.ptr);
26 * Creates a copy of the InFlightHtlcs
28 public InFlightHtlcs clone() {
29 long ret = bindings.InFlightHtlcs_clone(this.ptr);
31 if (ret >= 0 && ret <= 4096) { return null; }
32 org.ldk.structs.InFlightHtlcs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InFlightHtlcs(null, ret); }
33 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
38 * Constructs an empty `InFlightHtlcs`.
40 public static InFlightHtlcs of() {
41 long ret = bindings.InFlightHtlcs_new();
42 if (ret >= 0 && ret <= 4096) { return null; }
43 org.ldk.structs.InFlightHtlcs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InFlightHtlcs(null, ret); }
44 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
49 * Returns liquidity in msat given the public key of the HTLC source, target, and short channel
52 public Option_u64Z used_liquidity_msat(org.ldk.structs.NodeId source, org.ldk.structs.NodeId target, long channel_scid) {
53 long ret = bindings.InFlightHtlcs_used_liquidity_msat(this.ptr, source == null ? 0 : source.ptr, target == null ? 0 : target.ptr, channel_scid);
57 GC.KeepAlive(channel_scid);
58 if (ret >= 0 && ret <= 4096) { return null; }
59 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
60 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
61 if (this != null) { this.ptrs_to.AddLast(source); };
62 if (this != null) { this.ptrs_to.AddLast(target); };
67 * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read
69 public byte[] write() {
70 byte[] ret = bindings.InFlightHtlcs_write(this.ptr);
76 * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
78 public static Result_InFlightHtlcsDecodeErrorZ read(byte[] ser) {
79 long ret = bindings.InFlightHtlcs_read(ser);
81 if (ret >= 0 && ret <= 4096) { return null; }
82 Result_InFlightHtlcsDecodeErrorZ ret_hu_conv = Result_InFlightHtlcsDecodeErrorZ.constr_from_ptr(ret);