X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjni%2Fbindings.c.body;h=3b19333747edec288430e7ca49ccb86aff6705c4;hb=c6bac88847b7c09560af81f00ba8dd3c2ebe3a19;hp=a13aed2912b0850d151decb4e93d8f0a483a2f5f;hpb=0d48e557e83ef085cc92c2de63b9c81c061ce78c;p=ldk-java diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index a13aed29..3b193337 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -9,7 +9,7 @@ #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__) #define MALLOC(a, _) malloc(a) -#define FREE(p) if ((uint64_t)(p) > 1024) { free(p); } +#define FREE(p) if ((uint64_t)(p) > 4096) { free(p); } #define CHECK_ACCESS(p) #define DO_ASSERT(a) (void)(a) #define CHECK(a) @@ -795,18 +795,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysD LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKTxCreationKeys res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -816,18 +818,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKe LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelPublicKeys res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -837,9 +841,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysE LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKTxCreationKeys res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -883,18 +888,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCom LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKHTLCOutputInCommitment res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -904,18 +911,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyCha LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -925,18 +934,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransact LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelTransactionParameters res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -946,18 +957,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmen LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKHolderCommitmentTransaction res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -967,18 +980,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitment LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKBuiltCommitmentTransaction res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -988,9 +1003,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingT LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1); CHECK(val->result_ok); LDKTrustedClosingTransaction res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -1005,18 +1021,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTrans LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKCommitmentTransaction res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -1026,9 +1044,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitme LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1); CHECK(val->result_ok); LDKTrustedCommitmentTransaction res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -1043,13 +1062,15 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1Sign LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1); CHECK(val->result_ok); LDKCVec_SignatureZ res_var = (*val->contents.result); - jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL); + jobjectArray res_arr = NULL; + res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < res_var.datalen; i++) { int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64); (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form); (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr); } + return res_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -1064,18 +1085,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptD LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKShutdownScript res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -1085,18 +1108,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptI LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1); CHECK(val->result_ok); LDKShutdownScript res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1); CHECK(!val->result_ok); LDKInvalidShutdownScript err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -1120,18 +1145,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeE LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKRouteHop res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { @@ -1175,20 +1202,72 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErro LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKRoute res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_RouteParametersDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKRouteParameters res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { + LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ"); + ret->datalen = (*env)->GetArrayLength(env, elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data"); + int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL); + for (size_t i = 0; i < ret->datalen; i++) { + int64_t arr_elem = java_elems[i]; + LDKRouteHint arr_elem_conv; + arr_elem_conv.inner = (void*)(arr_elem & (~1)); + arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0); + arr_elem_conv = RouteHint_clone(&arr_elem_conv); + ret->data[i] = arr_elem_conv; + } + (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); + } + return (uint64_t)ret; +} +static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) { + LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = RouteHint_clone(&orig->data[i]); + } + return ret; +} static jclass LDKCOption_u64Z_Some_class = NULL; static jmethodID LDKCOption_u64Z_Some_meth = NULL; static jclass LDKCOption_u64Z_None_class = NULL; @@ -1217,57 +1296,126 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from default: abort(); } } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { - LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ"); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_PayeeDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPayee res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { + LDKCVec_RouteHintHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHintHopZ), "LDKCVec_RouteHintHopZ"); ret->datalen = (*env)->GetArrayLength(env, elems); if (ret->datalen == 0) { ret->data = NULL; } else { - ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data"); + ret->data = MALLOC(sizeof(LDKRouteHintHop) * ret->datalen, "LDKCVec_RouteHintHopZ Data"); int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL); for (size_t i = 0; i < ret->datalen; i++) { int64_t arr_elem = java_elems[i]; - LDKChannelDetails arr_elem_conv; + LDKRouteHintHop arr_elem_conv; arr_elem_conv.inner = (void*)(arr_elem & (~1)); arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0); - arr_elem_conv = ChannelDetails_clone(&arr_elem_conv); + arr_elem_conv = RouteHintHop_clone(&arr_elem_conv); ret->data[i] = arr_elem_conv; } (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); } return (uint64_t)ret; } -static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) { - LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen }; +static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) { + LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = ChannelDetails_clone(&orig->data[i]); + ret.data[i] = RouteHintHop_clone(&orig->data[i]); } return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { - LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ"); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_RouteHintDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKRouteHint res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_RouteHintHopDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKRouteHintHop res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { + LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ"); ret->datalen = (*env)->GetArrayLength(env, elems); if (ret->datalen == 0) { ret->data = NULL; } else { - ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data"); + ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data"); int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL); for (size_t i = 0; i < ret->datalen; i++) { int64_t arr_elem = java_elems[i]; - LDKRouteHint arr_elem_conv; + LDKChannelDetails arr_elem_conv; arr_elem_conv.inner = (void*)(arr_elem & (~1)); arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0); - arr_elem_conv = RouteHint_clone(&arr_elem_conv); + arr_elem_conv = ChannelDetails_clone(&arr_elem_conv); ret->data[i] = arr_elem_conv; } (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); } return (uint64_t)ret; } -static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) { - LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen }; +static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) { + LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = RouteHint_clone(&orig->data[i]); + ret.data[i] = ChannelDetails_clone(&orig->data[i]); } return ret; } @@ -1278,18 +1426,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningE LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKRoute res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKLightningError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -1380,6 +1530,10 @@ static jclass LDKMonitorEvent_HTLCEvent_class = NULL; static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL; static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL; static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL; +static jclass LDKMonitorEvent_UpdateCompleted_class = NULL; +static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL; +static jclass LDKMonitorEvent_UpdateFailed_class = NULL; +static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) { LDKMonitorEvent_HTLCEvent_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;")); @@ -1391,24 +1545,52 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNI CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL); LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "", "(J)V"); CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL); + LDKMonitorEvent_UpdateCompleted_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted;")); + CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL); + LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "", "(JJ)V"); + CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL); + LDKMonitorEvent_UpdateFailed_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed;")); + CHECK(LDKMonitorEvent_UpdateFailed_class != NULL); + LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "", "(J)V"); + CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1); switch(obj->tag) { case LDKMonitorEvent_HTLCEvent: { LDKHTLCUpdate htlc_event_var = obj->htlc_event; + uint64_t htlc_event_ref = 0; CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1; + htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1; return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref); } case LDKMonitorEvent_CommitmentTxConfirmed: { LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed; + uint64_t commitment_tx_confirmed_ref = 0; CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1; + commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1; return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref); } + case LDKMonitorEvent_UpdateCompleted: { + LDKOutPoint funding_txo_var = obj->update_completed.funding_txo; + uint64_t funding_txo_ref = 0; + CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1; + return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, obj->update_completed.monitor_update_id); + } + case LDKMonitorEvent_UpdateFailed: { + LDKOutPoint update_failed_var = obj->update_failed; + uint64_t update_failed_ref = 0; + CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + update_failed_ref = (uint64_t)update_failed_var.inner & ~1; + return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref); + } default: abort(); } } @@ -1498,9 +1680,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from switch(obj->tag) { case LDKNetworkUpdate_ChannelUpdateMessage: { LDKChannelUpdate msg_var = obj->channel_update_message.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref); } case LDKNetworkUpdate_ChannelClosed: { @@ -1571,24 +1754,27 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescripto switch(obj->tag) { case LDKSpendableOutputDescriptor_StaticOutput: { LDKOutPoint outpoint_var = obj->static_output.outpoint; + uint64_t outpoint_ref = 0; CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1; + outpoint_ref = (uint64_t)outpoint_var.inner & ~1; uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1; return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref); } case LDKSpendableOutputDescriptor_DelayedPaymentOutput: { LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output; + uint64_t delayed_payment_output_ref = 0; CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1; + delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1; return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref); } case LDKSpendableOutputDescriptor_StaticPaymentOutput: { LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output; + uint64_t static_payment_output_ref = 0; CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1; + static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1; return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref); } default: abort(); @@ -1656,9 +1842,12 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 switch(obj->tag) { case LDKErrorAction_DisconnectPeer: { LDKErrorMessage msg_var = obj->disconnect_peer.msg; - CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + uint64_t msg_ref = 0; + if ((uint64_t)msg_var.inner > 4096) { + CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + msg_ref = (uint64_t)msg_var.inner & ~1; + } return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref); } case LDKErrorAction_IgnoreError: { @@ -1670,9 +1859,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 } case LDKErrorAction_SendErrorMessage: { LDKErrorMessage msg_var = obj->send_error_message.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref); } default: abort(); @@ -1820,133 +2010,149 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form); LDKAcceptChannel msg_var = obj->send_accept_channel.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendOpenChannel: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form); LDKOpenChannel msg_var = obj->send_open_channel.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendFundingCreated: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form); LDKFundingCreated msg_var = obj->send_funding_created.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendFundingSigned: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form); LDKFundingSigned msg_var = obj->send_funding_signed.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendFundingLocked: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form); LDKFundingLocked msg_var = obj->send_funding_locked.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendAnnouncementSignatures: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form); LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_UpdateHTLCs: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form); LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates; + uint64_t updates_ref = 0; CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t updates_ref = (uint64_t)updates_var.inner & ~1; + updates_ref = (uint64_t)updates_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref); } case LDKMessageSendEvent_SendRevokeAndACK: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form); LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendClosingSigned: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form); LDKClosingSigned msg_var = obj->send_closing_signed.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendShutdown: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form); LDKShutdown msg_var = obj->send_shutdown.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendChannelReestablish: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form); LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_BroadcastChannelAnnouncement: { LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg; + uint64_t update_msg_ref = 0; CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1; + update_msg_ref = (uint64_t)update_msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref); } case LDKMessageSendEvent_BroadcastNodeAnnouncement: { LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref); } case LDKMessageSendEvent_BroadcastChannelUpdate: { LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref); } case LDKMessageSendEvent_SendChannelUpdate: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form); LDKChannelUpdate msg_var = obj->send_channel_update.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_HandleError: { @@ -1959,27 +2165,30 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form); LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendShortIdsQuery: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form); LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendReplyChannelRange: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form); LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner & ~1; + msg_ref = (uint64_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref); } default: abort(); @@ -2019,18 +2228,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDec LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKInitFeatures res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -2040,18 +2251,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDec LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKNodeFeatures res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -2061,18 +2274,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeatures LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelFeatures res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -2082,18 +2297,66 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeatures LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKInvoiceFeatures res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_ScoringParametersDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKScoringParameters res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_ScorerDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKScorer res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -2103,18 +2366,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentO LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -2124,18 +2389,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOu LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -2151,9 +2418,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutput LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -2185,13 +2453,15 @@ static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b( JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1); LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv); - jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); + jobjectArray ret_arr = NULL; + ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < ret_var.datalen; i++) { int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64); (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form); (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); } + FREE(ret_var.data); return ret_arr; } @@ -2320,10 +2590,11 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th DO_ASSERT(get_jenv_res == JNI_OK); } LDKHolderCommitmentTransaction holder_tx_var = *holder_tx; + uint64_t holder_tx_ref = 0; holder_tx_var = HolderCommitmentTransaction_clone(holder_tx); CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner; + holder_tx_ref = (uint64_t)holder_tx_var.inner; if (holder_tx_var.is_owned) { holder_tx_ref |= 1; } @@ -2377,10 +2648,11 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L DO_ASSERT(get_jenv_res == JNI_OK); } LDKCommitmentTransaction commitment_tx_var = *commitment_tx; + uint64_t commitment_tx_ref = 0; commitment_tx_var = CommitmentTransaction_clone(commitment_tx); CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner; + commitment_tx_ref = (uint64_t)commitment_tx_var.inner; if (commitment_tx_var.is_owned) { commitment_tx_ref |= 1; } @@ -2437,10 +2709,11 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl DO_ASSERT(get_jenv_res == JNI_OK); } LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx; + uint64_t commitment_tx_ref = 0; commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx); CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner; + commitment_tx_ref = (uint64_t)commitment_tx_var.inner; if (commitment_tx_var.is_owned) { commitment_tx_ref |= 1; } @@ -2507,10 +2780,11 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key); LDKHTLCOutputInCommitment htlc_var = *htlc; + uint64_t htlc_ref = 0; htlc_var = HTLCOutputInCommitment_clone(htlc); CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t htlc_ref = (uint64_t)htlc_var.inner; + htlc_ref = (uint64_t)htlc_var.inner; if (htlc_var.is_owned) { htlc_ref |= 1; } @@ -2546,10 +2820,11 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form); LDKHTLCOutputInCommitment htlc_var = *htlc; + uint64_t htlc_ref = 0; htlc_var = HTLCOutputInCommitment_clone(htlc); CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t htlc_ref = (uint64_t)htlc_var.inner; + htlc_ref = (uint64_t)htlc_var.inner; if (htlc_var.is_owned) { htlc_ref |= 1; } @@ -2579,10 +2854,11 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* DO_ASSERT(get_jenv_res == JNI_OK); } LDKClosingTransaction closing_tx_var = *closing_tx; + uint64_t closing_tx_ref = 0; closing_tx_var = ClosingTransaction_clone(closing_tx); CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner; + closing_tx_ref = (uint64_t)closing_tx_var.inner; if (closing_tx_var.is_owned) { closing_tx_ref |= 1; } @@ -2612,10 +2888,11 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void DO_ASSERT(get_jenv_res == JNI_OK); } LDKUnsignedChannelAnnouncement msg_var = *msg; + uint64_t msg_ref = 0; msg_var = UnsignedChannelAnnouncement_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -2645,10 +2922,11 @@ void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransaction DO_ASSERT(get_jenv_res == JNI_OK); } LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; + uint64_t channel_parameters_ref = 0; channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters); CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner; + channel_parameters_ref = (uint64_t)channel_parameters_var.inner; if (channel_parameters_var.is_owned) { channel_parameters_ref |= 1; } @@ -2907,9 +3185,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIE if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -3023,7 +3302,7 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErro JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign"); + LDKSign* res_ret = MALLOC(sizeof(LDKSign), "LDKSign"); *res_ret = Sign_clone(&(*val->contents.result)); return (uint64_t)res_ret; } @@ -3031,9 +3310,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeError LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -3065,7 +3345,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1); CHECK(val->result_ok); LDKCVec_CVec_u8ZZ res_var = (*val->contents.result); - jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL); + jobjectArray res_arr = NULL; + res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < res_var.datalen; i++) { LDKCVec_u8Z res_conv_8_var = res_var.data[i]; @@ -3073,6 +3354,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data); (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr); } + return res_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -3087,18 +3369,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerD LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKInMemorySigner res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { @@ -3160,9 +3444,10 @@ static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LD JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1); LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -3203,7 +3488,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tu LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result); - int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen); + int64_tArray res_arr = NULL; + res_arr = (*env)->NewLongArray(env, res_var.datalen); int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL); for (size_t j = 0; j < res_var.datalen; j++) { LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ"); @@ -3220,27 +3506,6 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1B jclass err_conv = LDKIOError_to_java(env, (*val->contents.err)); return err_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { - return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); - CHECK(val->result_ok); - LDKPaymentId res_var = (*val->contents.result); - CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; - return res_ref; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); - CHECK(!val->result_ok); - LDKDecodeError err_var = (*val->contents.err); - CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; - return err_ref; -} static jclass LDKCOption_u16Z_Some_class = NULL; static jmethodID LDKCOption_u16Z_Some_meth = NULL; static jclass LDKCOption_u16Z_None_class = NULL; @@ -3341,9 +3606,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr } case LDKAPIError_IncompatibleShutdownScript: { LDKShutdownScript script_var = obj->incompatible_shutdown_script.script; + uint64_t script_ref = 0; CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t script_ref = (uint64_t)script_var.inner & ~1; + script_ref = (uint64_t)script_var.inner & ~1; return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref); } default: abort(); @@ -3460,7 +3726,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_ini LDKPaymentSendFailure_PartialFailure_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;")); CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL); - LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "", "([J)V"); + LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "", "([JJ[B)V"); CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { @@ -3472,7 +3738,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_ } case LDKPaymentSendFailure_PathParameterError: { LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error; - int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen); + int64_tArray path_parameter_error_arr = NULL; + path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen); int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL); for (size_t w = 0; w < path_parameter_error_var.datalen; w++) { LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); @@ -3485,7 +3752,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_ } case LDKPaymentSendFailure_AllFailedRetrySafe: { LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe; - int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen); + int64_tArray all_failed_retry_safe_arr = NULL; + all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen); int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL); for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) { uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1; @@ -3495,17 +3763,27 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_ return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr); } case LDKPaymentSendFailure_PartialFailure: { - LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure; - int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen); - int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL); - for (size_t w = 0; w < partial_failure_var.datalen; w++) { - LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *partial_failure_conv_22_conv = partial_failure_var.data[w]; - *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv); - partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv; + LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results; + int64_tArray results_arr = NULL; + results_arr = (*env)->NewLongArray(env, results_var.datalen); + int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL); + for (size_t w = 0; w < results_var.datalen; w++) { + LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *results_conv_22_conv = results_var.data[w]; + *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv); + results_arr_ptr[w] = (uint64_t)results_conv_22_conv; + } + (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0); + LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry; + uint64_t failed_paths_retry_ref = 0; + if ((uint64_t)failed_paths_retry_var.inner > 4096) { + CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1; } - (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0); - return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr); + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data); + return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr); } default: abort(); } @@ -3513,14 +3791,12 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); CHECK(val->result_ok); - LDKPaymentId res_var = (*val->contents.result); - CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; - return res_ref; + int8_tArray res_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); + return res_arr; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); @@ -3552,19 +3828,14 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPay return ret_arr; } -static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ - return PaymentId_clone(&tuple->b); +static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return ThirtyTwoBytes_clone(&tuple->b); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); - LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv).data); + return ret_arr; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -3765,16 +4036,18 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* DO_ASSERT(get_jenv_res == JNI_OK); } LDKOutPoint funding_txo_var = funding_txo; + uint64_t funding_txo_ref = 0; CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner; + funding_txo_ref = (uint64_t)funding_txo_var.inner; if (funding_txo_var.is_owned) { funding_txo_ref |= 1; } LDKChannelMonitor monitor_var = monitor; + uint64_t monitor_ref = 0; CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t monitor_ref = (uint64_t)monitor_var.inner; + monitor_ref = (uint64_t)monitor_var.inner; if (monitor_var.is_owned) { monitor_ref |= 1; } @@ -3804,16 +4077,18 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void DO_ASSERT(get_jenv_res == JNI_OK); } LDKOutPoint funding_txo_var = funding_txo; + uint64_t funding_txo_ref = 0; CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner; + funding_txo_ref = (uint64_t)funding_txo_var.inner; if (funding_txo_var.is_owned) { funding_txo_ref |= 1; } LDKChannelMonitorUpdate update_var = update; + uint64_t update_ref = 0; CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t update_ref = (uint64_t)update_var.inner; + update_ref = (uint64_t)update_var.inner; if (update_var.is_owned) { update_ref |= 1; } @@ -3941,7 +4216,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pendin if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr; LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t o = 0; o < ret_var.datalen; o++) { LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); @@ -4317,9 +4593,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdow if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -4330,7 +4607,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign"); + LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis); return (uint64_t)ret_ret; } @@ -4537,9 +4814,10 @@ static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(L JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1); LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner & ~1; + ret_ref = (uint64_t)ret_var.inner & ~1; return ret_ref; } @@ -4557,9 +4835,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockH LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -4569,18 +4848,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDe LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelConfig res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -4590,18 +4871,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeE LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKOutPoint res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } typedef struct LDKType_JCalls { @@ -4779,7 +5062,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1fro LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1); switch(obj->tag) { case LDKCOption_TypeZ_Some: { - LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType"); + LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType"); *some_ret = Type_clone(&obj->some); return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret); } @@ -4802,9 +5085,72 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZD LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +static jclass LDKPaymentError_Invoice_class = NULL; +static jmethodID LDKPaymentError_Invoice_meth = NULL; +static jclass LDKPaymentError_Routing_class = NULL; +static jmethodID LDKPaymentError_Routing_meth = NULL; +static jclass LDKPaymentError_Sending_class = NULL; +static jmethodID LDKPaymentError_Sending_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) { + LDKPaymentError_Invoice_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Invoice;")); + CHECK(LDKPaymentError_Invoice_class != NULL); + LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKPaymentError_Invoice_meth != NULL); + LDKPaymentError_Routing_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Routing;")); + CHECK(LDKPaymentError_Routing_class != NULL); + LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "", "(J)V"); + CHECK(LDKPaymentError_Routing_meth != NULL); + LDKPaymentError_Sending_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Sending;")); + CHECK(LDKPaymentError_Sending_class != NULL); + LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "", "(J)V"); + CHECK(LDKPaymentError_Sending_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1); + switch(obj->tag) { + case LDKPaymentError_Invoice: { + LDKStr invoice_str = obj->invoice; + jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len); + return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv); + } + case LDKPaymentError_Routing: { + LDKLightningError routing_var = obj->routing; + uint64_t routing_ref = 0; + CHECK((((uint64_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + routing_ref = (uint64_t)routing_var.inner & ~1; + return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref); + } + case LDKPaymentError_Sending: { + uint64_t sending_ref = ((uint64_t)&obj->sending) | 1; + return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref); + } + default: abort(); + } +} +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_PaymentIdPaymentErrorZ*)arg)->result_ok; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); + return res_arr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -4828,9 +5174,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1g LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1); CHECK(val->result_ok); LDKInvoice res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -4845,9 +5192,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoic LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1); CHECK(val->result_ok); LDKSignedRawInvoice res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -4861,9 +5209,10 @@ static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) { LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1); LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -4886,9 +5235,10 @@ static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignature JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) { LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1); LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -4902,9 +5252,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErro LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKPayeePubKey res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -4947,9 +5298,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimesta LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKPositiveTimestamp res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -4979,9 +5331,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemantic LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKInvoice res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -4997,9 +5350,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCrea LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKDescription res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -5015,9 +5369,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreat LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKExpiryTime res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -5033,9 +5388,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCre LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKPrivateRoute res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -5067,18 +5423,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorU LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelMonitorUpdate res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -5088,18 +5446,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecod LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKHTLCUpdate res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -5114,9 +5474,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpda LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKMonitorUpdateError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){ @@ -5125,9 +5486,10 @@ static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPoi JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) { LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1); LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -5210,7 +5572,8 @@ static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32Scr JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1); LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t v = 0; v < ret_var.datalen; v++) { LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ"); @@ -5397,12 +5760,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_PaymentSent_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;")); CHECK(LDKEvent_PaymentSent_class != NULL); - LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B[B)V"); + LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B[B[BJ)V"); CHECK(LDKEvent_PaymentSent_meth != NULL); LDKEvent_PaymentPathFailed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;")); CHECK(LDKEvent_PaymentPathFailed_class != NULL); - LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([BZJZ[JJ)V"); + LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJZ[JJJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); LDKEvent_PendingHTLCsForwardable_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;")); @@ -5448,36 +5811,51 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref); } case LDKEvent_PaymentSent: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data); int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data); int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data); - return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr, payment_hash_arr); + uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1; + return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref); } case LDKEvent_PaymentPathFailed: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data); int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data); uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1; LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path; - int64_tArray path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); for (size_t k = 0; k < path_var.datalen; k++) { LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1; + path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1; path_arr_ptr[k] = path_conv_10_ref; } (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1; - return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref); + LDKRouteParameters retry_var = obj->payment_path_failed.retry; + uint64_t retry_ref = 0; + if ((uint64_t)retry_var.inner > 4096) { + CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + retry_ref = (uint64_t)retry_var.inner & ~1; + } + return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref, retry_ref); } case LDKEvent_PendingHTLCsForwardable: { return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable); } case LDKEvent_SpendableOutputs: { LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs; - int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen); + int64_tArray outputs_arr = NULL; + outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen); int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL); for (size_t b = 0; b < outputs_var.datalen; b++) { uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1; @@ -5596,7 +5974,8 @@ static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOu JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1); LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t u = 0; u < ret_var.datalen; u++) { LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ"); @@ -5725,9 +6104,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockH LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -5742,9 +6122,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningEr LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKLightningError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){ @@ -5762,7 +6143,7 @@ static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTy } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1); - LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType"); + LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType"); *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv); return (uint64_t)ret_ret; } @@ -5806,9 +6187,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningEr LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKLightningError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){ @@ -5817,9 +6199,10 @@ static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUp JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1); LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -5832,9 +6215,10 @@ static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateCh JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1); LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -5847,9 +6231,10 @@ static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateCh JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1); LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -5925,9 +6310,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHa LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKPeerHandleError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -5942,9 +6328,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleE LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKPeerHandleError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -5959,9 +6346,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleE LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKPeerHandleError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -5971,18 +6359,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErr LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKNodeId res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } typedef struct LDKAccess_JCalls { @@ -6094,7 +6484,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1f LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1); switch(obj->tag) { case LDKCOption_AccessZ_Some: { - LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess"); + LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess"); *some_ret = obj->some; // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances if ((*some_ret).free == LDKAccess_JCalls_free) { @@ -6116,18 +6506,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChan LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKDirectionalChannelInfo res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6137,18 +6529,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDeco LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelInfo res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6158,18 +6552,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDeco LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKRoutingFees res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6179,18 +6575,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncemen LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKNodeAnnouncementInfo res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) { @@ -6220,18 +6618,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeE LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKNodeInfo res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6241,18 +6641,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDec LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKNetworkGraph res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL; @@ -6276,7 +6678,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddres switch(obj->tag) { case LDKCOption_CVec_NetAddressZZ_Some: { LDKCVec_NetAddressZ some_var = obj->some; - int64_tArray some_arr = (*env)->NewLongArray(env, some_var.datalen); + int64_tArray some_arr = NULL; + some_arr = (*env)->NewLongArray(env, some_var.datalen); int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL); for (size_t m = 0; m < some_var.datalen; m++) { uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1; @@ -6291,40 +6694,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddres default: abort(); } } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { - return ((LDKCResult_NetAddressu8Z*)arg)->result_ok; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1); - CHECK(val->result_ok); - uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1; - return res_ref; -} -JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1); - CHECK(!val->result_ok); - return *val->contents.err; -} -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { - return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1); - CHECK(val->result_ok); - LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z"); - *res_conv = (*val->contents.result); - *res_conv = CResult_NetAddressu8Z_clone(res_conv); - return (uint64_t)res_conv; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1); - CHECK(!val->result_ok); - LDKDecodeError err_var = (*val->contents.err); - CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; - return err_ref; -} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok; } @@ -6338,9 +6707,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecod LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { @@ -6458,18 +6828,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDe LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKAcceptChannel res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6479,18 +6851,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSig LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKAnnouncementSignatures res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6500,18 +6874,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestabl LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelReestablish res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6521,18 +6897,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDe LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKClosingSigned res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6542,18 +6920,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFe LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKClosingSignedFeeRange res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6563,18 +6943,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSigne LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKCommitmentSigned res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6584,18 +6966,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedD LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKFundingCreated res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6605,18 +6989,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDe LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKFundingSigned res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6626,18 +7012,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDe LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKFundingLocked res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6647,18 +7035,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeError LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKInit res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6668,18 +7058,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDeco LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKOpenChannel res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6689,18 +7081,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDec LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKRevokeAndACK res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6710,18 +7104,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeE LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKShutdown res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6731,18 +7127,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCD LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKUpdateFailHTLC res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6752,18 +7150,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalfo LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKUpdateFailMalformedHTLC res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6773,18 +7173,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecode LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKUpdateFee res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6794,18 +7196,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHT LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKUpdateFulfillHTLC res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6815,18 +7219,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDe LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKUpdateAddHTLC res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6836,18 +7242,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeError LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKPing res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6857,18 +7265,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeError LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKPong res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6878,18 +7288,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannel LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKUnsignedChannelAnnouncement res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6899,18 +7311,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnounce LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelAnnouncement res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6920,18 +7334,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannel LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKUnsignedChannelUpdate res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6941,18 +7357,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDe LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKChannelUpdate res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6962,18 +7380,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDec LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKErrorMessage res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -6983,18 +7403,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnn LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKUnsignedNodeAnnouncement res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -7004,18 +7426,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncemen LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKNodeAnnouncement res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -7025,18 +7449,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChann LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKQueryShortChannelIds res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -7046,18 +7472,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChann LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKReplyShortChannelIdsEnd res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -7067,18 +7495,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRan LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKQueryChannelRange res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -7088,18 +7518,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRan LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKReplyChannelRange res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { @@ -7109,18 +7541,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestamp LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKGossipTimestampFilter res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t err_ref = (uint64_t)err_var.inner & ~1; + err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } static jclass LDKSignOrCreationError_SignError_class = NULL; @@ -7159,9 +7593,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCr LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1); CHECK(val->result_ok); LDKInvoice res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -7229,9 +7664,10 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void DO_ASSERT(get_jenv_res == JNI_OK); } LDKWatchedOutput output_var = output; + uint64_t output_ref = 0; CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t output_ref = (uint64_t)output_var.inner; + output_ref = (uint64_t)output_var.inner; if (output_var.is_owned) { output_ref |= 1; } @@ -7329,7 +7765,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1f LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1); switch(obj->tag) { case LDKCOption_FilterZ_Some: { - LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter"); + LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter"); *some_ret = obj->some; // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances if ((*some_ret).free == LDKFilter_JCalls_free) { @@ -7351,9 +7787,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMo LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); CHECK(val->result_ok); LDKLockedChannelMonitor res_var = (*val->contents.result); + uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t res_ref = (uint64_t)res_var.inner & ~1; + res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { @@ -7479,7 +7916,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvi if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr; LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t s = 0; s < ret_var.datalen; s++) { LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); @@ -7603,7 +8041,7 @@ void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEve } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); + LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); *handler_ret = handler; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); @@ -7814,7 +8252,8 @@ void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t int8_tArray header_arr = (*env)->NewByteArray(env, 80); (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header); LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata; - int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen); + int64_tArray txdata_arr = NULL; + txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen); int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL); for (size_t c = 0; c < txdata_var.datalen; c++) { LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ"); @@ -8001,13 +8440,15 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr; LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg); - jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); + jobjectArray ret_arr = NULL; + ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < ret_var.datalen; i++) { int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data); (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); } + FREE(ret_var.data); return ret_arr; } @@ -8036,7 +8477,7 @@ static void LDKPersist_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) { +LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -8045,24 +8486,34 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKOutPoint id_var = id; - CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t id_ref = (uint64_t)id_var.inner; - if (id_var.is_owned) { - id_ref |= 1; + LDKOutPoint channel_id_var = channel_id; + uint64_t channel_id_ref = 0; + CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + channel_id_ref = (uint64_t)channel_id_var.inner; + if (channel_id_var.is_owned) { + channel_id_ref |= 1; } LDKChannelMonitor data_var = *data; + uint64_t data_ref = 0; data_var = ChannelMonitor_clone(data); CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t data_ref = (uint64_t)data_var.inner; + data_ref = (uint64_t)data_var.inner; if (data_var.is_owned) { data_ref |= 1; } + LDKMonitorUpdateId update_id_var = update_id; + uint64_t update_id_ref = 0; + CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + update_id_ref = (uint64_t)update_id_var.inner; + if (update_id_var.is_owned) { + update_id_ref |= 1; + } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref); if ((*env)->ExceptionCheck(env)) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception."); @@ -8076,7 +8527,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con } return ret_conv; } -LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) { +LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -8085,32 +8536,45 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKOutPoint id_var = id; - CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t id_ref = (uint64_t)id_var.inner; - if (id_var.is_owned) { - id_ref |= 1; + LDKOutPoint channel_id_var = channel_id; + uint64_t channel_id_ref = 0; + CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + channel_id_ref = (uint64_t)channel_id_var.inner; + if (channel_id_var.is_owned) { + channel_id_ref |= 1; } LDKChannelMonitorUpdate update_var = *update; - update_var = ChannelMonitorUpdate_clone(update); - CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t update_ref = (uint64_t)update_var.inner; - if (update_var.is_owned) { - update_ref |= 1; + uint64_t update_ref = 0; + if ((uint64_t)update_var.inner > 4096) { + update_var = ChannelMonitorUpdate_clone(update); + CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + update_ref = (uint64_t)update_var.inner; + if (update_var.is_owned) { + update_ref |= 1; + } } LDKChannelMonitor data_var = *data; + uint64_t data_ref = 0; data_var = ChannelMonitor_clone(data); CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t data_ref = (uint64_t)data_var.inner; + data_ref = (uint64_t)data_var.inner; if (data_var.is_owned) { data_ref |= 1; } + LDKMonitorUpdateId update_id_var = update_id; + uint64_t update_id_ref = 0; + CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + update_id_ref = (uint64_t)update_id_var.inner; + if (update_id_var.is_owned) { + update_id_ref |= 1; + } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref); if ((*env)->ExceptionCheck(env)) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception."); @@ -8135,9 +8599,9 @@ static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) { atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J"); + calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J"); CHECK(calls->persist_new_channel_meth != NULL); - calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J"); + calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J"); CHECK(calls->update_persisted_channel_meth != NULL); LDKPersist ret = { @@ -8153,38 +8617,46 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env *res_ptr = LDKPersist_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t data) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr; - LDKOutPoint id_conv; - id_conv.inner = (void*)(id & (~1)); - id_conv.is_owned = (id & 1) || (id == 0); - id_conv = OutPoint_clone(&id_conv); + LDKOutPoint channel_id_conv; + channel_id_conv.inner = (void*)(channel_id & (~1)); + channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0); + channel_id_conv = OutPoint_clone(&channel_id_conv); LDKChannelMonitor data_conv; data_conv.inner = (void*)(data & (~1)); data_conv.is_owned = false; + LDKMonitorUpdateId update_id_conv; + update_id_conv.inner = (void*)(update_id & (~1)); + update_id_conv.is_owned = (update_id & 1) || (update_id == 0); + update_id_conv = MonitorUpdateId_clone(&update_id_conv); LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ"); - *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv); + *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t update, int64_t data) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr; - LDKOutPoint id_conv; - id_conv.inner = (void*)(id & (~1)); - id_conv.is_owned = (id & 1) || (id == 0); - id_conv = OutPoint_clone(&id_conv); + LDKOutPoint channel_id_conv; + channel_id_conv.inner = (void*)(channel_id & (~1)); + channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0); + channel_id_conv = OutPoint_clone(&channel_id_conv); LDKChannelMonitorUpdate update_conv; update_conv.inner = (void*)(update & (~1)); update_conv.is_owned = false; LDKChannelMonitor data_conv; data_conv.inner = (void*)(data & (~1)); data_conv.is_owned = false; + LDKMonitorUpdateId update_id_conv; + update_id_conv.inner = (void*)(update_id & (~1)); + update_id_conv.is_owned = (update_id & 1) || (update_id == 0); + update_id_conv = MonitorUpdateId_clone(&update_id_conv); LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ"); - *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv); + *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv); return (uint64_t)ret_conv; } @@ -8243,17 +8715,19 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInitFeatures their_features_var = their_features; + uint64_t their_features_ref = 0; CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t their_features_ref = (uint64_t)their_features_var.inner; + their_features_ref = (uint64_t)their_features_var.inner; if (their_features_var.is_owned) { their_features_ref |= 1; } LDKOpenChannel msg_var = *msg; + uint64_t msg_ref = 0; msg_var = OpenChannel_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8280,17 +8754,19 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInitFeatures their_features_var = their_features; + uint64_t their_features_ref = 0; CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t their_features_ref = (uint64_t)their_features_var.inner; + their_features_ref = (uint64_t)their_features_var.inner; if (their_features_var.is_owned) { their_features_ref |= 1; } LDKAcceptChannel msg_var = *msg; + uint64_t msg_ref = 0; msg_var = AcceptChannel_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8317,10 +8793,11 @@ void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingCreated msg_var = *msg; + uint64_t msg_ref = 0; msg_var = FundingCreated_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8347,10 +8824,11 @@ void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingSigned msg_var = *msg; + uint64_t msg_ref = 0; msg_var = FundingSigned_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8377,10 +8855,11 @@ void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKFundingLocked msg_var = *msg; + uint64_t msg_ref = 0; msg_var = FundingLocked_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8407,18 +8886,20 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInitFeatures their_features_var = *their_features; + uint64_t their_features_ref = 0; their_features_var = InitFeatures_clone(their_features); CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t their_features_ref = (uint64_t)their_features_var.inner; + their_features_ref = (uint64_t)their_features_var.inner; if (their_features_var.is_owned) { their_features_ref |= 1; } LDKShutdown msg_var = *msg; + uint64_t msg_ref = 0; msg_var = Shutdown_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8445,10 +8926,11 @@ void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKClosingSigned msg_var = *msg; + uint64_t msg_ref = 0; msg_var = ClosingSigned_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8475,10 +8957,11 @@ void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateAddHTLC msg_var = *msg; + uint64_t msg_ref = 0; msg_var = UpdateAddHTLC_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8505,10 +8988,11 @@ void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_ int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFulfillHTLC msg_var = *msg; + uint64_t msg_ref = 0; msg_var = UpdateFulfillHTLC_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8535,10 +9019,11 @@ void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFailHTLC msg_var = *msg; + uint64_t msg_ref = 0; msg_var = UpdateFailHTLC_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8565,10 +9050,11 @@ void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFailMalformedHTLC msg_var = *msg; + uint64_t msg_ref = 0; msg_var = UpdateFailMalformedHTLC_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8595,10 +9081,11 @@ void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_ar int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKCommitmentSigned msg_var = *msg; + uint64_t msg_ref = 0; msg_var = CommitmentSigned_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8625,10 +9112,11 @@ void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKRevokeAndACK msg_var = *msg; + uint64_t msg_ref = 0; msg_var = RevokeAndACK_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8655,10 +9143,11 @@ void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKUpdateFee msg_var = *msg; + uint64_t msg_ref = 0; msg_var = UpdateFee_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8685,10 +9174,11 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKAnnouncementSignatures msg_var = *msg; + uint64_t msg_ref = 0; msg_var = AnnouncementSignatures_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8737,10 +9227,11 @@ void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPubl int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInit msg_var = *msg; + uint64_t msg_ref = 0; msg_var = Init_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8767,10 +9258,11 @@ void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_ int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKChannelReestablish msg_var = *msg; + uint64_t msg_ref = 0; msg_var = ChannelReestablish_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8797,10 +9289,11 @@ void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKChannelUpdate msg_var = *msg; + uint64_t msg_ref = 0; msg_var = ChannelUpdate_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -8827,10 +9320,11 @@ void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublic int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKErrorMessage msg_var = *msg; + uint64_t msg_ref = 0; msg_var = ErrorMessage_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -9248,10 +9742,11 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler DO_ASSERT(get_jenv_res == JNI_OK); } LDKNodeAnnouncement msg_var = *msg; + uint64_t msg_ref = 0; msg_var = NodeAnnouncement_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -9281,10 +9776,11 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand DO_ASSERT(get_jenv_res == JNI_OK); } LDKChannelAnnouncement msg_var = *msg; + uint64_t msg_ref = 0; msg_var = ChannelAnnouncement_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -9314,10 +9810,11 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc DO_ASSERT(get_jenv_res == JNI_OK); } LDKChannelUpdate msg_var = *msg; + uint64_t msg_ref = 0; msg_var = ChannelUpdate_clone(msg); CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -9425,10 +9922,11 @@ void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDK int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInit init_var = *init; + uint64_t init_ref = 0; init_var = Init_clone(init); CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t init_ref = (uint64_t)init_var.inner; + init_ref = (uint64_t)init_var.inner; if (init_var.is_owned) { init_ref |= 1; } @@ -9455,9 +9953,10 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKReplyChannelRange msg_var = msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -9489,9 +9988,10 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKReplyShortChannelIdsEnd msg_var = msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -9523,9 +10023,10 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKQueryChannelRange msg_var = msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -9557,9 +10058,10 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKQueryShortChannelIds msg_var = msg; + uint64_t msg_ref = 0; CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t msg_ref = (uint64_t)msg_var.inner; + msg_ref = (uint64_t)msg_var.inner; if (msg_var.is_owned) { msg_ref |= 1; } @@ -9682,7 +10184,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_ if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t h = 0; h < ret_var.datalen; h++) { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ"); @@ -9702,13 +10205,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_ CHECK((*env)->GetArrayLength(env, starting_point) == 33); (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form); LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t s = 0; s < ret_var.datalen; s++) { LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s]; + uint64_t ret_conv_18_ref = 0; CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner; + ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner; if (ret_conv_18_var.is_owned) { ret_conv_18_ref |= 1; } @@ -9920,7 +10425,7 @@ LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jca } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType"); + LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType"); *msg_ret = msg; int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form); @@ -10039,7 +10544,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr; LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t z = 0; z < ret_var.datalen; z++) { LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ"); @@ -10233,6 +10739,8 @@ typedef struct LDKScore_JCalls { JavaVM *vm; jweak o; jmethodID channel_penalty_msat_meth; + jmethodID payment_path_failed_meth; + jmethodID write_meth; } LDKScore_JCalls; static void LDKScore_JCalls_free(void* this_arg) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -10251,7 +10759,7 @@ static void LDKScore_JCalls_free(void* this_arg) { FREE(j_calls); } } -uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) { +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -10260,9 +10768,27 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } else { DO_ASSERT(get_jenv_res == JNI_OK); } + LDKNodeId source_var = *source; + uint64_t source_ref = 0; + source_var = NodeId_clone(source); + CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + source_ref = (uint64_t)source_var.inner; + if (source_var.is_owned) { + source_ref |= 1; + } + LDKNodeId target_var = *target; + uint64_t target_ref = 0; + target_var = NodeId_clone(target); + CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + target_ref = (uint64_t)target_var.inner; + if (target_var.is_owned) { + target_ref |= 1; + } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id); + int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref); if ((*env)->ExceptionCheck(env)) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception."); @@ -10272,6 +10798,68 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } return ret; } +void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKCVec_RouteHopZ path_var = path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + path_conv_10_ref = (uint64_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + FREE(path_var.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} +LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception."); + } + LDKCVec_u8Z ret_ref; + ret_ref.datalen = (*env)->GetArrayLength(env, ret); + ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_ref; +} static void LDKScore_JCalls_cloned(LDKScore* new_obj) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -10283,12 +10871,18 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(J)J"); + calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J"); CHECK(calls->channel_penalty_msat_meth != NULL); + calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V"); + CHECK(calls->payment_path_failed_meth != NULL); + calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B"); + CHECK(calls->write_meth != NULL); LDKScore ret = { .this_arg = (void*) calls, .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, + .payment_path_failed = payment_path_failed_LDKScore_jcall, + .write = write_LDKScore_jcall, .free = LDKScore_JCalls_free, }; return ret; @@ -10298,21 +10892,61 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, *res_ptr = LDKScore_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t source, int64_t target) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; - int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id); + LDKNodeId source_conv; + source_conv.inner = (void*)(source & (~1)); + source_conv.is_owned = false; + LDKNodeId target_conv; + target_conv.inner = (void*)(target & (~1)); + target_conv.is_owned = false; + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv); return ret_val; } -typedef struct LDKChannelManagerPersister_JCalls { - atomic_size_t refcnt; - JavaVM *vm; - jweak o; - jmethodID persist_manager_meth; -} LDKChannelManagerPersister_JCalls; -static void LDKChannelManagerPersister_JCalls_free(void* this_arg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg); + 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; +} + +typedef struct LDKChannelManagerPersister_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID persist_manager_meth; +} LDKChannelManagerPersister_JCalls; +static void LDKChannelManagerPersister_JCalls_free(void* this_arg) { LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; @@ -10339,10 +10973,11 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi DO_ASSERT(get_jenv_res == JNI_OK); } LDKChannelManager channel_manager_var = *channel_manager; + uint64_t channel_manager_ref = 0; // Warning: we may need a move here but no clone is available for LDKChannelManager CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner; + channel_manager_ref = (uint64_t)channel_manager_var.inner; if (channel_manager_var.is_owned) { channel_manager_ref |= 1; } @@ -10446,98 +11081,504 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr default: abort(); } } -JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) { - LDKStr ret_str = _ldk_get_compiled_version(); - jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); - Str_free(ret_str); - return ret_conv; +typedef struct LDKPayer_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID node_id_meth; + jmethodID first_hops_meth; + jmethodID send_payment_meth; + jmethodID retry_payment_meth; +} LDKPayer_JCalls; +static void LDKPayer_JCalls_free(void* this_arg) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } } - -JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) { - LDKStr ret_str = _ldk_c_bindings_get_compiled_version(); - jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); - Str_free(ret_str); +LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception."); + } + LDKPublicKey ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 33); + (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_ref; +} +LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception."); + } + LDKCVec_ChannelDetailsZ ret_constr; + ret_constr.datalen = (*env)->GetArrayLength(env, ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + ret_constr.data = NULL; + int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); + for (size_t q = 0; q < ret_constr.datalen; q++) { + int64_t ret_conv_16 = ret_vals[q]; + LDKChannelDetails ret_conv_16_conv; + ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1)); + ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0); + ret_conv_16_conv = ChannelDetails_clone(&ret_conv_16_conv); + ret_constr.data[q] = ret_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_constr; +} +LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(route); + CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + route_ref = (uint64_t)route_var.inner; + if (route_var.is_owned) { + route_ref |= 1; + } + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data); + int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception."); + } + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr); + ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone((LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)ret) & ~1)); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } return ret_conv; } - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) { - LDKTransaction _res_ref; - _res_ref.datalen = (*env)->GetArrayLength(env, _res); - _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes"); - (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data); - _res_ref.data_is_owned = true; - Transaction_free(_res_ref); +LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(route); + CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + route_ref = (uint64_t)route_var.inner; + if (route_var.is_owned) { + route_ref |= 1; + } + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception."); + } + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); + ret_conv = CResult_NonePaymentSendFailureZ_clone((LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)ret) & ~1)); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; } - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) { - LDKCVec_u8Z script_pubkey_ref; - script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey); - script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data); - LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); - *ret_ref = TxOut_new(script_pubkey_ref, value); - return (uint64_t)ret_ref; +static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr); - FREE((void*)_res); - TxOut_free(_res_conv); +static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B"); + CHECK(calls->node_id_meth != NULL); + calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J"); + CHECK(calls->first_hops_meth != NULL); + calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J"); + CHECK(calls->send_payment_meth != NULL); + calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J"); + CHECK(calls->retry_payment_meth != NULL); + + LDKPayer ret = { + .this_arg = (void*) calls, + .node_id = node_id_LDKPayer_jcall, + .first_hops = first_hops_LDKPayer_jcall, + .send_payment = send_payment_LDKPayer_jcall, + .retry_payment = retry_payment_LDKPayer_jcall, + .free = LDKPayer_JCalls_free, + }; + return ret; } - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1); - LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); - *ret_ref = TxOut_clone(orig_conv); - return (uint64_t)ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) { + LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer"); + *res_ptr = LDKPayer_init(env, clz, o); + return (uint64_t)res_ptr; } - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) { - LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false }; - Str_free(dummy); +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form); + return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { - LDKSecretKey o_ref; - CHECK((*env)->GetArrayLength(env, o) == 32); - (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes); - LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); - *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref); - return (uint64_t)ret_conv; +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); + for (size_t q = 0; q < ret_var.datalen; q++) { + LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + uint64_t ret_conv_16_ref = 0; + CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner; + if (ret_conv_16_var.is_owned) { + ret_conv_16_ref |= 1; + } + ret_arr_ptr[q] = ret_conv_16_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { - LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e); - LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); - *ret_conv = CResult_SecretKeyErrorZ_err(e_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + CHECK((*env)->GetArrayLength(env, payment_secret) == 32); + (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_SecretKeyErrorZ_free(_res_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { - LDKPublicKey o_ref; - CHECK((*env)->GetArrayLength(env, o) == 33); - (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form); - LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); - *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { - LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e); - LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); - *ret_conv = CResult_PublicKeyErrorZ_err(e_conv); +typedef struct LDKRouter_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID find_route_meth; +} LDKRouter_JCalls; +static void LDKRouter_JCalls_free(void* this_arg) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + int8_tArray payer_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); + LDKRouteParameters params_var = *params; + uint64_t params_ref = 0; + params_var = RouteParameters_clone(params); + CHECK((((uint64_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + params_ref = (uint64_t)params_var.inner; + if (params_var.is_owned) { + params_ref |= 1; + } + LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; + int64_tArray first_hops_arr = NULL; + if (first_hops != NULL) { + LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; + first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); + int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); + for (size_t q = 0; q < first_hops_var.datalen; q++) { + LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; + uint64_t first_hops_conv_16_ref = 0; + CHECK((((uint64_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + first_hops_conv_16_ref = (uint64_t)first_hops_conv_16_var.inner; + if (first_hops_conv_16_var.is_owned) { + first_hops_conv_16_ref |= 1; + } + first_hops_arr_ptr[q] = first_hops_conv_16_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); + } + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_scorer = ((uint64_t)scorer) | 1; + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); + } + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); + ret_conv = CResult_RouteLightningErrorZ_clone((LDKCResult_RouteLightningErrorZ*)(((uint64_t)ret) & ~1)); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J"); + CHECK(calls->find_route_meth != NULL); + + LDKRouter ret = { + .this_arg = (void*) calls, + .find_route = find_route_LDKRouter_jcall, + .free = LDKRouter_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) { + LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter"); + *res_ptr = LDKRouter_init(env, clz, o); + return (uint64_t)res_ptr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t params, int64_tArray first_hops, int64_t scorer) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; + LDKPublicKey payer_ref; + CHECK((*env)->GetArrayLength(env, payer) == 33); + (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); + LDKRouteParameters params_conv; + params_conv.inner = (void*)(params & (~1)); + params_conv.is_owned = false; + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1); + if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } + LDKScore* scorer_conv = (LDKScore*)scorer_ptr; + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return (uint64_t)ret_conv; +} + +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) { + LDKStr ret_str = _ldk_get_compiled_version(); + jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); + Str_free(ret_str); + return ret_conv; +} + +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) { + LDKStr ret_str = _ldk_c_bindings_get_compiled_version(); + jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); + Str_free(ret_str); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) { + LDKTransaction _res_ref; + _res_ref.datalen = (*env)->GetArrayLength(env, _res); + _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes"); + (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data); + _res_ref.data_is_owned = true; + Transaction_free(_res_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) { + LDKCVec_u8Z script_pubkey_ref; + script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey); + script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data); + LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); + *ret_ref = TxOut_new(script_pubkey_ref, value); + return (uint64_t)ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr); + FREE((void*)_res); + TxOut_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1); + LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); + *ret_ref = TxOut_clone(orig_conv); + return (uint64_t)ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) { + LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false }; + Str_free(dummy); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKSecretKey o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes); + LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); + *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e); + LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); + *ret_conv = CResult_SecretKeyErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_SecretKeyErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKPublicKey o_ref; + CHECK((*env)->GetArrayLength(env, o) == 33); + (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form); + LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); + *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e); + LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); + *ret_conv = CResult_PublicKeyErrorZ_err(e_conv); return (uint64_t)ret_conv; } @@ -11238,54 +12279,40 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_ return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) { - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = COption_u64Z_some(o); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteParameters o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = RouteParameters_clone(&o_conv); + LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); + *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) { - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = COption_u64Z_none(); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); + *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr); + LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - COption_u64Z_free(_res_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = COption_u64Z_clone(orig_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; + CResult_RouteParametersDecodeErrorZ_free(_res_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_ChannelDetailsZ _res_constr; - _res_constr.datalen = (*env)->GetArrayLength(env, _res); - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - _res_constr.data = NULL; - int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t q = 0; q < _res_constr.datalen; q++) { - int64_t _res_conv_16 = _res_vals[q]; - LDKChannelDetails _res_conv_16_conv; - _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1)); - _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0); - _res_constr.data[q] = _res_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_ChannelDetailsZ_free(_res_constr); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1); + LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); + *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { @@ -11307,33 +12334,210 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv CVec_RouteHintZ_free(_res_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKRoute o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = (o & 1) || (o == 0); - o_conv = Route_clone(&o_conv); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv); - return (uint64_t)ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) { + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = COption_u64Z_some(o); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - LDKLightningError e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - e_conv = LightningError_clone(&e_conv); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = CResult_RouteLightningErrorZ_err(e_conv); - return (uint64_t)ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) { + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = COption_u64Z_none(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr); + LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr); FREE((void*)_res); - CResult_RouteLightningErrorZ_free(_res_conv); + COption_u64Z_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = COption_u64Z_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPayee o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = Payee_clone(&o_conv); + LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); + *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); + *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_PayeeDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1); + LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); + *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_RouteHintHopZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t o = 0; o < _res_constr.datalen; o++) { + int64_t _res_conv_14 = _res_vals[o]; + LDKRouteHintHop _res_conv_14_conv; + _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1)); + _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0); + _res_constr.data[o] = _res_conv_14_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_RouteHintHopZ_free(_res_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteHint o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = RouteHint_clone(&o_conv); + LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ"); + *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ"); + *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_RouteHintDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1); + LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ"); + *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteHintHop o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = RouteHintHop_clone(&o_conv); + LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ"); + *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ"); + *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_RouteHintHopDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1); + LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ"); + *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_ChannelDetailsZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t q = 0; q < _res_constr.datalen; q++) { + int64_t _res_conv_16 = _res_vals[q]; + LDKChannelDetails _res_conv_16_conv; + _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1)); + _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0); + _res_constr.data[q] = _res_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_ChannelDetailsZ_free(_res_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKRoute o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = Route_clone(&o_conv); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKLightningError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + e_conv = LightningError_clone(&e_conv); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = CResult_RouteLightningErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_RouteLightningErrorZ_free(_res_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { @@ -11715,6 +12919,64 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecode CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKScoringParameters o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + // Warning: we need a move here but no clone is available for LDKScoringParameters + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ScoringParametersDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKScorer o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + // Warning: we need a move here but no clone is available for LDKScorer + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ScorerDecodeErrorZ_free(_res_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKDelayedPaymentOutputDescriptor o_conv; o_conv.inner = (void*)(o & (~1)); @@ -12273,42 +13535,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1Blo return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKPaymentId o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = (o & 1) || (o == 0); - o_conv = PaymentId_clone(&o_conv); - LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); - *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_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); - e_conv = DecodeError_clone(&e_conv); - LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); - *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_PaymentIdDecodeErrorZ_free(_res_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1); - LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); - *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv); - return (uint64_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) { LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z"); *ret_copy = COption_u16Z_some(o); @@ -12447,13 +13673,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1c return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKPaymentId o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = (o & 1) || (o == 0); - o_conv = PaymentId_clone(&o_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); - *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref); return (uint64_t)ret_conv; } @@ -12522,16 +13747,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPayment return ((uint64_t)ret_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) { LDKThirtyTwoBytes a_ref; CHECK((*env)->GetArrayLength(env, a) == 32); (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data); - LDKPaymentId b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = (b & 1) || (b == 0); - b_conv = PaymentId_clone(&b_conv); + LDKThirtyTwoBytes b_ref; + CHECK((*env)->GetArrayLength(env, b) == 32); + (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data); LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); - *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref); return ((uint64_t)ret_conv); } @@ -12879,6 +14103,41 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDeco return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr); + e_conv = PaymentError_clone((LDKPaymentError*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentIdPaymentErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1); + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) { LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o); LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); @@ -14368,107 +15627,39 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = (void*)(((uint64_t)o) & ~1); CHECK_ACCESS(o_ptr); LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr); o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1)); - LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z"); - *ret_conv = CResult_NetAddressu8Z_ok(o_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) { - LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z"); - *ret_conv = CResult_NetAddressu8Z_err(e); - return (uint64_t)ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(_res_ptr); - FREE((void*)_res); - CResult_NetAddressu8Z_free(_res_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1); - LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z"); - *ret_conv = CResult_NetAddressu8Z_clone(orig_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = (void*)(((uint64_t)o) & ~1); - CHECK_ACCESS(o_ptr); - LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(o_ptr); - o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1)); - LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ"); - *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv); + LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ"); + *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_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); e_conv = DecodeError_clone(&e_conv); - LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ"); - *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv); + LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ"); + *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(_res_ptr); + LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv); + CResult_NetAddressDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1); - LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ"); - *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = (void*)(((uint64_t)o) & ~1); - CHECK_ACCESS(o_ptr); - LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr); - o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1)); - LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ"); - *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_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); - e_conv = DecodeError_clone(&e_conv); - LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ"); - *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_NetAddressDecodeErrorZ_free(_res_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1); - LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ"); - *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1); + LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ"); + *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv); return (uint64_t)ret_conv; } @@ -15972,20 +17163,30 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JN return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_hash) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); LDKThirtyTwoBytes payment_preimage_ref; CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); LDKThirtyTwoBytes payment_hash_ref; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1); + CHECK_ACCESS(fee_paid_msat_ptr); + LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr); + fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref); + *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); LDKThirtyTwoBytes payment_hash_ref; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); @@ -16013,8 +17214,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile CHECK_ACCESS(short_channel_id_ptr); LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr); short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1)); + LDKRouteParameters retry_conv; + retry_conv.inner = (void*)(retry & (~1)); + retry_conv.is_owned = (retry & 1) || (retry == 0); + retry_conv = RouteParameters_clone(&retry_conv); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv); + *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -16620,9 +17825,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1o JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) { LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16634,9 +17840,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clo orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16645,9 +17852,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clo JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) { LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16783,9 +17991,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1t JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) { LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16797,9 +18006,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clo orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16808,9 +18018,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clo JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) { LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16931,9 +18142,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1clo JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) { LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16945,9 +18157,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16956,9 +18169,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) { LDKChannelConfig ret_var = ChannelConfig_default(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -16998,9 +18212,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1chann this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17023,9 +18238,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1chan this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17048,9 +18264,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1o this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17097,9 +18314,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0); channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv); LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17111,9 +18329,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *e orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUserConfig ret_var = UserConfig_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17122,9 +18341,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *e JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) { LDKUserConfig ret_var = UserConfig_default(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17143,9 +18363,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *en orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKBestBlock ret_var = BestBlock_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17155,9 +18376,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *en JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) { LDKNetwork network_conv = LDKNetwork_from_java(env, network); LDKBestBlock ret_var = BestBlock_from_genesis(network_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17169,9 +18391,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, CHECK((*env)->GetArrayLength(env, block_hash) == 32); (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data); LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17303,9 +18526,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoin this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17357,9 +18581,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv * script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes"); (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data); LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17371,9 +18596,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17434,6 +18660,47 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env FeeEstimator_free(this_ptr_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKMonitorUpdateId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + MonitorUpdateId_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKMonitorUpdateId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKMonitorUpdateId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = MonitorUpdateId_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKMonitorUpdateId a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKMonitorUpdateId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv); + return ret_val; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); @@ -17498,9 +18765,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *e LDKPersist_JCalls_cloned(&persister_conv); } LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17528,7 +18796,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1cla } (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0); LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t j = 0; j < ret_var.datalen; j++) { LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance"); @@ -17559,13 +18828,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1mo this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t k = 0; k < ret_var.datalen; k++) { LDKOutPoint ret_conv_10_var = ret_var.data[k]; + uint64_t ret_conv_10_ref = 0; CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner; + ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner; if (ret_conv_10_var.is_owned) { ret_conv_10_ref |= 1; } @@ -17576,11 +18847,28 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1mo return ret_arr; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKOutPoint funding_txo_conv; + funding_txo_conv.inner = (void*)(funding_txo & (~1)); + funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0); + funding_txo_conv = OutPoint_clone(&funding_txo_conv); + LDKMonitorUpdateId completed_update_id_conv; + completed_update_id_conv.inner = (void*)(completed_update_id & (~1)); + completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0); + completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) { LDKChainMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen"); + LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen"); *ret_ret = ChainMonitor_as_Listen(&this_arg_conv); return (uint64_t)ret_ret; } @@ -17589,7 +18877,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(J LDKChainMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm"); + LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm"); *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv); return (uint64_t)ret_ret; } @@ -17598,7 +18886,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNI LDKChainMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch"); + LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch"); *ret_ret = ChainMonitor_as_Watch(&this_arg_conv); return (uint64_t)ret_ret; } @@ -17607,7 +18895,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsPro LDKChainMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider"); + LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider"); *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv); return (uint64_t)ret_ret; } @@ -17639,9 +18927,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17676,14 +18965,46 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEn MonitorUpdateError_free(this_obj_conv); } +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKMonitorUpdateError this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv); + jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); + Str_free(ret_str); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) { + LDKMonitorUpdateError this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKStr val_conv = java_to_owned_str(env, val); + MonitorUpdateError_set_a(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1new(JNIEnv *env, jclass clz, jstring a_arg) { + LDKStr a_arg_conv = java_to_owned_str(env, a_arg); + LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) { LDKMonitorUpdateError orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17729,6 +19050,37 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1t return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) { + LDKOutPoint funding_txo_conv; + funding_txo_conv.inner = (void*)(funding_txo & (~1)); + funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0); + funding_txo_conv = OutPoint_clone(&funding_txo_conv); + LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); + *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) { + LDKOutPoint a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = (a & 1) || (a == 0); + a_conv = OutPoint_clone(&a_conv); + LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); + *ret_copy = MonitorEvent_update_failed(a_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj; + LDKCVec_u8Z ret_var = MonitorEvent_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 void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKHTLCUpdate this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -17741,9 +19093,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *e orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17835,9 +19188,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEn orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -17898,7 +19252,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1o this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t o = 0; o < ret_var.datalen; o++) { LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ"); @@ -17925,7 +19280,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1a this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t o = 0; o < ret_var.datalen; o++) { LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); @@ -17943,7 +19299,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1a this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t h = 0; h < ret_var.datalen; h++) { LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); @@ -17964,7 +19321,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1l if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); } LDKLogger* logger_conv = (LDKLogger*)logger_ptr; LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv); - jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); + jobjectArray ret_arr = NULL; + ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < ret_var.datalen; i++) { LDKTransaction ret_conv_8_var = ret_var.data[i]; @@ -17973,6 +19331,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1l Transaction_free(ret_conv_8_var); (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); } + FREE(ret_var.data); return ret_arr; } @@ -18023,7 +19382,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_ LDKLogger_JCalls_cloned(&logger_conv); } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t n = 0; n < ret_var.datalen; n++) { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); @@ -18113,7 +19473,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transa LDKLogger_JCalls_cloned(&logger_conv); } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t n = 0; n < ret_var.datalen; n++) { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); @@ -18187,7 +19548,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1 LDKLogger_JCalls_cloned(&logger_conv); } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t n = 0; n < ret_var.datalen; n++) { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); @@ -18204,13 +19566,15 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1r this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv); - jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); + jobjectArray ret_arr = NULL; + ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < ret_var.datalen; i++) { int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data); (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); } + FREE(ret_var.data); return ret_arr; } @@ -18220,9 +19584,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1be this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18234,7 +19599,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1c this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t j = 0; j < ret_var.datalen; j++) { LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance"); @@ -18306,9 +19672,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, CHECK((*env)->GetArrayLength(env, txid_arg) == 32); (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data); LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18320,9 +19687,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKOutPoint ret_var = OutPoint_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18390,9 +19758,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescrip this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18527,9 +19896,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescrip CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data); LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18541,9 +19911,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescrip orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18583,9 +19954,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescript this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18661,9 +20033,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescript CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data); LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18675,9 +20048,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescript orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18791,7 +20165,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jc void* orig_ptr = (void*)(((uint64_t)orig) & ~1); if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); } LDKSign* orig_conv = (LDKSign*)orig_ptr; - LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign"); + LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); *ret_ret = Sign_clone(orig_conv); return (uint64_t)ret_ret; } @@ -18940,9 +20314,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEn orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18972,9 +20347,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32); (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data); LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -18986,9 +20362,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterpart this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19024,9 +20401,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1ou this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19038,9 +20416,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channe this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19085,7 +20464,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSig LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign"); + LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign"); *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv); return (uint64_t)ret_ret; } @@ -19094,7 +20473,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JN LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign"); + LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); *ret_ret = InMemorySigner_as_Sign(&this_arg_conv); return (uint64_t)ret_ret; } @@ -19133,9 +20512,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *en (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr); unsigned char (*seed_ref)[32] = &seed_arr; LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19151,9 +20531,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channe (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr); unsigned char (*params_ref)[32] = ¶ms_arr; LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19209,72 +20590,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterf LDKKeysManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); + LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv); return (uint64_t)ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKPaymentId this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - PaymentId_free(this_obj_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKPaymentId o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = PaymentId_hash(&o_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKPaymentId orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKPaymentId ret_var = PaymentId_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKPaymentId a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKPaymentId b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = PaymentId_eq(&a_conv, &b_conv); - return ret_val; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentId_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKPaymentId obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = PaymentId_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_PaymentId_1read(JNIEnv *env, jclass clz, int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = (*env)->GetArrayLength(env, ser); - ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); - *ret_conv = PaymentId_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelManager this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -19310,9 +20630,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_ this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19337,9 +20658,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0); best_block_arg_conv = BestBlock_clone(&best_block_arg_conv); LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19351,9 +20673,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIE orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChainParameters ret_var = ChainParameters_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19414,9 +20737,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1se JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) { LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19428,9 +20752,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_ orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19468,9 +20793,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1f this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19508,11 +20834,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1f this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -19541,9 +20870,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JN forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0); forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv); LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19555,9 +20885,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone( orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19595,9 +20926,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counte this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19620,11 +20952,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1fundin this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -19872,9 +21207,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1)); LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19886,9 +21222,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEn orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -19969,25 +21306,31 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1fa return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray a) { - LDKCVec_CResult_NoneAPIErrorZZ a_constr; - a_constr.datalen = (*env)->GetArrayLength(env, a); - if (a_constr.datalen > 0) - a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) { + LDKCVec_CResult_NoneAPIErrorZZ results_constr; + results_constr.datalen = (*env)->GetArrayLength(env, results); + if (results_constr.datalen > 0) + results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); else - a_constr.data = NULL; - int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); - for (size_t w = 0; w < a_constr.datalen; w++) { - int64_t a_conv_22 = a_vals[w]; - void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1); - CHECK_ACCESS(a_conv_22_ptr); - LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr); - a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1)); - a_constr.data[w] = a_conv_22_conv; - } - (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); + results_constr.data = NULL; + int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL); + for (size_t w = 0; w < results_constr.datalen; w++) { + int64_t results_conv_22 = results_vals[w]; + void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1); + CHECK_ACCESS(results_conv_22_ptr); + LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr); + results_constr.data[w] = results_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, results, results_vals, 0); + LDKRouteParameters failed_paths_retry_conv; + failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1)); + failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0); + failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_partial_failure(a_constr); + *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -20037,9 +21380,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv params_conv.is_owned = (params & 1) || (params == 0); params_conv = ChainParameters_clone(¶ms_conv); LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20051,9 +21395,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1curren this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20081,13 +21426,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1 this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t q = 0; q < ret_var.datalen; q++) { LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + uint64_t ret_conv_16_ref = 0; CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner; + ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner; if (ret_conv_16_var.is_owned) { ret_conv_16_ref |= 1; } @@ -20103,13 +21450,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1 this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t q = 0; q < ret_var.datalen; q++) { LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + uint64_t ret_conv_16_ref = 0; CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner; + ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner; if (ret_conv_16_var.is_owned) { ret_conv_16_ref |= 1; } @@ -20184,19 +21533,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payme return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int64_t payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKRoute route_conv; route_conv.inner = (void*)(route & (~1)); route_conv.is_owned = false; - LDKPaymentId payment_id_conv; - payment_id_conv.inner = (void*)(payment_id & (~1)); - payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0); - payment_id_conv = PaymentId_clone(&payment_id_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv); + *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref); return (uint64_t)ret_conv; } @@ -20307,16 +21655,6 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1ou return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) { - LDKChannelManager this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKOutPoint funding_txo_conv; - funding_txo_conv.inner = (void*)(funding_txo & (~1)); - funding_txo_conv.is_owned = false; - ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -20350,7 +21688,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Message LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); + LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv); return (uint64_t)ret_ret; } @@ -20359,7 +21697,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsP LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider"); + LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider"); *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv); return (uint64_t)ret_ret; } @@ -20368,7 +21706,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen( LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen"); + LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen"); *ret_ret = ChannelManager_as_Listen(&this_arg_conv); return (uint64_t)ret_ret; } @@ -20377,7 +21715,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm"); + LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm"); *ret_ret = ChannelManager_as_Confirm(&this_arg_conv); return (uint64_t)ret_ret; } @@ -20402,9 +21740,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1be this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20415,7 +21754,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Channel LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); + LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv); return (uint64_t)ret_ret; } @@ -20442,7 +21781,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv); + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1; return ret_ret; } @@ -20464,7 +21804,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv); + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1; return ret_ret; } @@ -20486,7 +21827,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv); + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1; return ret_ret; } @@ -20508,7 +21850,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv); + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1; return ret_ret; } @@ -20530,7 +21873,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv); + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1; return ret_ret; } @@ -20553,9 +21897,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20629,9 +21974,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new } (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0); LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20664,9 +22010,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv * orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKDecodeError ret_var = DecodeError_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20685,9 +22032,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20711,9 +22059,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jcla features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); features_arg_conv = InitFeatures_clone(&features_arg_conv); LDKInit ret_var = Init_new(features_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20725,9 +22074,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jc orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKInit ret_var = Init_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20784,9 +22134,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *e (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKStr data_arg_conv = java_to_owned_str(env, data_arg); LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20798,9 +22149,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20846,9 +22198,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *en JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) { LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20860,9 +22213,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jc orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKPing ret_var = Ping_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20893,9 +22247,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *en JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) { LDKPong ret_var = Pong_new(byteslen_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -20907,9 +22262,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jc orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKPong ret_var = Pong_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21230,9 +22586,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21489,9 +22846,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21588,9 +22946,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv CHECK((*env)->GetArrayLength(env, signature_arg) == 64); (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form); LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21602,9 +22961,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEn orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21664,9 +23024,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * CHECK((*env)->GetArrayLength(env, signature_arg) == 64); (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form); LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21678,9 +23039,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21740,9 +23102,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33); (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form); LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21754,9 +23117,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21819,9 +23183,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes"); (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data); LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21833,9 +23198,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKShutdown ret_var = Shutdown_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21881,9 +23247,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1ma JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) { LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21895,9 +23262,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clon orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -21969,11 +23337,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1ra this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -22001,9 +23372,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0); fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv); LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22015,9 +23387,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22119,9 +23492,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22196,9 +23570,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIE CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32); (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data); LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22210,9 +23585,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JN orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22265,9 +23641,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEn orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22335,9 +23712,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1cl orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22430,9 +23808,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEn htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref; } LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22444,9 +23823,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNI orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22528,9 +23908,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *e CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33); (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form); LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22542,9 +23923,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22597,9 +23979,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22611,9 +23994,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *en orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22673,9 +24057,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33); (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form); LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22687,9 +24072,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIE orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22757,9 +24143,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(J orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22856,9 +24243,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64); (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form); LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22870,9 +24258,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clo orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -22945,16 +24334,6 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEn return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = (*env)->GetArrayLength(env, ser); - ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ"); - *ret_conv = Result_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); @@ -22977,9 +24356,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1g this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23097,9 +24477,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1c orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23137,9 +24518,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1cont this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23166,9 +24548,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEn contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0); contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv); LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23180,9 +24563,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNI orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23201,9 +24585,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23336,9 +24721,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23433,9 +24819,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1c this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23471,9 +24858,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JN contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0); contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv); LDKChannelAnnouncement ret_var = ChannelAnnouncement_new(node_signature_1_arg_ref, node_signature_2_arg_ref, bitcoin_signature_1_arg_ref, bitcoin_signature_2_arg_ref, contents_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23485,9 +24873,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone( orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23630,9 +25019,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clon orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23670,9 +25060,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1content this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23699,9 +25090,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0); contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv); LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23713,9 +25105,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23783,9 +25176,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIE CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32); (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23797,9 +25191,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JN orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23913,9 +25308,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIE } (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0); LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23927,9 +25323,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JN orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -23998,9 +25395,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(J } (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0); LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24012,9 +25410,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24067,9 +25466,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1ne CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32); (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24081,9 +25481,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1cl orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24151,9 +25552,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new( CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32); (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24165,9 +25567,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clon orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24281,9 +25684,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr); action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1)); LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24295,9 +25699,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEn orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKLightningError ret_var = LightningError_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24316,13 +25721,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_ this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t p = 0; p < ret_var.datalen; p++) { LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p]; + uint64_t ret_conv_15_ref = 0; CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner; + ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner; if (ret_conv_15_var.is_owned) { ret_conv_15_ref |= 1; } @@ -24361,13 +25768,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_ this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t t = 0; t < ret_var.datalen; t++) { LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t]; + uint64_t ret_conv_19_ref = 0; CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner; + ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner; if (ret_conv_19_var.is_owned) { ret_conv_19_ref |= 1; } @@ -24406,13 +25815,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_ this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t q = 0; q < ret_var.datalen; q++) { LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q]; + uint64_t ret_conv_16_ref = 0; CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner; + ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner; if (ret_conv_16_var.is_owned) { ret_conv_16_ref |= 1; } @@ -24451,13 +25862,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_ this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t z = 0; z < ret_var.datalen; z++) { LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z]; + uint64_t ret_conv_25_ref = 0; CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner; + ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner; if (ret_conv_25_var.is_owned) { ret_conv_25_ref |= 1; } @@ -24496,11 +25909,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1upda this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -24521,9 +25937,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1comm this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24615,9 +26032,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEn commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0); commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv); LDKCommitmentUpdate ret_var = CommitmentUpdate_new(update_add_htlcs_arg_constr, update_fulfill_htlcs_arg_constr, update_fail_htlcs_arg_constr, update_fail_malformed_htlcs_arg_constr, update_fee_arg_conv, commitment_signed_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -24629,9 +26047,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNI orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -25354,9 +26773,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(J JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) { LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -25367,7 +26787,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_ LDKIgnoringMessageHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); + LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv); return (uint64_t)ret_ret; } @@ -25376,7 +26796,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_ LDKIgnoringMessageHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); + LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv); return (uint64_t)ret_ret; } @@ -25385,7 +26805,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_ LDKIgnoringMessageHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader"); + LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader"); *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv); return (uint64_t)ret_ret; } @@ -25394,7 +26814,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_ LDKIgnoringMessageHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler"); + LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler"); *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv); return (uint64_t)ret_ret; } @@ -25408,9 +26828,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(J JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) { LDKErroringMessageHandler ret_var = ErroringMessageHandler_new(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -25421,7 +26842,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_ LDKErroringMessageHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); + LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv); return (uint64_t)ret_ret; } @@ -25430,7 +26851,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_ LDKErroringMessageHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); + LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv); return (uint64_t)ret_ret; } @@ -25446,7 +26867,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1 LDKMessageHandler this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv); + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1; return ret_ret; } @@ -25468,7 +26890,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_ LDKMessageHandler this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv); + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1; return ret_ret; } @@ -25502,9 +26925,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv); } LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -25515,7 +26939,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNI void* orig_ptr = (void*)(((uint64_t)orig) & ~1); if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); } LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr; - LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor"); + LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor"); *ret_ret = SocketDescriptor_clone(orig_conv); return (uint64_t)ret_ret; } @@ -25553,9 +26977,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1conn JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) { LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -25567,9 +26992,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIE orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -25610,9 +27036,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *en LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv); } LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -25624,13 +27051,15 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv); - jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); + jobjectArray ret_arr = NULL; + ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < ret_var.datalen; i++) { int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form); (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); } + FREE(ret_var.data); return ret_arr; } @@ -25725,6 +27154,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1n PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPeerManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + PeerManager_disconnect_all_peers(&this_arg_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPeerManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -25932,9 +27368,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33); (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form); LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -25946,9 +27383,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEn orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26095,9 +27533,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIE CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33); (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form); LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26109,9 +27548,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JN orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26290,9 +27730,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1new LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr); transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1)); LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26304,9 +27745,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clo orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26395,9 +27837,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26450,11 +27893,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -26475,11 +27921,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -26509,9 +27958,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0); funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv); LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26523,9 +27973,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26544,9 +27995,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransact this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26585,9 +28037,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransact pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0); pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv); LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26599,9 +28052,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransact orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26621,9 +28075,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26635,9 +28090,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26698,9 +28154,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionP this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26712,9 +28169,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionP this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26742,9 +28200,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionP this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26802,9 +28261,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26860,9 +28320,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33); (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form); LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26928,9 +28389,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_ CHECK((*env)->GetArrayLength(env, txid_arg) == 32); (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data); LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -26942,9 +28404,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_ orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27014,9 +28477,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(J orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27045,9 +28509,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNI funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0); funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv); LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27059,9 +28524,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(J this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27177,9 +28643,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clon orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27244,9 +28711,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trus this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27292,9 +28760,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransactio this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27306,9 +28775,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransactio this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27391,9 +28861,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27405,9 +28876,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27419,9 +28891,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIE orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27433,9 +28906,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIE orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27472,9 +28946,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv * JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) { LDKInitFeatures ret_var = InitFeatures_empty(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27483,9 +28958,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) { LDKInitFeatures ret_var = InitFeatures_known(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27502,9 +28978,10 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1un JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) { LDKNodeFeatures ret_var = NodeFeatures_empty(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27513,9 +28990,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) { LDKNodeFeatures ret_var = NodeFeatures_known(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27532,9 +29010,10 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1un JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) { LDKChannelFeatures ret_var = ChannelFeatures_empty(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27543,9 +29022,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIE JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) { LDKChannelFeatures ret_var = ChannelFeatures_known(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27562,9 +29042,10 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) { LDKInvoiceFeatures ret_var = InvoiceFeatures_empty(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27573,9 +29054,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIE JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) { LDKInvoiceFeatures ret_var = InvoiceFeatures_known(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27710,9 +29192,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEn orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27753,9 +29236,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new( script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes"); (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data); LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27767,9 +29251,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clon orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27803,9 +29288,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr); unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr; LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27818,9 +29304,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh( (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr); unsigned char (*script_hash_ref)[32] = &script_hash_arr; LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27882,7 +29369,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jc void* orig_ptr = (void*)(((uint64_t)orig) & ~1); if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); } LDKType* orig_conv = (LDKType*)orig_ptr; - LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType"); + LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType"); *ret_ret = Type_clone(orig_conv); return (uint64_t)ret_ret; } @@ -27905,6 +29392,43 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclas Score_free(this_ptr_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKLockableScore this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + LockableScore_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1new(JNIEnv *env, jclass clz, int64_t score) { + void* score_ptr = (void*)(((uint64_t)score) & ~1); + CHECK_ACCESS(score_ptr); + LDKScore score_conv = *(LDKScore*)(score_ptr); + if (score_conv.free == LDKScore_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKScore_JCalls_cloned(&score_conv); + } + LDKLockableScore ret_var = LockableScore_new(score_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKLockableScore obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = LockableScore_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 void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKNodeId this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -27917,9 +29441,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKNodeId ret_var = NodeId_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27931,9 +29456,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv CHECK((*env)->GetArrayLength(env, pubkey) == 33); (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -27991,9 +29517,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28065,7 +29592,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1Eve LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); + LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); return (uint64_t)ret_ret; } @@ -28077,36 +29604,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEn NetGraphMsgHandler_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKNetGraphMsgHandler this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKNetGraphMsgHandler this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNetworkGraph val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NetworkGraph_clone(&val_conv); - NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) { LDKNetworkGraph network_graph_conv; network_graph_conv.inner = (void*)(network_graph & (~1)); - network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); - network_graph_conv = NetworkGraph_clone(&network_graph_conv); + network_graph_conv.is_owned = false; void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1); CHECK_ACCESS(chain_access_ptr); LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); @@ -28125,10 +29626,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNI // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); + LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28157,7 +29659,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1Rou LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); + LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); return (uint64_t)ret_ret; } @@ -28166,7 +29668,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1Mes LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); + LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); return (uint64_t)ret_ret; } @@ -28264,9 +29766,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28289,11 +29792,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -28323,9 +29829,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28337,9 +29844,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clo orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28379,9 +29887,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features( this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28404,9 +29913,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28429,11 +29939,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -28454,9 +29967,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28479,11 +29993,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -28525,11 +30042,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcem this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -28575,9 +30095,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *en announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28589,9 +30110,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv * orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28658,9 +30180,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv *env, jclass clz, int32_t base_msat_arg, int32_t proportional_millionths_arg) { LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28683,9 +30206,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28733,9 +30257,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28834,11 +30359,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -28885,9 +30413,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(J announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv); LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28899,9 +30428,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -28960,11 +30490,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbo this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -28985,11 +30518,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -29027,9 +30563,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0); announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv); LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29041,9 +30578,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29097,9 +30635,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *e CHECK((*env)->GetArrayLength(env, genesis_hash) == 32); (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data); LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29111,9 +30650,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JN this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29275,9 +30815,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1featur this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29315,9 +30856,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1fea this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29378,9 +30920,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29392,9 +30935,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKRouteHop ret_var = RouteHop_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29453,17 +30997,20 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIE this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); - jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL); + jobjectArray ret_arr = NULL; + ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL); ; for (size_t m = 0; m < ret_var.datalen; m++) { LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; - int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen); + int64_tArray ret_conv_12_arr = NULL; + ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen); int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL); for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; + uint64_t ret_conv_12_conv_10_ref = 0; CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; + ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; if (ret_conv_12_conv_10_var.is_owned) { ret_conv_12_conv_10_ref |= 1; } @@ -29473,6 +31020,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIE FREE(ret_conv_12_var.data); (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr); } + FREE(ret_var.data); return ret_arr; } @@ -29510,113 +31058,508 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, Route_set_paths(&this_ptr_conv, val_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRoute this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPayee ret_var = Route_get_payee(&this_ptr_conv); + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRoute this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPayee val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = Payee_clone(&val_conv); + Route_set_payee(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payee_arg) { LDKCVec_CVec_RouteHopZZ paths_arg_constr; paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg); if (paths_arg_constr.datalen > 0) paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); else - paths_arg_constr.data = NULL; - for (size_t m = 0; m < paths_arg_constr.datalen; m++) { - int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m); - LDKCVec_RouteHopZ paths_arg_conv_12_constr; - paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12); - if (paths_arg_conv_12_constr.datalen > 0) - paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - paths_arg_conv_12_constr.data = NULL; - int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL); - for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { - int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; - LDKRouteHop paths_arg_conv_12_conv_10_conv; - paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); - paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); - paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); - paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; - } - (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0); - paths_arg_constr.data[m] = paths_arg_conv_12_constr; + paths_arg_constr.data = NULL; + for (size_t m = 0; m < paths_arg_constr.datalen; m++) { + int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m); + LDKCVec_RouteHopZ paths_arg_conv_12_constr; + paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12); + if (paths_arg_conv_12_constr.datalen > 0) + paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + paths_arg_conv_12_constr.data = NULL; + int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL); + for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { + int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; + LDKRouteHop paths_arg_conv_12_conv_10_conv; + paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); + paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); + paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); + paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0); + paths_arg_constr.data[m] = paths_arg_conv_12_constr; + } + LDKPayee payee_arg_conv; + payee_arg_conv.inner = (void*)(payee_arg & (~1)); + payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0); + payee_arg_conv = Payee_clone(&payee_arg_conv); + LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRoute orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRoute ret_var = Route_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRoute o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = Route_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRoute a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRoute b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = Route_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_fees(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_amount(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKRoute obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = Route_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_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = Route_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRouteParameters this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteParameters_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPayee val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = Payee_clone(&val_conv); + RouteParameters_set_payee(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteParameters_set_final_value_msat(&this_ptr_conv, val); +} + +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKRouteParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) { + LDKPayee payee_arg_conv; + payee_arg_conv.inner = (void*)(payee_arg & (~1)); + payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0); + payee_arg_conv = Payee_clone(&payee_arg_conv); + LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRouteParameters orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKRouteParameters obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = RouteParameters_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_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); + *ret_conv = RouteParameters_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPayee this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + Payee_free(this_obj_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPayee this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Payee_get_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKPayee this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPublicKey val_ref; + CHECK((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + Payee_set_pubkey(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPayee this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv); + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKPayee this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKInvoiceFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = InvoiceFeatures_clone(&val_conv); + Payee_set_features(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPayee this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); + for (size_t l = 0; l < ret_var.datalen; l++) { + LDKRouteHint ret_conv_11_var = ret_var.data[l]; + uint64_t ret_conv_11_ref = 0; + CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner; + if (ret_conv_11_var.is_owned) { + ret_conv_11_ref |= 1; + } + ret_arr_ptr[l] = ret_conv_11_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { + LDKPayee this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCVec_RouteHintZ val_constr; + val_constr.datalen = (*env)->GetArrayLength(env, val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + val_constr.data = NULL; + int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); + for (size_t l = 0; l < val_constr.datalen; l++) { + int64_t val_conv_11 = val_vals[l]; + LDKRouteHint val_conv_11_conv; + val_conv_11_conv.inner = (void*)(val_conv_11 & (~1)); + val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0); + val_conv_11_conv = RouteHint_clone(&val_conv_11_conv); + val_constr.data[l] = val_conv_11_conv; + } + (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); + Payee_set_route_hints(&this_ptr_conv, val_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPayee this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = Payee_get_expiry_time(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKPayee this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + void* val_ptr = (void*)(((uint64_t)val) & ~1); + CHECK_ACCESS(val_ptr); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + Payee_set_expiry_time(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg) { + LDKPublicKey pubkey_arg_ref; + CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33); + (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form); + LDKInvoiceFeatures features_arg_conv; + features_arg_conv.inner = (void*)(features_arg & (~1)); + features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); + features_arg_conv = InvoiceFeatures_clone(&features_arg_conv); + LDKCVec_RouteHintZ route_hints_arg_constr; + route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg); + if (route_hints_arg_constr.datalen > 0) + route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + route_hints_arg_constr.data = NULL; + int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL); + for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) { + int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l]; + LDKRouteHint route_hints_arg_conv_11_conv; + route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1)); + route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0); + route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv); + route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv; } - LDKRoute ret_var = Route_new(paths_arg_constr); + (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0); + void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1); + CHECK_ACCESS(expiry_time_arg_ptr); + LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr); + expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1)); + LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRoute orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPayee orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKRoute ret_var = Route_clone(&orig_conv); + LDKPayee ret_var = Payee_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRoute o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKPayee o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = false; - int64_t ret_val = Route_hash(&o_conv); + int64_t ret_val = Payee_hash(&o_conv); return ret_val; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRoute a_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPayee a_conv; a_conv.inner = (void*)(a & (~1)); a_conv.is_owned = false; - LDKRoute b_conv; + LDKPayee b_conv; b_conv.inner = (void*)(b & (~1)); b_conv.is_owned = false; - jboolean ret_val = Route_eq(&a_conv, &b_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKRoute this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_fees(&this_arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKRoute this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_amount(&this_arg_conv); + jboolean ret_val = Payee_eq(&a_conv, &b_conv); return ret_val; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKRoute obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPayee obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = Route_write(&obj_conv); + LDKCVec_u8Z ret_var = Payee_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_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = Route_read(ser_ref); + LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); + *ret_conv = Payee_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray pubkey) { + LDKPublicKey pubkey_ref; + CHECK((*env)->GetArrayLength(env, pubkey) == 33); + (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); + LDKPayee ret_var = Payee_from_node_id(pubkey_ref); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray pubkey) { + LDKPublicKey pubkey_ref; + CHECK((*env)->GetArrayLength(env, pubkey) == 33); + (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); + LDKPayee ret_var = Payee_for_keysend(pubkey_ref); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKRouteHint this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -29624,14 +31567,90 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, j RouteHint_free(this_obj_conv); } +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHint this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); + for (size_t o = 0; o < ret_var.datalen; o++) { + LDKRouteHintHop ret_conv_14_var = ret_var.data[o]; + uint64_t ret_conv_14_ref = 0; + CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner; + if (ret_conv_14_var.is_owned) { + ret_conv_14_ref |= 1; + } + ret_arr_ptr[o] = ret_conv_14_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { + LDKRouteHint this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCVec_RouteHintHopZ val_constr; + val_constr.datalen = (*env)->GetArrayLength(env, val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements"); + else + val_constr.data = NULL; + int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); + for (size_t o = 0; o < val_constr.datalen; o++) { + int64_t val_conv_14 = val_vals[o]; + LDKRouteHintHop val_conv_14_conv; + val_conv_14_conv.inner = (void*)(val_conv_14 & (~1)); + val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0); + val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv); + val_constr.data[o] = val_conv_14_conv; + } + (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); + RouteHint_set_a(&this_ptr_conv, val_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) { + LDKCVec_RouteHintHopZ a_arg_constr; + a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg); + if (a_arg_constr.datalen > 0) + a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements"); + else + a_arg_constr.data = NULL; + int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL); + for (size_t o = 0; o < a_arg_constr.datalen; o++) { + int64_t a_arg_conv_14 = a_arg_vals[o]; + LDKRouteHintHop a_arg_conv_14_conv; + a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1)); + a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0); + a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv); + a_arg_constr.data[o] = a_arg_conv_14_conv; + } + (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0); + LDKRouteHint ret_var = RouteHint_new(a_arg_constr); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) { LDKRouteHint orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKRouteHint ret_var = RouteHint_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29657,6 +31676,27 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, return ret_val; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKRouteHint obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = RouteHint_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_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ"); + *ret_conv = RouteHint_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKRouteHintHop this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -29703,9 +31743,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNI this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29797,9 +31838,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *e LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr); htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29811,9 +31853,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29839,81 +31882,37 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *e return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger, int64_t scorer) { - LDKPublicKey our_node_pubkey_ref; - CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33); - (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK((*env)->GetArrayLength(env, payee) == 33); - (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - int64_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; - } - (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); - void* logger_ptr = (void*)(((uint64_t)logger) & ~1); - CHECK_ACCESS(logger_ptr); - LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1); - if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } - LDKScore* scorer_conv = (LDKScore*)scorer_ptr; - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_keysend_route(our_node_pubkey_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKRouteHintHop obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = RouteHintHop_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_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ"); + *ret_conv = RouteHintHop_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger, int64_t scorer) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) { LDKPublicKey our_node_pubkey_ref; CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33); (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form); + LDKRouteParameters params_conv; + params_conv.inner = (void*)(params & (~1)); + params_conv.is_owned = false; LDKNetworkGraph network_conv; network_conv.inner = (void*)(network & (~1)); network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK((*env)->GetArrayLength(env, payee) == 33); - (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); - LDKInvoiceFeatures payee_features_conv; - payee_features_conv.inner = (void*)(payee_features & (~1)); - payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); - payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); LDKCVec_ChannelDetailsZ first_hops_constr; LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; if (first_hops != NULL) { @@ -29933,22 +31932,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jcl (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); first_hops_ptr = &first_hops_constr; } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - int64_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; - } - (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); void* logger_ptr = (void*)(((uint64_t)logger) & ~1); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -29960,7 +31943,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jcl if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_route(our_node_pubkey_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uint64_t)ret_conv; } @@ -29972,11 +31955,101 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jcla Scorer_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat) { - LDKScorer ret_var = Scorer_new(base_penalty_msat); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKScoringParameters this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + ScoringParameters_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) { + LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKScoringParameters obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = ScoringParameters_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_ScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = ScoringParameters_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t params) { + LDKScoringParameters params_conv; + params_conv.inner = (void*)(params & (~1)); + params_conv.is_owned = (params & 1) || (params == 0); + // Warning: we need a move here but no clone is available for LDKScoringParameters + LDKScorer ret_var = Scorer_new(params_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29985,9 +32058,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jc JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) { LDKScorer ret_var = Scorer_default(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1default(JNIEnv *env, jclass clz) { + LDKScoringParameters ret_var = ScoringParameters_default(); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -29998,11 +32084,32 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *e LDKScorer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore"); + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); *ret_ret = Scorer_as_Score(&this_arg_conv); return (uint64_t)ret_ret; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKScorer obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = Scorer_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_Scorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = Scorer_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_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)); @@ -30013,9 +32120,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIE JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) { LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data); LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30062,7 +32170,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Pe LDKFilesystemPersister this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist"); + LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist"); *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv); return (uint64_t)ret_ret; } @@ -30118,9 +32226,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start( LDKLogger_JCalls_cloned(&logger_conv); } LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30174,9 +32283,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKInvoice ret_var = Invoice_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30206,9 +32316,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNI orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30227,9 +32338,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEn this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30263,9 +32375,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *e orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30284,9 +32397,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30320,9 +32434,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv * orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30352,9 +32467,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JN orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30456,9 +32572,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKSha256 ret_var = Sha256_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30496,9 +32613,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv * orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKDescription ret_var = Description_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30531,14 +32649,49 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, PayeePubKey_free(this_obj_conv); } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPayeePubKey this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKPayeePubKey this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPublicKey val_ref; + CHECK((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + PayeePubKey_set_a(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) { + LDKPublicKey a_arg_ref; + CHECK((*env)->GetArrayLength(env, a_arg) == 33); + (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form); + LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) { LDKPayeePubKey orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30576,9 +32729,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *e orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30611,14 +32765,42 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEn MinFinalCltvExpiry_free(this_obj_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKMinFinalCltvExpiry this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKMinFinalCltvExpiry this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + MinFinalCltvExpiry_set_a(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) { + LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) { LDKMinFinalCltvExpiry orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30718,9 +32900,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNI orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30750,9 +32933,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30793,9 +32977,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invo this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30816,9 +33001,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -30856,11 +33042,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(J this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -30870,11 +33059,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNI this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKDescription ret_var = RawInvoice_description(&this_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -30884,11 +33076,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -30898,11 +33093,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1ha this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -30912,11 +33110,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JN this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -30926,11 +33127,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1clt this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -30949,11 +33153,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -30963,13 +33170,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1r this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t o = 0; o < ret_var.datalen; o++) { LDKPrivateRoute ret_conv_14_var = ret_var.data[o]; + uint64_t ret_conv_14_ref = 0; CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner; + ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner; if (ret_conv_14_var.is_owned) { ret_conv_14_ref |= 1; } @@ -31032,9 +33241,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw( this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0); this_arg_conv = Invoice_clone(&this_arg_conv); LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -31091,7 +33301,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secre this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv)); return ret_arr; } @@ -31100,11 +33310,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *e this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } } return ret_ref; } @@ -31126,6 +33339,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEn return ret_val; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInvoice this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + jboolean ret_val = Invoice_is_expired(&this_arg_conv); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInvoice this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -31139,13 +33360,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1rout this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t o = 0; o < ret_var.datalen; o++) { LDKPrivateRoute ret_conv_14_var = ret_var.data[o]; + uint64_t ret_conv_14_ref = 0; CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner; + ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner; if (ret_conv_14_var.is_owned) { ret_conv_14_ref |= 1; } @@ -31161,13 +33384,15 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints( this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv); - int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t l = 0; l < ret_var.datalen; l++) { LDKRouteHint ret_conv_11_var = ret_var.data[l]; + uint64_t ret_conv_11_ref = 0; CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner; + ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner; if (ret_conv_11_var.is_owned) { ret_conv_11_ref |= 1; } @@ -31186,12 +33411,12 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *en return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInvoice this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = Invoice_amount_pico_btc(&this_arg_conv); + *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -31258,9 +33483,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(J this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0); this_arg_conv = PrivateRoute_clone(&this_arg_conv); LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv); + uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; + ret_ref = (uint64_t)ret_var.inner; if (ret_var.is_owned) { ret_ref |= 1; } @@ -31426,6 +33652,237 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1st return ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKInvoicePayer this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + InvoicePayer_free(this_obj_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr); + FREE((void*)this_ptr); + Payer_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr); + FREE((void*)this_ptr); + Router_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRetryAttempts this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RetryAttempts_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRetryAttempts this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRetryAttempts this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RetryAttempts_set_a(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1new(JNIEnv *env, jclass clz, int64_t a_arg) { + LDKRetryAttempts ret_var = RetryAttempts_new(a_arg); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRetryAttempts orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRetryAttempts a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRetryAttempts b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRetryAttempts o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RetryAttempts_hash(&o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr); + FREE((void*)this_ptr); + PaymentError_free(this_ptr_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPaymentError* orig_conv = (LDKPaymentError*)orig; + LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); + *ret_copy = PaymentError_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) { + LDKStr a_conv = java_to_owned_str(env, a); + LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); + *ret_copy = PaymentError_invoice(a_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) { + LDKLightningError a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = (a & 1) || (a == 0); + a_conv = LightningError_clone(&a_conv); + LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); + *ret_copy = PaymentError_routing(a_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = (void*)(((uint64_t)a) & ~1); + CHECK_ACCESS(a_ptr); + LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr); + a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)a) & ~1)); + LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); + *ret_copy = PaymentError_sending(a_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t scorer, int64_t logger, int64_t event_handler, int64_t retry_attempts) { + void* payer_ptr = (void*)(((uint64_t)payer) & ~1); + CHECK_ACCESS(payer_ptr); + LDKPayer payer_conv = *(LDKPayer*)(payer_ptr); + if (payer_conv.free == LDKPayer_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKPayer_JCalls_cloned(&payer_conv); + } + void* router_ptr = (void*)(((uint64_t)router) & ~1); + CHECK_ACCESS(router_ptr); + LDKRouter router_conv = *(LDKRouter*)(router_ptr); + if (router_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&router_conv); + } + LDKLockableScore scorer_conv; + scorer_conv.inner = (void*)(scorer & (~1)); + scorer_conv.is_owned = false; + void* logger_ptr = (void*)(((uint64_t)logger) & ~1); + CHECK_ACCESS(logger_ptr); + LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1); + CHECK_ACCESS(event_handler_ptr); + LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr); + if (event_handler_conv.free == LDKEventHandler_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEventHandler_JCalls_cloned(&event_handler_conv); + } + LDKRetryAttempts retry_attempts_conv; + retry_attempts_conv.inner = (void*)(retry_attempts & (~1)); + retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0); + retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv); + LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKInvoice invoice_conv; + invoice_conv.inner = (void*)(invoice & (~1)); + invoice_conv.is_owned = false; + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKInvoice invoice_conv; + invoice_conv.inner = (void*)(invoice & (~1)); + invoice_conv.is_owned = false; + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + unsigned char payment_hash_arr[32]; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); + unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; + InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); + *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv); + return (uint64_t)ret_ret; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = (void*)(channelmanager & (~1)); @@ -31448,6 +33905,53 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan return (uint64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKDefaultRouter this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + DefaultRouter_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) { + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = false; + void* logger_ptr = (void*)(((uint64_t)logger) & ~1); + CHECK_ACCESS(logger_ptr); + LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDefaultRouter this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter"); + *ret_ret = DefaultRouter_as_Router(&this_arg_conv); + return (uint64_t)ret_ret; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer"); + *ret_ret = ChannelManager_as_Payer(&this_arg_conv); + return (uint64_t)ret_ret; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");