Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / ScoringParameters.java
diff --git a/src/main/java/org/ldk/structs/ScoringParameters.java b/src/main/java/org/ldk/structs/ScoringParameters.java
new file mode 100644 (file)
index 0000000..eccd438
--- /dev/null
@@ -0,0 +1,133 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * Parameters for configuring [`Scorer`].
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class ScoringParameters extends CommonBase {
+       ScoringParameters(Object _dummy, long ptr) { super(ptr); }
+       @Override @SuppressWarnings("deprecation")
+       protected void finalize() throws Throwable {
+               super.finalize();
+               if (ptr != 0) { bindings.ScoringParameters_free(ptr); }
+       }
+
+       /**
+        * A fixed penalty in msats to apply to each channel.
+        */
+       public long get_base_penalty_msat() {
+               long ret = bindings.ScoringParameters_get_base_penalty_msat(this.ptr);
+               return ret;
+       }
+
+       /**
+        * A fixed penalty in msats to apply to each channel.
+        */
+       public void set_base_penalty_msat(long val) {
+               bindings.ScoringParameters_set_base_penalty_msat(this.ptr, val);
+       }
+
+       /**
+        * A penalty in msats to apply to a channel upon failing to relay a payment.
+        * 
+        * This accumulates for each failure but may be reduced over time based on
+        * [`failure_penalty_half_life`].
+        * 
+        * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+        */
+       public long get_failure_penalty_msat() {
+               long ret = bindings.ScoringParameters_get_failure_penalty_msat(this.ptr);
+               return ret;
+       }
+
+       /**
+        * A penalty in msats to apply to a channel upon failing to relay a payment.
+        * 
+        * This accumulates for each failure but may be reduced over time based on
+        * [`failure_penalty_half_life`].
+        * 
+        * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
+        */
+       public void set_failure_penalty_msat(long val) {
+               bindings.ScoringParameters_set_failure_penalty_msat(this.ptr, val);
+       }
+
+       /**
+        * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+        * cut in half.
+        * 
+        * # Note
+        * 
+        * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
+        * elapse. Therefore, this penalty will never decay.
+        * 
+        * [`failure_penalty_msat`]: Self::failure_penalty_msat
+        */
+       public long get_failure_penalty_half_life() {
+               long ret = bindings.ScoringParameters_get_failure_penalty_half_life(this.ptr);
+               return ret;
+       }
+
+       /**
+        * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
+        * cut in half.
+        * 
+        * # Note
+        * 
+        * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
+        * elapse. Therefore, this penalty will never decay.
+        * 
+        * [`failure_penalty_msat`]: Self::failure_penalty_msat
+        */
+       public void set_failure_penalty_half_life(long val) {
+               bindings.ScoringParameters_set_failure_penalty_half_life(this.ptr, val);
+       }
+
+       /**
+        * Constructs a new ScoringParameters given each field
+        */
+       public static ScoringParameters of(long base_penalty_msat_arg, long failure_penalty_msat_arg, long failure_penalty_half_life_arg) {
+               long ret = bindings.ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               ScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ScoringParameters(null, ret); }
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.ScoringParameters_write(this.ptr);
+               return ret;
+       }
+
+       /**
+        * Read a ScoringParameters from a byte array, created by ScoringParameters_write
+        */
+       public static Result_ScoringParametersDecodeErrorZ read(byte[] ser) {
+               long ret = bindings.ScoringParameters_read(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
+        */
+       public static ScoringParameters with_default() {
+               long ret = bindings.ScoringParameters_default();
+               if (ret >= 0 && ret <= 4096) { return null; }
+               ScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ScoringParameters(null, ret); }
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+}