X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjni%2Fbindings.c;h=32c632986f58672536c0ba3b5c0677969908a468;hb=c6bac88847b7c09560af81f00ba8dd3c2ebe3a19;hp=dc002cc070ec6cfa126b5095d60374b5c281ed18;hpb=0d48e557e83ef085cc92c2de63b9c81c061ce78c;p=ldk-java diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index dc002cc0..32c63298 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -11,7 +11,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) @@ -797,18 +797,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) { @@ -818,18 +820,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) { @@ -839,9 +843,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) { @@ -885,18 +890,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) { @@ -906,18 +913,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) { @@ -927,18 +936,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) { @@ -948,18 +959,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) { @@ -969,18 +982,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) { @@ -990,9 +1005,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) { @@ -1007,18 +1023,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) { @@ -1028,9 +1046,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) { @@ -1045,13 +1064,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) { @@ -1066,18 +1087,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) { @@ -1087,18 +1110,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) { @@ -1122,18 +1147,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) { @@ -1177,20 +1204,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; @@ -1219,57 +1298,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; } @@ -1280,18 +1428,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) { @@ -1382,6 +1532,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;")); @@ -1393,24 +1547,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(); } } @@ -1500,9 +1682,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: { @@ -1573,24 +1756,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(); @@ -1658,9 +1844,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: { @@ -1672,9 +1861,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(); @@ -1822,133 +2012,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: { @@ -1961,27 +2167,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(); @@ -2021,18 +2230,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) { @@ -2042,18 +2253,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) { @@ -2063,18 +2276,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) { @@ -2084,18 +2299,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) { @@ -2105,18 +2368,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) { @@ -2126,18 +2391,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) { @@ -2153,9 +2420,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) { @@ -2187,13 +2455,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; } @@ -2322,10 +2592,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; } @@ -2379,10 +2650,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; } @@ -2439,10 +2711,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; } @@ -2509,10 +2782,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; } @@ -2548,10 +2822,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; } @@ -2581,10 +2856,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; } @@ -2614,10 +2890,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; } @@ -2647,10 +2924,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; } @@ -2909,9 +3187,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; } @@ -3025,7 +3304,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; } @@ -3033,9 +3312,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) { @@ -3067,7 +3347,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]; @@ -3075,6 +3356,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) { @@ -3089,18 +3371,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) { @@ -3162,9 +3446,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; } @@ -3205,7 +3490,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"); @@ -3222,27 +3508,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; @@ -3343,9 +3608,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(); @@ -3462,7 +3728,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) { @@ -3474,7 +3740,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"); @@ -3487,7 +3754,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; @@ -3497,17 +3765,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(); } @@ -3515,14 +3793,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); @@ -3554,19 +3830,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) { @@ -3767,16 +4038,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; } @@ -3806,16 +4079,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; } @@ -3943,7 +4218,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"); @@ -4319,9 +4595,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; } @@ -4332,7 +4609,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; } @@ -4539,9 +4816,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; } @@ -4559,9 +4837,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) { @@ -4571,18 +4850,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) { @@ -4592,18 +4873,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 { @@ -4781,7 +5064,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); } @@ -4804,9 +5087,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) { @@ -4830,9 +5176,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) { @@ -4847,9 +5194,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) { @@ -4863,9 +5211,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; } @@ -4888,9 +5237,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; } @@ -4904,9 +5254,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) { @@ -4949,9 +5300,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) { @@ -4981,9 +5333,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) { @@ -4999,9 +5352,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) { @@ -5017,9 +5371,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) { @@ -5035,9 +5390,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) { @@ -5069,18 +5425,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) { @@ -5090,18 +5448,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) { @@ -5116,9 +5476,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){ @@ -5127,9 +5488,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; } @@ -5212,7 +5574,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"); @@ -5399,12 +5762,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;")); @@ -5450,36 +5813,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; @@ -5598,7 +5976,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"); @@ -5727,9 +6106,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) { @@ -5744,9 +6124,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){ @@ -5764,7 +6145,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; } @@ -5808,9 +6189,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){ @@ -5819,9 +6201,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; } @@ -5834,9 +6217,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; } @@ -5849,9 +6233,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; } @@ -5927,9 +6312,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) { @@ -5944,9 +6330,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) { @@ -5961,9 +6348,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) { @@ -5973,18 +6361,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 { @@ -6096,7 +6486,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) { @@ -6118,18 +6508,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) { @@ -6139,18 +6531,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) { @@ -6160,18 +6554,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) { @@ -6181,18 +6577,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) { @@ -6222,18 +6620,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) { @@ -6243,18 +6643,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; @@ -6278,7 +6680,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; @@ -6293,40 +6696,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; } @@ -6340,9 +6709,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) { @@ -6460,18 +6830,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) { @@ -6481,18 +6853,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) { @@ -6502,18 +6876,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) { @@ -6523,18 +6899,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) { @@ -6544,18 +6922,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) { @@ -6565,18 +6945,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) { @@ -6586,18 +6968,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) { @@ -6607,18 +6991,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) { @@ -6628,18 +7014,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) { @@ -6649,18 +7037,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) { @@ -6670,18 +7060,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) { @@ -6691,18 +7083,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) { @@ -6712,18 +7106,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) { @@ -6733,18 +7129,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) { @@ -6754,18 +7152,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) { @@ -6775,18 +7175,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) { @@ -6796,18 +7198,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) { @@ -6817,18 +7221,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) { @@ -6838,18 +7244,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) { @@ -6859,18 +7267,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) { @@ -6880,18 +7290,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) { @@ -6901,18 +7313,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) { @@ -6922,18 +7336,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) { @@ -6943,18 +7359,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) { @@ -6964,18 +7382,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) { @@ -6985,18 +7405,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) { @@ -7006,18 +7428,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) { @@ -7027,18 +7451,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) { @@ -7048,18 +7474,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) { @@ -7069,18 +7497,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) { @@ -7090,18 +7520,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) { @@ -7111,18 +7543,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; @@ -7161,9 +7595,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) { @@ -7231,9 +7666,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; } @@ -7331,7 +7767,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) { @@ -7353,9 +7789,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) { @@ -7481,7 +7918,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"); @@ -7605,7 +8043,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); @@ -7816,7 +8254,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"); @@ -8003,13 +8442,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; } @@ -8038,7 +8479,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); @@ -8047,24 +8488,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."); @@ -8078,7 +8529,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); @@ -8087,32 +8538,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."); @@ -8137,9 +8601,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 = { @@ -8155,38 +8619,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; } @@ -8245,17 +8717,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; } @@ -8282,17 +8756,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; } @@ -8319,10 +8795,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; } @@ -8349,10 +8826,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; } @@ -8379,10 +8857,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; } @@ -8409,18 +8888,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; } @@ -8447,10 +8928,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; } @@ -8477,10 +8959,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; } @@ -8507,10 +8990,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; } @@ -8537,10 +9021,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; } @@ -8567,10 +9052,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; } @@ -8597,10 +9083,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; } @@ -8627,10 +9114,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; } @@ -8657,10 +9145,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; } @@ -8687,10 +9176,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; } @@ -8739,10 +9229,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; } @@ -8769,10 +9260,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; } @@ -8799,10 +9291,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; } @@ -8829,10 +9322,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; } @@ -9250,10 +9744,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; } @@ -9283,10 +9778,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; } @@ -9316,10 +9812,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; } @@ -9427,10 +9924,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; } @@ -9457,9 +9955,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; } @@ -9491,9 +9990,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; } @@ -9525,9 +10025,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; } @@ -9559,9 +10060,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; } @@ -9684,7 +10186,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"); @@ -9704,13 +10207,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; } @@ -9922,7 +10427,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); @@ -10041,7 +10546,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"); @@ -10235,6 +10741,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; @@ -10253,7 +10761,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); @@ -10262,9 +10770,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."); @@ -10274,6 +10800,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); @@ -10285,12 +10873,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; @@ -10300,21 +10894,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; @@ -10341,10 +10975,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; } @@ -10448,98 +11083,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; } @@ -11240,54 +12281,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) { @@ -11309,33 +12336,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) { @@ -11717,6 +12921,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)); @@ -12275,42 +13537,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); @@ -12449,13 +13675,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; } @@ -12524,16 +13749,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); } @@ -12881,6 +14105,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"); @@ -14370,107 +15629,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; } @@ -15974,20 +17165,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); @@ -16015,8 +17216,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; } @@ -16622,9 +17827,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; } @@ -16636,9 +17842,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; } @@ -16647,9 +17854,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; } @@ -16785,9 +17993,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; } @@ -16799,9 +18008,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; } @@ -16810,9 +18020,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; } @@ -16933,9 +18144,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; } @@ -16947,9 +18159,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; } @@ -16958,9 +18171,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; } @@ -17000,9 +18214,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; } @@ -17025,9 +18240,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; } @@ -17050,9 +18266,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; } @@ -17099,9 +18316,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; } @@ -17113,9 +18331,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; } @@ -17124,9 +18343,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; } @@ -17145,9 +18365,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; } @@ -17157,9 +18378,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; } @@ -17171,9 +18393,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; } @@ -17305,9 +18528,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; } @@ -17359,9 +18583,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; } @@ -17373,9 +18598,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; } @@ -17436,6 +18662,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); @@ -17500,9 +18767,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; } @@ -17530,7 +18798,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"); @@ -17561,13 +18830,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; } @@ -17578,11 +18849,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; } @@ -17591,7 +18879,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; } @@ -17600,7 +18888,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; } @@ -17609,7 +18897,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; } @@ -17641,9 +18929,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; } @@ -17678,14 +18967,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; } @@ -17731,6 +19052,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)); @@ -17743,9 +19095,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; } @@ -17837,9 +19190,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; } @@ -17900,7 +19254,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"); @@ -17927,7 +19282,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"); @@ -17945,7 +19301,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"); @@ -17966,7 +19323,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]; @@ -17975,6 +19333,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; } @@ -18025,7 +19384,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"); @@ -18115,7 +19475,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"); @@ -18189,7 +19550,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"); @@ -18206,13 +19568,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; } @@ -18222,9 +19586,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; } @@ -18236,7 +19601,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"); @@ -18308,9 +19674,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; } @@ -18322,9 +19689,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; } @@ -18392,9 +19760,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; } @@ -18529,9 +19898,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; } @@ -18543,9 +19913,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; } @@ -18585,9 +19956,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; } @@ -18663,9 +20035,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; } @@ -18677,9 +20050,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; } @@ -18793,7 +20167,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; } @@ -18942,9 +20316,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; } @@ -18974,9 +20349,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; } @@ -18988,9 +20364,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; } @@ -19026,9 +20403,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; } @@ -19040,9 +20418,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; } @@ -19087,7 +20466,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; } @@ -19096,7 +20475,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; } @@ -19135,9 +20514,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; } @@ -19153,9 +20533,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; } @@ -19211,72 +20592,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)); @@ -19312,9 +20632,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; } @@ -19339,9 +20660,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; } @@ -19353,9 +20675,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; } @@ -19416,9 +20739,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; } @@ -19430,9 +20754,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; } @@ -19470,9 +20795,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; } @@ -19510,11 +20836,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; } @@ -19543,9 +20872,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; } @@ -19557,9 +20887,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; } @@ -19597,9 +20928,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; } @@ -19622,11 +20954,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; } @@ -19874,9 +21209,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; } @@ -19888,9 +21224,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; } @@ -19971,25 +21308,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; } @@ -20039,9 +21382,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; } @@ -20053,9 +21397,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; } @@ -20083,13 +21428,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; } @@ -20105,13 +21452,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; } @@ -20186,19 +21535,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; } @@ -20309,16 +21657,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)); @@ -20352,7 +21690,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; } @@ -20361,7 +21699,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; } @@ -20370,7 +21708,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; } @@ -20379,7 +21717,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; } @@ -20404,9 +21742,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; } @@ -20417,7 +21756,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; } @@ -20444,7 +21783,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; } @@ -20466,7 +21806,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; } @@ -20488,7 +21829,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; } @@ -20510,7 +21852,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; } @@ -20532,7 +21875,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; } @@ -20555,9 +21899,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; } @@ -20631,9 +21976,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; } @@ -20666,9 +22012,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; } @@ -20687,9 +22034,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; } @@ -20713,9 +22061,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; } @@ -20727,9 +22076,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; } @@ -20786,9 +22136,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; } @@ -20800,9 +22151,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; } @@ -20848,9 +22200,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; } @@ -20862,9 +22215,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; } @@ -20895,9 +22249,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; } @@ -20909,9 +22264,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; } @@ -21232,9 +22588,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; } @@ -21491,9 +22848,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; } @@ -21590,9 +22948,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; } @@ -21604,9 +22963,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; } @@ -21666,9 +23026,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; } @@ -21680,9 +23041,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; } @@ -21742,9 +23104,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; } @@ -21756,9 +23119,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; } @@ -21821,9 +23185,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; } @@ -21835,9 +23200,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; } @@ -21883,9 +23249,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; } @@ -21897,9 +23264,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; } @@ -21971,11 +23339,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; } @@ -22003,9 +23374,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; } @@ -22017,9 +23389,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; } @@ -22121,9 +23494,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; } @@ -22198,9 +23572,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; } @@ -22212,9 +23587,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; } @@ -22267,9 +23643,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; } @@ -22337,9 +23714,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; } @@ -22432,9 +23810,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; } @@ -22446,9 +23825,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; } @@ -22530,9 +23910,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; } @@ -22544,9 +23925,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; } @@ -22599,9 +23981,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; } @@ -22613,9 +23996,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; } @@ -22675,9 +24059,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; } @@ -22689,9 +24074,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; } @@ -22759,9 +24145,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; } @@ -22858,9 +24245,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; } @@ -22872,9 +24260,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; } @@ -22947,16 +24336,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); @@ -22979,9 +24358,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; } @@ -23099,9 +24479,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; } @@ -23139,9 +24520,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; } @@ -23168,9 +24550,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; } @@ -23182,9 +24565,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; } @@ -23203,9 +24587,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; } @@ -23338,9 +24723,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; } @@ -23435,9 +24821,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; } @@ -23473,9 +24860,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; } @@ -23487,9 +24875,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; } @@ -23632,9 +25021,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; } @@ -23672,9 +25062,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; } @@ -23701,9 +25092,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; } @@ -23715,9 +25107,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; } @@ -23785,9 +25178,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; } @@ -23799,9 +25193,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; } @@ -23915,9 +25310,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; } @@ -23929,9 +25325,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; } @@ -24000,9 +25397,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; } @@ -24014,9 +25412,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; } @@ -24069,9 +25468,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; } @@ -24083,9 +25483,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; } @@ -24153,9 +25554,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; } @@ -24167,9 +25569,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; } @@ -24283,9 +25686,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; } @@ -24297,9 +25701,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; } @@ -24318,13 +25723,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; } @@ -24363,13 +25770,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; } @@ -24408,13 +25817,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; } @@ -24453,13 +25864,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; } @@ -24498,11 +25911,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; } @@ -24523,9 +25939,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; } @@ -24617,9 +26034,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; } @@ -24631,9 +26049,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; } @@ -25356,9 +26775,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; } @@ -25369,7 +26789,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; } @@ -25378,7 +26798,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; } @@ -25387,7 +26807,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; } @@ -25396,7 +26816,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; } @@ -25410,9 +26830,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; } @@ -25423,7 +26844,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; } @@ -25432,7 +26853,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; } @@ -25448,7 +26869,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; } @@ -25470,7 +26892,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; } @@ -25504,9 +26927,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; } @@ -25517,7 +26941,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; } @@ -25555,9 +26979,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; } @@ -25569,9 +26994,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; } @@ -25612,9 +27038,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; } @@ -25626,13 +27053,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; } @@ -25727,6 +27156,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)); @@ -25934,9 +27370,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; } @@ -25948,9 +27385,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; } @@ -26097,9 +27535,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; } @@ -26111,9 +27550,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; } @@ -26292,9 +27732,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; } @@ -26306,9 +27747,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; } @@ -26397,9 +27839,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; } @@ -26452,11 +27895,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; } @@ -26477,11 +27923,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; } @@ -26511,9 +27960,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; } @@ -26525,9 +27975,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; } @@ -26546,9 +27997,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; } @@ -26587,9 +28039,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; } @@ -26601,9 +28054,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; } @@ -26623,9 +28077,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; } @@ -26637,9 +28092,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; } @@ -26700,9 +28156,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; } @@ -26714,9 +28171,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; } @@ -26744,9 +28202,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; } @@ -26804,9 +28263,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; } @@ -26862,9 +28322,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; } @@ -26930,9 +28391,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; } @@ -26944,9 +28406,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; } @@ -27016,9 +28479,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; } @@ -27047,9 +28511,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; } @@ -27061,9 +28526,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; } @@ -27179,9 +28645,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; } @@ -27246,9 +28713,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; } @@ -27294,9 +28762,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; } @@ -27308,9 +28777,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; } @@ -27393,9 +28863,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; } @@ -27407,9 +28878,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; } @@ -27421,9 +28893,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; } @@ -27435,9 +28908,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; } @@ -27474,9 +28948,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; } @@ -27485,9 +28960,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; } @@ -27504,9 +28980,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; } @@ -27515,9 +28992,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; } @@ -27534,9 +29012,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; } @@ -27545,9 +29024,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; } @@ -27564,9 +29044,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; } @@ -27575,9 +29056,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; } @@ -27712,9 +29194,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; } @@ -27755,9 +29238,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; } @@ -27769,9 +29253,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; } @@ -27805,9 +29290,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; } @@ -27820,9 +29306,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; } @@ -27884,7 +29371,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; } @@ -27907,6 +29394,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)); @@ -27919,9 +29443,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; } @@ -27933,9 +29458,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; } @@ -27993,9 +29519,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; } @@ -28067,7 +29594,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; } @@ -28079,36 +29606,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); @@ -28127,10 +29628,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; } @@ -28159,7 +29661,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; } @@ -28168,7 +29670,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; } @@ -28266,9 +29768,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; } @@ -28291,11 +29794,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; } @@ -28325,9 +29831,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; } @@ -28339,9 +29846,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; } @@ -28381,9 +29889,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; } @@ -28406,9 +29915,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; } @@ -28431,11 +29941,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; } @@ -28456,9 +29969,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; } @@ -28481,11 +29995,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; } @@ -28527,11 +30044,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; } @@ -28577,9 +30097,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; } @@ -28591,9 +30112,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; } @@ -28660,9 +30182,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; } @@ -28685,9 +30208,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; } @@ -28735,9 +30259,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; } @@ -28836,11 +30361,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; } @@ -28887,9 +30415,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; } @@ -28901,9 +30430,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; } @@ -28962,11 +30492,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; } @@ -28987,11 +30520,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; } @@ -29029,9 +30565,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; } @@ -29043,9 +30580,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; } @@ -29099,9 +30637,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; } @@ -29113,9 +30652,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; } @@ -29277,9 +30817,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; } @@ -29317,9 +30858,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; } @@ -29380,9 +30922,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; } @@ -29394,9 +30937,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; } @@ -29455,17 +30999,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; } @@ -29475,6 +31022,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; } @@ -29512,113 +31060,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)); @@ -29626,14 +31569,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; } @@ -29659,6 +31678,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)); @@ -29705,9 +31745,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; } @@ -29799,9 +31840,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; } @@ -29813,9 +31855,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; } @@ -29841,81 +31884,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) { @@ -29935,22 +31934,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); @@ -29962,7 +31945,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; } @@ -29974,11 +31957,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; } @@ -29987,9 +32060,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; } @@ -30000,11 +32086,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)); @@ -30015,9 +32122,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; } @@ -30064,7 +32172,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; } @@ -30120,9 +32228,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; } @@ -30176,9 +32285,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; } @@ -30208,9 +32318,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; } @@ -30229,9 +32340,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; } @@ -30265,9 +32377,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; } @@ -30286,9 +32399,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; } @@ -30322,9 +32436,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; } @@ -30354,9 +32469,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; } @@ -30458,9 +32574,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; } @@ -30498,9 +32615,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; } @@ -30533,14 +32651,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; } @@ -30578,9 +32731,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; } @@ -30613,14 +32767,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; } @@ -30720,9 +32902,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; } @@ -30752,9 +32935,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; } @@ -30795,9 +32979,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; } @@ -30818,9 +33003,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; } @@ -30858,11 +33044,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; } @@ -30872,11 +33061,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; } @@ -30886,11 +33078,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; } @@ -30900,11 +33095,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; } @@ -30914,11 +33112,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; } @@ -30928,11 +33129,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; } @@ -30951,11 +33155,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; } @@ -30965,13 +33172,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; } @@ -31034,9 +33243,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; } @@ -31093,7 +33303,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; } @@ -31102,11 +33312,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; } @@ -31128,6 +33341,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)); @@ -31141,13 +33362,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; } @@ -31163,13 +33386,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; } @@ -31188,12 +33413,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; } @@ -31260,9 +33485,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; } @@ -31428,6 +33654,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)); @@ -31450,6 +33907,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");