From: Matt Corallo Date: Wed, 23 Mar 2022 02:36:43 +0000 (+0000) Subject: [Java] Update auto-generated bindings to include ProbabilisticScorer X-Git-Tag: v0.0.105.1~1^2~3 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=0b8301f0f38cb9f98d7b0d0f341fc3049ca5fa3e;p=ldk-java [Java] Update auto-generated bindings to include ProbabilisticScorer --- diff --git a/src/main/java/org/ldk/enums/Recipient.java b/src/main/java/org/ldk/enums/Recipient.java new file mode 100644 index 00000000..fb51877c --- /dev/null +++ b/src/main/java/org/ldk/enums/Recipient.java @@ -0,0 +1,21 @@ +package org.ldk.enums; + +/** + * Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node + * secret key should be used to sign the invoice. + */ +public enum Recipient { + /** + * The invoice should be signed with the local node secret key. + */ + LDKRecipient_Node, + /** + * The invoice should be signed with the phantom node secret key. This secret key must be the + * same for all nodes participating in the [phantom node payment]. + * + * [phantom node payment]: PhantomKeysManager + */ + LDKRecipient_PhantomNode, + ; static native void init(); + static { init(); } +} \ No newline at end of file diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 20b87328..716beb73 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -144,7 +144,7 @@ public class bindings { public static native long CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(long owner); - // struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner); + // struct LDKTrustedClosingTransaction *NONNULL_PTR CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner); public static native long CResult_TrustedClosingTransactionNoneZ_get_ok(long owner); // void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner); public static native void CResult_TrustedClosingTransactionNoneZ_get_err(long owner); @@ -152,7 +152,7 @@ public class bindings { public static native long CResult_CommitmentTransactionDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_CommitmentTransactionDecodeErrorZ_get_err(long owner); - // struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner); + // struct LDKTrustedCommitmentTransaction *NONNULL_PTR CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner); public static native long CResult_TrustedCommitmentTransactionNoneZ_get_ok(long owner); // void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner); public static native void CResult_TrustedCommitmentTransactionNoneZ_get_err(long owner); @@ -609,7 +609,7 @@ public class bindings { public static native long CResult_ScoringParametersDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ScoringParametersDecodeErrorZ_get_err(long owner); - // struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner); + // struct LDKScorer *NONNULL_PTR CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ScorerDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ScorerDecodeErrorZ_get_err(long owner); @@ -617,6 +617,14 @@ public class bindings { public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(long owner); + // struct LDKProbabilisticScoringParameters C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner); + public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(long owner); + // struct LDKNetworkGraph C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner); + public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(long owner); + // struct LDKProbabilisticScorer *NONNULL_PTR CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ProbabilisticScorerDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ProbabilisticScorerDecodeErrorZ_get_err(long owner); // struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_InitFeaturesDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner); @@ -967,9 +975,9 @@ public class bindings { public static native long LDKLogger_new(LDKLogger impl); // struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner); public static native byte[] C2Tuple_BlockHashChannelManagerZ_get_a(long owner); - // struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner); + // struct LDKChannelManager *NONNULL_PTR C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner); public static native long C2Tuple_BlockHashChannelManagerZ_get_b(long owner); - // struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner); + // struct LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(long owner); @@ -1421,7 +1429,7 @@ public class bindings { } static { LDKCOption_FilterZ.init(); } public static native LDKCOption_FilterZ LDKCOption_FilterZ_ref_from_ptr(long ptr); - // struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner); + // struct LDKLockedChannelMonitor *NONNULL_PTR CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner); public static native long CResult_LockedChannelMonitorNoneZ_get_ok(long owner); // void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner); public static native void CResult_LockedChannelMonitorNoneZ_get_err(long owner); @@ -2208,6 +2216,22 @@ public class bindings { public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(long orig); + // uintptr_t C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR arg); + public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(long arg); + // struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(const struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR orig); + public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(long orig); + // struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(struct LDKProbabilisticScoringParameters a, const struct LDKNetworkGraph *NONNULL_PTR b); + public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(long a, long b); + // void C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ _res); + public static native void C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(long _res); + // struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); + public static native long CResult_ProbabilisticScorerDecodeErrorZ_ok(long o); + // struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ProbabilisticScorerDecodeErrorZ_err(long e); + // bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ProbabilisticScorerDecodeErrorZ_is_ok(long o); + // void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res); + public static native void CResult_ProbabilisticScorerDecodeErrorZ_free(long _res); // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); public static native long CResult_InitFeaturesDecodeErrorZ_ok(long o); // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); @@ -6696,6 +6720,8 @@ public class bindings { public static native byte[] Scorer_write(long obj); // struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser); public static native long Scorer_read(byte[] ser); + // void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj); + public static native void ProbabilisticScorer_free(long this_obj); // void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj); public static native void ProbabilisticScoringParameters_free(long this_obj); // uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); @@ -6716,8 +6742,16 @@ public class bindings { public static native byte[] ProbabilisticScoringParameters_write(long obj); // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ ProbabilisticScoringParameters_read(struct LDKu8slice ser); public static native long ProbabilisticScoringParameters_read(byte[] ser); + // MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph); + public static native long ProbabilisticScorer_new(long params, long network_graph); // MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void); public static native long ProbabilisticScoringParameters_default(); + // struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); + public static native long ProbabilisticScorer_as_Score(long this_arg); + // struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj); + public static native byte[] ProbabilisticScorer_write(long obj); + // struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ arg); + public static native long ProbabilisticScorer_read(byte[] ser, long arg); // void FilesystemPersister_free(struct LDKFilesystemPersister this_obj); public static native void FilesystemPersister_free(long this_obj); // MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data); diff --git a/src/main/java/org/ldk/structs/ProbabilisticScorer.java b/src/main/java/org/ldk/structs/ProbabilisticScorer.java new file mode 100644 index 00000000..effcc77d --- /dev/null +++ b/src/main/java/org/ldk/structs/ProbabilisticScorer.java @@ -0,0 +1,93 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * [`Score`] implementation using channel success probability distributions. + * + * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt + * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability + * distributions are defined based on knowledge learned from successful and unsuccessful attempts. + * Then the negative `log10` of the success probability is used to determine the cost of routing a + * specific HTLC amount through a channel. + * + * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the + * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See + * [`ProbabilisticScoringParameters`] for details. + * + * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes + * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment + * volume are more likely to experience failed payment paths, which would need to be retried. + * + * # Note + * + * Mixing the `no-std` feature between serialization and deserialization results in undefined + * behavior. + * + * [1]: https://arxiv.org/abs/2107.05322 + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ProbabilisticScorer extends CommonBase { + ProbabilisticScorer(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.ProbabilisticScorer_free(ptr); } + } + + /** + * Creates a new scorer using the given scoring parameters for sending payments from a node + * through a network graph. + */ + public static ProbabilisticScorer of(ProbabilisticScoringParameters params, NetworkGraph network_graph) { + long ret = bindings.ProbabilisticScorer_new(params == null ? 0 : params.ptr & ~1, network_graph == null ? 0 : network_graph.ptr & ~1); + Reference.reachabilityFence(params); + Reference.reachabilityFence(network_graph); + if (ret >= 0 && ret <= 4096) { return null; } + ProbabilisticScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ProbabilisticScorer(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(network_graph); + return ret_hu_conv; + } + + /** + * Constructs a new Score which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is + */ + public Score as_Score() { + long ret = bindings.ProbabilisticScorer_as_Score(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Score ret_hu_conv = new Score(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read + */ + public byte[] write() { + byte[] ret = bindings.ProbabilisticScorer_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write + */ + public static Result_ProbabilisticScorerDecodeErrorZ read(byte[] ser, TwoTuple_ProbabilisticScoringParametersNetworkGraphZ arg) { + long ret = bindings.ProbabilisticScorer_read(ser, arg != null ? arg.ptr : 0); + Reference.reachabilityFence(ser); + Reference.reachabilityFence(arg); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ProbabilisticScorerDecodeErrorZ ret_hu_conv = Result_ProbabilisticScorerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java new file mode 100644 index 00000000..ed67c854 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java @@ -0,0 +1,79 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_ProbabilisticScorerDecodeErrorZ extends CommonBase { + private Result_ProbabilisticScorerDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ProbabilisticScorerDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ProbabilisticScorerDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_ProbabilisticScorerDecodeErrorZ_is_ok(ptr)) { + return new Result_ProbabilisticScorerDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ProbabilisticScorerDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ProbabilisticScorerDecodeErrorZ_OK extends Result_ProbabilisticScorerDecodeErrorZ { + public final ProbabilisticScorer res; + private Result_ProbabilisticScorerDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_ProbabilisticScorerDecodeErrorZ_get_ok(ptr); + ProbabilisticScorer res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ProbabilisticScorer(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_ProbabilisticScorerDecodeErrorZ_Err extends Result_ProbabilisticScorerDecodeErrorZ { + public final DecodeError err; + private Result_ProbabilisticScorerDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_ProbabilisticScorerDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. + */ + public static Result_ProbabilisticScorerDecodeErrorZ ok(ProbabilisticScoringParameters o_params, NetworkGraph o_network_graph) { + long ret = bindings.CResult_ProbabilisticScorerDecodeErrorZ_ok(bindings.ProbabilisticScorer_new(o_params == null ? 0 : o_params.ptr & ~1, o_network_graph == null ? 0 : o_network_graph.ptr & ~1)); + Reference.reachabilityFence(o_params); + Reference.reachabilityFence(o_network_graph); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ProbabilisticScorerDecodeErrorZ ret_hu_conv = Result_ProbabilisticScorerDecodeErrorZ.constr_from_ptr(ret); + ; + ret_hu_conv.ptrs_to.add(o_network_graph); + return ret_hu_conv; + } + + /** + * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. + */ + public static Result_ProbabilisticScorerDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_ProbabilisticScorerDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ProbabilisticScorerDecodeErrorZ ret_hu_conv = Result_ProbabilisticScorerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_ProbabilisticScorerDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/TwoTuple_ProbabilisticScoringParametersNetworkGraphZ.java b/src/main/java/org/ldk/structs/TwoTuple_ProbabilisticScoringParametersNetworkGraphZ.java new file mode 100644 index 00000000..017b3e05 --- /dev/null +++ b/src/main/java/org/ldk/structs/TwoTuple_ProbabilisticScoringParametersNetworkGraphZ.java @@ -0,0 +1,80 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * A Tuple + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class TwoTuple_ProbabilisticScoringParametersNetworkGraphZ extends CommonBase { + TwoTuple_ProbabilisticScoringParametersNetworkGraphZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(ptr); } + } + + /** + * + */ + public ProbabilisticScoringParameters get_a() { + long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ProbabilisticScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ProbabilisticScoringParameters(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * + */ + public NetworkGraph get_b() { + long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + NetworkGraph ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NetworkGraph(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public TwoTuple_ProbabilisticScoringParametersNetworkGraphZ clone() { + long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + TwoTuple_ProbabilisticScoringParametersNetworkGraphZ ret_hu_conv = new TwoTuple_ProbabilisticScoringParametersNetworkGraphZ(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Creates a new C2Tuple_ProbabilisticScoringParametersNetworkGraphZ from the contained elements. + */ + public static TwoTuple_ProbabilisticScoringParametersNetworkGraphZ of(ProbabilisticScoringParameters a, NetworkGraph b) { + long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a == null ? 0 : a.ptr & ~1, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + if (ret >= 0 && ret <= 4096) { return null; } + TwoTuple_ProbabilisticScoringParametersNetworkGraphZ ret_hu_conv = new TwoTuple_ProbabilisticScoringParametersNetworkGraphZ(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(b); + return ret_hu_conv; + } + +} diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 930c0aa6..b203989f 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -1297,7 +1297,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTra return ret_ref; } -static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){ +static inline struct LDKTrustedClosingTransaction *NONNULL_PTR CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -1357,7 +1357,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransact return ret_ref; } -static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){ +static inline struct LDKTrustedCommitmentTransaction *NONNULL_PTR CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -3111,7 +3111,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersD return ret_ref; } -static inline struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKScorer *NONNULL_PTR CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -3180,6 +3180,73 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScori return ret_ref; } +static inline struct LDKProbabilisticScoringParameters C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){ + return ProbabilisticScoringParameters_clone(&owner->a); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1); + LDKProbabilisticScoringParameters ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKNetworkGraph C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){ + return NetworkGraph_clone(&owner->b); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1); + LDKNetworkGraph ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKProbabilisticScorer *NONNULL_PTR CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return &*owner->contents.result; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1); + LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner & ~1; + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return InitFeatures_clone(&*owner->contents.result); @@ -3691,7 +3758,7 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th } LDKHolderCommitmentTransaction holder_tx_var = *holder_tx; int64_t holder_tx_ref = 0; - holder_tx_var = HolderCommitmentTransaction_clone(holder_tx); + holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var); CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var); @@ -3761,7 +3828,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L } LDKCommitmentTransaction commitment_tx_var = *commitment_tx; int64_t commitment_tx_ref = 0; - commitment_tx_var = CommitmentTransaction_clone(commitment_tx); + commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var); CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var); @@ -3834,7 +3901,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl } LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx; int64_t commitment_tx_ref = 0; - commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx); + commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var); CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var); @@ -3906,7 +3973,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key); LDKHTLCOutputInCommitment htlc_var = *htlc; int64_t htlc_ref = 0; - htlc_var = HTLCOutputInCommitment_clone(htlc); + htlc_var = HTLCOutputInCommitment_clone(&htlc_var); CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var); @@ -3947,7 +4014,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form); LDKHTLCOutputInCommitment htlc_var = *htlc; int64_t htlc_ref = 0; - htlc_var = HTLCOutputInCommitment_clone(htlc); + htlc_var = HTLCOutputInCommitment_clone(&htlc_var); CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var); @@ -3982,7 +4049,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* } LDKClosingTransaction closing_tx_var = *closing_tx; int64_t closing_tx_ref = 0; - closing_tx_var = ClosingTransaction_clone(closing_tx); + closing_tx_var = ClosingTransaction_clone(&closing_tx_var); CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var); @@ -4017,7 +4084,7 @@ LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSig } LDKUnsignedChannelAnnouncement msg_var = *msg; int64_t msg_ref = 0; - msg_var = UnsignedChannelAnnouncement_clone(msg); + msg_var = UnsignedChannelAnnouncement_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -4052,7 +4119,7 @@ void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransaction } LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; int64_t channel_parameters_ref = 0; - channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters); + channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var); CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var); @@ -6197,7 +6264,7 @@ void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) { } LDKRecord record_var = *record; int64_t record_ref = 0; - record_var = Record_clone(record); + record_var = Record_clone(&record_var); CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var); @@ -6252,7 +6319,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChann return ret_arr; } -static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){ +static inline struct LDKChannelManager *NONNULL_PTR C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){ return &owner->b; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { @@ -6266,7 +6333,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMa return ret_ref; } -static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -9502,7 +9569,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1f default: abort(); } } -static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){ +static inline struct LDKLockedChannelMonitor *NONNULL_PTR CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -10205,7 +10272,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con } LDKChannelMonitor data_var = *data; int64_t data_ref = 0; - data_var = ChannelMonitor_clone(data); + data_var = ChannelMonitor_clone(&data_var); CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var); @@ -10259,7 +10326,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal LDKChannelMonitorUpdate update_var = *update; int64_t update_ref = 0; if ((uintptr_t)update_var.inner > 4096) { - update_var = ChannelMonitorUpdate_clone(update); + update_var = ChannelMonitorUpdate_clone(&update_var); CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var); @@ -10270,7 +10337,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal } LDKChannelMonitor data_var = *data; int64_t data_ref = 0; - data_var = ChannelMonitor_clone(data); + data_var = ChannelMonitor_clone(&data_var); CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var); @@ -10447,7 +10514,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD } LDKOpenChannel msg_var = *msg; int64_t msg_ref = 0; - msg_var = OpenChannel_clone(msg); + msg_var = OpenChannel_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10488,7 +10555,7 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, } LDKAcceptChannel msg_var = *msg; int64_t msg_ref = 0; - msg_var = AcceptChannel_clone(msg); + msg_var = AcceptChannel_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10520,7 +10587,7 @@ void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingCreated msg_var = *msg; int64_t msg_ref = 0; - msg_var = FundingCreated_clone(msg); + msg_var = FundingCreated_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10552,7 +10619,7 @@ void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingSigned msg_var = *msg; int64_t msg_ref = 0; - msg_var = FundingSigned_clone(msg); + msg_var = FundingSigned_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10584,7 +10651,7 @@ void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingLocked msg_var = *msg; int64_t msg_ref = 0; - msg_var = FundingLocked_clone(msg); + msg_var = FundingLocked_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10616,7 +10683,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInitFeatures their_features_var = *their_features; int64_t their_features_ref = 0; - their_features_var = InitFeatures_clone(their_features); + their_features_var = InitFeatures_clone(&their_features_var); CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); @@ -10626,7 +10693,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub } LDKShutdown msg_var = *msg; int64_t msg_ref = 0; - msg_var = Shutdown_clone(msg); + msg_var = Shutdown_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10658,7 +10725,7 @@ void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKClosingSigned msg_var = *msg; int64_t msg_ref = 0; - msg_var = ClosingSigned_clone(msg); + msg_var = ClosingSigned_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10690,7 +10757,7 @@ void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateAddHTLC msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateAddHTLC_clone(msg); + msg_var = UpdateAddHTLC_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10722,7 +10789,7 @@ void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_ (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFulfillHTLC msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateFulfillHTLC_clone(msg); + msg_var = UpdateFulfillHTLC_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10754,7 +10821,7 @@ void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFailHTLC msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateFailHTLC_clone(msg); + msg_var = UpdateFailHTLC_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10786,7 +10853,7 @@ void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFailMalformedHTLC msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateFailMalformedHTLC_clone(msg); + msg_var = UpdateFailMalformedHTLC_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10818,7 +10885,7 @@ void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_ar (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKCommitmentSigned msg_var = *msg; int64_t msg_ref = 0; - msg_var = CommitmentSigned_clone(msg); + msg_var = CommitmentSigned_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10850,7 +10917,7 @@ void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKRevokeAndACK msg_var = *msg; int64_t msg_ref = 0; - msg_var = RevokeAndACK_clone(msg); + msg_var = RevokeAndACK_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10882,7 +10949,7 @@ void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFee msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateFee_clone(msg); + msg_var = UpdateFee_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10914,7 +10981,7 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKAnnouncementSignatures msg_var = *msg; int64_t msg_ref = 0; - msg_var = AnnouncementSignatures_clone(msg); + msg_var = AnnouncementSignatures_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10968,7 +11035,7 @@ void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPubl (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInit msg_var = *msg; int64_t msg_ref = 0; - msg_var = Init_clone(msg); + msg_var = Init_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11000,7 +11067,7 @@ void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_ (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKChannelReestablish msg_var = *msg; int64_t msg_ref = 0; - msg_var = ChannelReestablish_clone(msg); + msg_var = ChannelReestablish_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11032,7 +11099,7 @@ void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKChannelUpdate msg_var = *msg; int64_t msg_ref = 0; - msg_var = ChannelUpdate_clone(msg); + msg_var = ChannelUpdate_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11064,7 +11131,7 @@ void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublic (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKErrorMessage msg_var = *msg; int64_t msg_ref = 0; - msg_var = ErrorMessage_clone(msg); + msg_var = ErrorMessage_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11509,7 +11576,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler } LDKNodeAnnouncement msg_var = *msg; int64_t msg_ref = 0; - msg_var = NodeAnnouncement_clone(msg); + msg_var = NodeAnnouncement_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11544,7 +11611,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand } LDKChannelAnnouncement msg_var = *msg; int64_t msg_ref = 0; - msg_var = ChannelAnnouncement_clone(msg); + msg_var = ChannelAnnouncement_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11579,7 +11646,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc } LDKChannelUpdate msg_var = *msg; int64_t msg_ref = 0; - msg_var = ChannelUpdate_clone(msg); + msg_var = ChannelUpdate_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11692,7 +11759,7 @@ void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDK (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInit init_var = *init; int64_t init_ref = 0; - init_var = Init_clone(init); + init_var = Init_clone(&init_var); CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var); @@ -12612,7 +12679,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } LDKNodeId source_var = *source; int64_t source_ref = 0; - source_var = NodeId_clone(source); + source_var = NodeId_clone(&source_var); CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var); @@ -12622,7 +12689,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } LDKNodeId target_var = *target; int64_t target_ref = 0; - target_var = NodeId_clone(target); + target_var = NodeId_clone(&target_var); CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var); @@ -13183,7 +13250,7 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* } LDKRoute route_var = *route; int64_t route_ref = 0; - route_var = Route_clone(route); + route_var = Route_clone(&route_var); CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); @@ -13222,7 +13289,7 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall( } LDKRoute route_var = *route; int64_t route_ref = 0; - route_var = Route_clone(route); + route_var = Route_clone(&route_var); CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); @@ -13259,7 +13326,7 @@ LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this } LDKRoute route_var = *route; int64_t route_ref = 0; - route_var = Route_clone(route); + route_var = Route_clone(&route_var); CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); @@ -13479,7 +13546,7 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); LDKRouteParameters route_params_var = *route_params; int64_t route_params_ref = 0; - route_params_var = RouteParameters_clone(route_params); + route_params_var = RouteParameters_clone(&route_params_var); CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); @@ -15971,6 +16038,85 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScori return (int64_t)ret_conv; } +static inline uintptr_t C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR arg) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); + *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(arg); + return ((int64_t)ret_conv); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* arg_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg & ~1); + int64_t ret_val = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* orig_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(orig & ~1); + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); + *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(orig_conv); + return ((int64_t)ret_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKProbabilisticScoringParameters a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = (a & 1) || (a == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = ProbabilisticScoringParameters_clone(&a_conv); + LDKNetworkGraph b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); + *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a_conv, &b_conv); + return ((int64_t)ret_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ _res_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(_res_ptr); + FREE((void*)_res); + C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKProbabilisticScorer o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer + LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKInitFeatures o_conv; o_conv.inner = (void*)(o & (~1)); @@ -42567,6 +42713,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, j return (int64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKProbabilisticScorer this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ProbabilisticScorer_free(this_obj_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKProbabilisticScoringParameters this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -42682,6 +42836,28 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParamet return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph) { + LDKProbabilisticScoringParameters params_conv; + params_conv.inner = (void*)(params & (~1)); + params_conv.is_owned = (params & 1) || (params == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + params_conv = ProbabilisticScoringParameters_clone(¶ms_conv); + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); + LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) { LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default(); int64_t ret_ref = 0; @@ -42695,6 +42871,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParamet return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKProbabilisticScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv); + return (int64_t)ret_ret; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKProbabilisticScorer obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + void* arg_ptr = (void*)(((uintptr_t)arg) & ~1); + CHECK_ACCESS(arg_ptr); + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ arg_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg_ptr); + arg_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone((LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(((uintptr_t)arg) & ~1)); + LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ"); + *ret_conv = ProbabilisticScorer_read(ser_ref, arg_conv); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (int64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKFilesystemPersister this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index 47d0e4b2..497d7e35 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -1295,7 +1295,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTra return ret_ref; } -static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){ +static inline struct LDKTrustedClosingTransaction *NONNULL_PTR CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -1355,7 +1355,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransact return ret_ref; } -static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){ +static inline struct LDKTrustedCommitmentTransaction *NONNULL_PTR CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -3109,7 +3109,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersD return ret_ref; } -static inline struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKScorer *NONNULL_PTR CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -3178,6 +3178,73 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScori return ret_ref; } +static inline struct LDKProbabilisticScoringParameters C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){ + return ProbabilisticScoringParameters_clone(&owner->a); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1); + LDKProbabilisticScoringParameters ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKNetworkGraph C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){ + return NetworkGraph_clone(&owner->b); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1); + LDKNetworkGraph ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKProbabilisticScorer *NONNULL_PTR CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return &*owner->contents.result; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1); + LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner & ~1; + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return InitFeatures_clone(&*owner->contents.result); @@ -3689,7 +3756,7 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th } LDKHolderCommitmentTransaction holder_tx_var = *holder_tx; int64_t holder_tx_ref = 0; - holder_tx_var = HolderCommitmentTransaction_clone(holder_tx); + holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var); CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var); @@ -3759,7 +3826,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L } LDKCommitmentTransaction commitment_tx_var = *commitment_tx; int64_t commitment_tx_ref = 0; - commitment_tx_var = CommitmentTransaction_clone(commitment_tx); + commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var); CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var); @@ -3832,7 +3899,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl } LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx; int64_t commitment_tx_ref = 0; - commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx); + commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var); CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var); @@ -3904,7 +3971,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key); LDKHTLCOutputInCommitment htlc_var = *htlc; int64_t htlc_ref = 0; - htlc_var = HTLCOutputInCommitment_clone(htlc); + htlc_var = HTLCOutputInCommitment_clone(&htlc_var); CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var); @@ -3945,7 +4012,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form); LDKHTLCOutputInCommitment htlc_var = *htlc; int64_t htlc_ref = 0; - htlc_var = HTLCOutputInCommitment_clone(htlc); + htlc_var = HTLCOutputInCommitment_clone(&htlc_var); CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var); @@ -3980,7 +4047,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* } LDKClosingTransaction closing_tx_var = *closing_tx; int64_t closing_tx_ref = 0; - closing_tx_var = ClosingTransaction_clone(closing_tx); + closing_tx_var = ClosingTransaction_clone(&closing_tx_var); CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var); @@ -4015,7 +4082,7 @@ LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSig } LDKUnsignedChannelAnnouncement msg_var = *msg; int64_t msg_ref = 0; - msg_var = UnsignedChannelAnnouncement_clone(msg); + msg_var = UnsignedChannelAnnouncement_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -4050,7 +4117,7 @@ void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransaction } LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; int64_t channel_parameters_ref = 0; - channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters); + channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var); CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var); @@ -6195,7 +6262,7 @@ void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) { } LDKRecord record_var = *record; int64_t record_ref = 0; - record_var = Record_clone(record); + record_var = Record_clone(&record_var); CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var); @@ -6250,7 +6317,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChann return ret_arr; } -static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){ +static inline struct LDKChannelManager *NONNULL_PTR C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){ return &owner->b; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { @@ -6264,7 +6331,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMa return ret_ref; } -static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -9500,7 +9567,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1f default: abort(); } } -static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){ +static inline struct LDKLockedChannelMonitor *NONNULL_PTR CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; } @@ -10203,7 +10270,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con } LDKChannelMonitor data_var = *data; int64_t data_ref = 0; - data_var = ChannelMonitor_clone(data); + data_var = ChannelMonitor_clone(&data_var); CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var); @@ -10257,7 +10324,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal LDKChannelMonitorUpdate update_var = *update; int64_t update_ref = 0; if ((uintptr_t)update_var.inner > 4096) { - update_var = ChannelMonitorUpdate_clone(update); + update_var = ChannelMonitorUpdate_clone(&update_var); CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var); @@ -10268,7 +10335,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal } LDKChannelMonitor data_var = *data; int64_t data_ref = 0; - data_var = ChannelMonitor_clone(data); + data_var = ChannelMonitor_clone(&data_var); CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var); @@ -10445,7 +10512,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD } LDKOpenChannel msg_var = *msg; int64_t msg_ref = 0; - msg_var = OpenChannel_clone(msg); + msg_var = OpenChannel_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10486,7 +10553,7 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, } LDKAcceptChannel msg_var = *msg; int64_t msg_ref = 0; - msg_var = AcceptChannel_clone(msg); + msg_var = AcceptChannel_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10518,7 +10585,7 @@ void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingCreated msg_var = *msg; int64_t msg_ref = 0; - msg_var = FundingCreated_clone(msg); + msg_var = FundingCreated_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10550,7 +10617,7 @@ void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingSigned msg_var = *msg; int64_t msg_ref = 0; - msg_var = FundingSigned_clone(msg); + msg_var = FundingSigned_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10582,7 +10649,7 @@ void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingLocked msg_var = *msg; int64_t msg_ref = 0; - msg_var = FundingLocked_clone(msg); + msg_var = FundingLocked_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10614,7 +10681,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInitFeatures their_features_var = *their_features; int64_t their_features_ref = 0; - their_features_var = InitFeatures_clone(their_features); + their_features_var = InitFeatures_clone(&their_features_var); CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); @@ -10624,7 +10691,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub } LDKShutdown msg_var = *msg; int64_t msg_ref = 0; - msg_var = Shutdown_clone(msg); + msg_var = Shutdown_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10656,7 +10723,7 @@ void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKClosingSigned msg_var = *msg; int64_t msg_ref = 0; - msg_var = ClosingSigned_clone(msg); + msg_var = ClosingSigned_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10688,7 +10755,7 @@ void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateAddHTLC msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateAddHTLC_clone(msg); + msg_var = UpdateAddHTLC_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10720,7 +10787,7 @@ void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_ (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFulfillHTLC msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateFulfillHTLC_clone(msg); + msg_var = UpdateFulfillHTLC_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10752,7 +10819,7 @@ void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFailHTLC msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateFailHTLC_clone(msg); + msg_var = UpdateFailHTLC_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10784,7 +10851,7 @@ void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFailMalformedHTLC msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateFailMalformedHTLC_clone(msg); + msg_var = UpdateFailMalformedHTLC_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10816,7 +10883,7 @@ void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_ar (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKCommitmentSigned msg_var = *msg; int64_t msg_ref = 0; - msg_var = CommitmentSigned_clone(msg); + msg_var = CommitmentSigned_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10848,7 +10915,7 @@ void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKRevokeAndACK msg_var = *msg; int64_t msg_ref = 0; - msg_var = RevokeAndACK_clone(msg); + msg_var = RevokeAndACK_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10880,7 +10947,7 @@ void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFee msg_var = *msg; int64_t msg_ref = 0; - msg_var = UpdateFee_clone(msg); + msg_var = UpdateFee_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10912,7 +10979,7 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKAnnouncementSignatures msg_var = *msg; int64_t msg_ref = 0; - msg_var = AnnouncementSignatures_clone(msg); + msg_var = AnnouncementSignatures_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10966,7 +11033,7 @@ void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPubl (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInit msg_var = *msg; int64_t msg_ref = 0; - msg_var = Init_clone(msg); + msg_var = Init_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -10998,7 +11065,7 @@ void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_ (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKChannelReestablish msg_var = *msg; int64_t msg_ref = 0; - msg_var = ChannelReestablish_clone(msg); + msg_var = ChannelReestablish_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11030,7 +11097,7 @@ void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKChannelUpdate msg_var = *msg; int64_t msg_ref = 0; - msg_var = ChannelUpdate_clone(msg); + msg_var = ChannelUpdate_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11062,7 +11129,7 @@ void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublic (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKErrorMessage msg_var = *msg; int64_t msg_ref = 0; - msg_var = ErrorMessage_clone(msg); + msg_var = ErrorMessage_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11507,7 +11574,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler } LDKNodeAnnouncement msg_var = *msg; int64_t msg_ref = 0; - msg_var = NodeAnnouncement_clone(msg); + msg_var = NodeAnnouncement_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11542,7 +11609,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand } LDKChannelAnnouncement msg_var = *msg; int64_t msg_ref = 0; - msg_var = ChannelAnnouncement_clone(msg); + msg_var = ChannelAnnouncement_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11577,7 +11644,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc } LDKChannelUpdate msg_var = *msg; int64_t msg_ref = 0; - msg_var = ChannelUpdate_clone(msg); + msg_var = ChannelUpdate_clone(&msg_var); CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); @@ -11690,7 +11757,7 @@ void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDK (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInit init_var = *init; int64_t init_ref = 0; - init_var = Init_clone(init); + init_var = Init_clone(&init_var); CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var); @@ -12610,7 +12677,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } LDKNodeId source_var = *source; int64_t source_ref = 0; - source_var = NodeId_clone(source); + source_var = NodeId_clone(&source_var); CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var); @@ -12620,7 +12687,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } LDKNodeId target_var = *target; int64_t target_ref = 0; - target_var = NodeId_clone(target); + target_var = NodeId_clone(&target_var); CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var); @@ -13181,7 +13248,7 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* } LDKRoute route_var = *route; int64_t route_ref = 0; - route_var = Route_clone(route); + route_var = Route_clone(&route_var); CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); @@ -13220,7 +13287,7 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall( } LDKRoute route_var = *route; int64_t route_ref = 0; - route_var = Route_clone(route); + route_var = Route_clone(&route_var); CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); @@ -13257,7 +13324,7 @@ LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this } LDKRoute route_var = *route; int64_t route_ref = 0; - route_var = Route_clone(route); + route_var = Route_clone(&route_var); CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); @@ -13477,7 +13544,7 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); LDKRouteParameters route_params_var = *route_params; int64_t route_params_ref = 0; - route_params_var = RouteParameters_clone(route_params); + route_params_var = RouteParameters_clone(&route_params_var); CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); @@ -15969,6 +16036,85 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScori return (int64_t)ret_conv; } +static inline uintptr_t C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR arg) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); + *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(arg); + return ((int64_t)ret_conv); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* arg_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg & ~1); + int64_t ret_val = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* orig_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(orig & ~1); + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); + *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(orig_conv); + return ((int64_t)ret_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKProbabilisticScoringParameters a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = (a & 1) || (a == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = ProbabilisticScoringParameters_clone(&a_conv); + LDKNetworkGraph b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); + *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a_conv, &b_conv); + return ((int64_t)ret_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ _res_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(_res_ptr); + FREE((void*)_res); + C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKProbabilisticScorer o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer + LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKInitFeatures o_conv; o_conv.inner = (void*)(o & (~1)); @@ -42565,6 +42711,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, j return (int64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKProbabilisticScorer this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ProbabilisticScorer_free(this_obj_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKProbabilisticScoringParameters this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -42680,6 +42834,28 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParamet return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph) { + LDKProbabilisticScoringParameters params_conv; + params_conv.inner = (void*)(params & (~1)); + params_conv.is_owned = (params & 1) || (params == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + params_conv = ProbabilisticScoringParameters_clone(¶ms_conv); + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); + LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) { LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default(); int64_t ret_ref = 0; @@ -42693,6 +42869,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParamet return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKProbabilisticScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv); + return (int64_t)ret_ret; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKProbabilisticScorer obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + void* arg_ptr = (void*)(((uintptr_t)arg) & ~1); + CHECK_ACCESS(arg_ptr); + LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ arg_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg_ptr); + arg_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone((LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(((uintptr_t)arg) & ~1)); + LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ"); + *ret_conv = ProbabilisticScorer_read(ser_ref, arg_conv); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (int64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKFilesystemPersister this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index a7171597..23ece875 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -823,6 +823,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoring JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1a + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1b + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScorerDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScorerDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_InitFeaturesDecodeErrorZ_get_ok @@ -5799,6 +5831,70 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoring JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1new + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScorerDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScorerDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScorerDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScorerDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_InitFeaturesDecodeErrorZ_ok @@ -23751,6 +23847,14 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Scorer_1read (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScorer_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScoringParameters_free @@ -23831,6 +23935,14 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringPara JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1read (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScorer_new + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScoringParameters_default @@ -23839,6 +23951,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameter JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScorer_as_Score + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScorer_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScorer_read + * Signature: ([BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read + (JNIEnv *, jclass, jbyteArray, jlong); + /* * Class: org_ldk_impl_bindings * Method: FilesystemPersister_free