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 * [`Score`] implementation that factors in in-flight HTLC liquidity.
14 * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling
17 * [`Score`]: crate::routing::scoring::Score
19 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
20 public class ScorerAccountingForInFlightHtlcs extends CommonBase {
21 ScorerAccountingForInFlightHtlcs(Object _dummy, long ptr) { super(ptr); }
22 @Override @SuppressWarnings("deprecation")
23 protected void finalize() throws Throwable {
25 if (ptr != 0) { bindings.ScorerAccountingForInFlightHtlcs_free(ptr); }
29 * Initialize a new `ScorerAccountingForInFlightHtlcs`.
31 public static ScorerAccountingForInFlightHtlcs of(org.ldk.structs.Score scorer, org.ldk.structs.InFlightHtlcs inflight_htlcs) {
32 long ret = bindings.ScorerAccountingForInFlightHtlcs_new(scorer == null ? 0 : scorer.ptr, inflight_htlcs == null ? 0 : inflight_htlcs.ptr);
33 Reference.reachabilityFence(scorer);
34 Reference.reachabilityFence(inflight_htlcs);
35 if (ret >= 0 && ret <= 4096) { return null; }
36 org.ldk.structs.ScorerAccountingForInFlightHtlcs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ScorerAccountingForInFlightHtlcs(null, ret); }
37 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
38 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); };
39 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inflight_htlcs); };
44 * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read
46 public byte[] write() {
47 byte[] ret = bindings.ScorerAccountingForInFlightHtlcs_write(this.ptr);
48 Reference.reachabilityFence(this);
53 * Constructs a new Score which calls the relevant methods on this_arg.
54 * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
56 public Score as_Score() {
57 long ret = bindings.ScorerAccountingForInFlightHtlcs_as_Score(this.ptr);
58 Reference.reachabilityFence(this);
59 if (ret >= 0 && ret <= 4096) { return null; }
60 Score ret_hu_conv = new Score(null, ret);
61 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };