Merge pull request #42 from TheBlueMatt/main
[ldk-java] / src / main / jni / bindings.c
index 1bf1ade33a6787f3f17d82c317204285c88be2da..6e7e23ff59cee995bd1f8afe5f42e7329f88b1e9 100644 (file)
@@ -133,7 +133,7 @@ static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
 }
 
 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
-       return str_ref_to_java(env, "v0.0.98.4", strlen("v0.0.98.4"));
+       return str_ref_to_java(env, "v0.0.100.2", strlen("v0.0.100.2"));
 }
 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
        return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
@@ -454,52 +454,46 @@ static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
 
 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
        switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
-               case 0: return LDKLevel_Off;
-               case 1: return LDKLevel_Error;
-               case 2: return LDKLevel_Warn;
-               case 3: return LDKLevel_Info;
-               case 4: return LDKLevel_Debug;
-               case 5: return LDKLevel_Trace;
+               case 0: return LDKLevel_Trace;
+               case 1: return LDKLevel_Debug;
+               case 2: return LDKLevel_Info;
+               case 3: return LDKLevel_Warn;
+               case 4: return LDKLevel_Error;
        }
        abort();
 }
 static jclass Level_class = NULL;
-static jfieldID Level_LDKLevel_Off = NULL;
-static jfieldID Level_LDKLevel_Error = NULL;
-static jfieldID Level_LDKLevel_Warn = NULL;
-static jfieldID Level_LDKLevel_Info = NULL;
-static jfieldID Level_LDKLevel_Debug = NULL;
 static jfieldID Level_LDKLevel_Trace = NULL;
+static jfieldID Level_LDKLevel_Debug = NULL;
+static jfieldID Level_LDKLevel_Info = NULL;
+static jfieldID Level_LDKLevel_Warn = NULL;
+static jfieldID Level_LDKLevel_Error = NULL;
 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
        Level_class = (*env)->NewGlobalRef(env, clz);
        CHECK(Level_class != NULL);
-       Level_LDKLevel_Off = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Off", "Lorg/ldk/enums/Level;");
-       CHECK(Level_LDKLevel_Off != NULL);
-       Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
-       CHECK(Level_LDKLevel_Error != NULL);
-       Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
-       CHECK(Level_LDKLevel_Warn != NULL);
-       Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
-       CHECK(Level_LDKLevel_Info != NULL);
-       Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
-       CHECK(Level_LDKLevel_Debug != NULL);
        Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
        CHECK(Level_LDKLevel_Trace != NULL);
+       Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
+       CHECK(Level_LDKLevel_Debug != NULL);
+       Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
+       CHECK(Level_LDKLevel_Info != NULL);
+       Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
+       CHECK(Level_LDKLevel_Warn != NULL);
+       Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
+       CHECK(Level_LDKLevel_Error != NULL);
 }
 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
        switch (val) {
-               case LDKLevel_Off:
-                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Off);
-               case LDKLevel_Error:
-                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
-               case LDKLevel_Warn:
-                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
-               case LDKLevel_Info:
-                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
-               case LDKLevel_Debug:
-                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
                case LDKLevel_Trace:
                        return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
+               case LDKLevel_Debug:
+                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
+               case LDKLevel_Info:
+                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
+               case LDKLevel_Warn:
+                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
+               case LDKLevel_Error:
+                       return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
                default: abort();
        }
 }
@@ -738,6 +732,21 @@ static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
        memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
        return ret;
 }
+struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {  return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
+       LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
+       LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_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;
+}
+
+uint64_t TxOut_get_value (struct LDKTxOut* thing) {    return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
+       LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
+       int64_t ret_val = TxOut_get_value(thing_conv);
+       return ret_val;
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
        return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
 }
@@ -1022,6 +1031,48 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNo
        CHECK(!val->result_ok);
        return *val->contents.err;
 }
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript 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_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);
+       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_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript 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_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);
+       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_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
        return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
 }
@@ -1468,6 +1519,8 @@ static jclass LDKErrorAction_DisconnectPeer_class = NULL;
 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
 static jclass LDKErrorAction_IgnoreError_class = NULL;
 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
+static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
+static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
@@ -1481,6 +1534,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIE
        CHECK(LDKErrorAction_IgnoreError_class != NULL);
        LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
        CHECK(LDKErrorAction_IgnoreError_meth != NULL);
+       LDKErrorAction_IgnoreAndLog_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
+       CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
+       LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
+       CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
        LDKErrorAction_SendErrorMessage_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
        CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
@@ -1500,6 +1558,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1
                case LDKErrorAction_IgnoreError: {
                        return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
                }
+               case LDKErrorAction_IgnoreAndLog: {
+                       jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
+                       return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
+               }
                case LDKErrorAction_SendErrorMessage: {
                        LDKErrorMessage msg_var = obj->send_error_message.msg;
                        CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
@@ -1582,6 +1644,8 @@ static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
+static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
+static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
 static jclass LDKMessageSendEvent_HandleError_class = NULL;
 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
@@ -1663,6 +1727,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init
        CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
        LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
        CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
+       LDKMessageSendEvent_SendChannelUpdate_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
+       CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
+       LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
+       CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
        LDKMessageSendEvent_HandleError_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
        CHECK(LDKMessageSendEvent_HandleError_class != NULL);
@@ -1816,6 +1885,15 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f
                        uint64_t 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;
+                       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;
+                       return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
+               }
                case LDKMessageSendEvent_HandleError: {
                        int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
                        (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
@@ -2141,7 +2219,7 @@ LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, ui
        int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
        }
        LDKPublicKey ret_ref;
        CHECK((*env)->GetArrayLength(env, ret) == 33);
@@ -2165,7 +2243,7 @@ LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_a
        int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
        }
        LDKThirtyTwoBytes ret_ref;
        CHECK((*env)->GetArrayLength(env, ret) == 32);
@@ -2189,7 +2267,7 @@ LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
        int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
        }
        LDKThirtyTwoBytes ret_ref;
        CHECK((*env)->GetArrayLength(env, ret) == 32);
@@ -2218,10 +2296,10 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
        }
        LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
@@ -2249,10 +2327,10 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
        }
        LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
@@ -2278,10 +2356,10 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo
        (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
        }
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
@@ -2315,10 +2393,10 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
        }
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
@@ -2352,10 +2430,10 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
        }
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
@@ -2379,10 +2457,10 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void*
        Transaction_free(closing_tx_var);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
        }
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
@@ -2410,10 +2488,10 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
        }
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
@@ -2444,17 +2522,12 @@ void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransaction
        (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
 }
-static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
-       LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
-       atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
-}
 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
        jclass c = (*env)->GetObjectClass(env, o);
        CHECK(c != NULL);
@@ -2693,7 +2766,7 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
        int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
        }
        LDKCVec_u8Z ret_ref;
        ret_ref.datalen = (*env)->GetArrayLength(env, ret);
@@ -2704,11 +2777,10 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
        }
        return ret_ref;
 }
-static void* LDKSign_JCalls_clone(const void* this_arg) {
-       LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
+static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
+       LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
        atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -2728,7 +2800,7 @@ static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject
        LDKSign ret = {
                .this_arg = (void*) calls,
                .write = write_LDKSign_jcall,
-               .clone = LDKSign_JCalls_clone,
+               .cloned = LDKSign_JCalls_cloned,
                .free = LDKSign_JCalls_free,
                .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
        };
@@ -2740,6 +2812,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, j
        *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
        return (uint64_t)res_ptr;
 }
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKSign *inp = (LDKSign *)(arg & ~1);
+       uint64_t res_ptr = (uint64_t)&inp->BaseSign;
+       DO_ASSERT((res_ptr & 1) == 0);
+       return (int64_t)(res_ptr | 1);
+}
 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
        LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
        LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
@@ -2941,6 +3019,34 @@ 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;
 }
+static jclass LDKCOption_u16Z_Some_class = NULL;
+static jmethodID LDKCOption_u16Z_Some_meth = NULL;
+static jclass LDKCOption_u16Z_None_class = NULL;
+static jmethodID LDKCOption_u16Z_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
+       LDKCOption_u16Z_Some_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
+       CHECK(LDKCOption_u16Z_Some_class != NULL);
+       LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
+       CHECK(LDKCOption_u16Z_Some_meth != NULL);
+       LDKCOption_u16Z_None_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
+       CHECK(LDKCOption_u16Z_None_class != NULL);
+       LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
+       CHECK(LDKCOption_u16Z_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+       LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
+       switch(obj->tag) {
+               case LDKCOption_u16Z_Some: {
+                       return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
+               }
+               case LDKCOption_u16Z_None: {
+                       return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
+               }
+               default: abort();
+       }
+}
 static jclass LDKAPIError_APIMisuseError_class = NULL;
 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
@@ -2951,6 +3057,8 @@ static jclass LDKAPIError_ChannelUnavailable_class = NULL;
 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
+static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
+static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
        LDKAPIError_APIMisuseError_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
@@ -2977,6 +3085,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv
        CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
        LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
        CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
+       LDKAPIError_IncompatibleShutdownScript_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
+       CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
+       LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
+       CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
 }
 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
        LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
@@ -3004,6 +3117,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr
                case LDKAPIError_MonitorUpdateFailed: {
                        return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
                }
+               case LDKAPIError_IncompatibleShutdownScript: {
+                       LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
+                       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;
+                       return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
+               }
                default: abort();
        }
 }
@@ -3162,6 +3282,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSend
        uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
        return err_ref;
 }
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
+}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(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_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
+       return err_ref;
+}
 static jclass LDKNetAddress_IPv4_class = NULL;
 static jmethodID LDKNetAddress_IPv4_meth = NULL;
 static jclass LDKNetAddress_IPv6_class = NULL;
@@ -3360,10 +3496,10 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void*
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
        }
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
@@ -3397,10 +3533,10 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
        }
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
@@ -3423,7 +3559,7 @@ LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void*
        int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
        }
        LDKCVec_MonitorEventZ ret_constr;
        ret_constr.datalen = (*env)->GetArrayLength(env, ret);
@@ -3444,10 +3580,9 @@ LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void*
        }
        return ret_constr;
 }
-static void* LDKWatch_JCalls_clone(const void* this_arg) {
-       LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
+static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
+       LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -3564,16 +3699,15 @@ void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, L
        (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
 }
-static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
-       LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
+static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
+       LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -3613,7 +3747,7 @@ typedef struct LDKKeysInterface_JCalls {
        jweak o;
        jmethodID get_node_secret_meth;
        jmethodID get_destination_script_meth;
-       jmethodID get_shutdown_pubkey_meth;
+       jmethodID get_shutdown_scriptpubkey_meth;
        jmethodID get_channel_signer_meth;
        jmethodID get_secure_random_bytes_meth;
        jmethodID read_chan_signer_meth;
@@ -3650,7 +3784,7 @@ LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
        int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
        }
        LDKSecretKey ret_ref;
        CHECK((*env)->GetArrayLength(env, ret) == 32);
@@ -3674,7 +3808,7 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg)
        int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
        }
        LDKCVec_u8Z ret_ref;
        ret_ref.datalen = (*env)->GetArrayLength(env, ret);
@@ -3685,7 +3819,7 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg)
        }
        return ret_ref;
 }
-LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
+LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
        JNIEnv *env;
        jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
@@ -3696,18 +3830,19 @@ LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
        }
-       LDKPublicKey ret_ref;
-       CHECK((*env)->GetArrayLength(env, ret) == 33);
-       (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
+       LDKShutdownScript ret_conv;
+       ret_conv.inner = (void*)(ret & (~1));
+       ret_conv.is_owned = (ret & 1) || (ret == 0);
+       ret_conv = ShutdownScript_clone(&ret_conv);
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
-       return ret_ref;
+       return ret_conv;
 }
 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
@@ -3720,13 +3855,13 @@ LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inb
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
        }
        LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
-       ret_conv = Sign_clone(ret);
+       ret_conv = Sign_clone(&ret_conv);
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
@@ -3746,7 +3881,7 @@ LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* thi
        int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
        }
        LDKThirtyTwoBytes ret_ref;
        CHECK((*env)->GetArrayLength(env, ret) == 32);
@@ -3770,10 +3905,10 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void*
        (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
        }
        LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
@@ -3797,10 +3932,10 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v
        CVec_u8Z_free(invoice_preimage_var);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
        }
        LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
@@ -3809,10 +3944,9 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v
        }
        return ret_conv;
 }
-static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
-       LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
+static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
+       LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -3825,8 +3959,8 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j
        CHECK(calls->get_node_secret_meth != NULL);
        calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
        CHECK(calls->get_destination_script_meth != NULL);
-       calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
-       CHECK(calls->get_shutdown_pubkey_meth != NULL);
+       calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
+       CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
        calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
        CHECK(calls->get_channel_signer_meth != NULL);
        calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
@@ -3840,7 +3974,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j
                .this_arg = (void*) calls,
                .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
                .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
-               .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
+               .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
                .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
                .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
                .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
@@ -3870,11 +4004,16 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1des
        return ret_arr;
 }
 
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
        LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
-       int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
-       (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
-       return ret_arr;
+       LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
@@ -3951,17 +4090,16 @@ uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg,
        int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
        return ret;
 }
-static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
-       LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
+static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
+       LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -4031,16 +4169,15 @@ void log_LDKLogger_jcall(const void* this_arg, const char* record) {
        (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
 }
-static void* LDKLogger_JCalls_clone(const void* this_arg) {
-       LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
+static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
+       LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -4604,6 +4741,40 @@ static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCV
        }
        return ret;
 }
+static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
+static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
+static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
+static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
+       LDKPaymentPurpose_InvoicePayment_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
+       CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
+       LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
+       CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
+       LDKPaymentPurpose_SpontaneousPayment_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
+       CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
+       LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
+       CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+       LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
+       switch(obj->tag) {
+               case LDKPaymentPurpose_InvoicePayment: {
+                       int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
+                       int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
+                       return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
+               }
+               case LDKPaymentPurpose_SpontaneousPayment: {
+                       int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
+                       return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
+               }
+               default: abort();
+       }
+}
 static jclass LDKEvent_FundingGenerationReady_class = NULL;
 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
 static jclass LDKEvent_PaymentReceived_class = NULL;
@@ -4616,6 +4787,8 @@ static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
 static jclass LDKEvent_SpendableOutputs_class = NULL;
 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
+static jclass LDKEvent_PaymentForwarded_class = NULL;
+static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
        LDKEvent_FundingGenerationReady_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
@@ -4625,7 +4798,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en
        LDKEvent_PaymentReceived_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
        CHECK(LDKEvent_PaymentReceived_class != NULL);
-       LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
+       LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
        CHECK(LDKEvent_PaymentReceived_meth != NULL);
        LDKEvent_PaymentSent_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
@@ -4647,6 +4820,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en
        CHECK(LDKEvent_SpendableOutputs_class != NULL);
        LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
        CHECK(LDKEvent_SpendableOutputs_meth != NULL);
+       LDKEvent_PaymentForwarded_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
+       CHECK(LDKEvent_PaymentForwarded_class != NULL);
+       LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
+       CHECK(LDKEvent_PaymentForwarded_meth != NULL);
 }
 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
        LDKEvent *obj = (LDKEvent*)(ptr & ~1);
@@ -4662,11 +4840,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN
                case LDKEvent_PaymentReceived: {
                        int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
                        (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
-                       int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
-                       (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
-                       int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
-                       (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
-                       return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_preimage_arr, payment_secret_arr, obj->payment_received.amt, obj->payment_received.user_payment_id);
+                       uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
+                       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_preimage_arr = (*env)->NewByteArray(env, 32);
@@ -4692,6 +4867,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN
                        (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
                        return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
                }
+               case LDKEvent_PaymentForwarded: {
+                       uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
+                       return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
+               }
                default: abort();
        }
 }
@@ -5419,6 +5598,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDe
        uint64_t 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) {
+       return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKClosingSignedFeeRange 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_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);
+       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_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
        return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
 }
@@ -6070,7 +6270,7 @@ LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsP
        int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
        }
        LDKCVec_MessageSendEventZ ret_constr;
        ret_constr.datalen = (*env)->GetArrayLength(env, ret);
@@ -6091,10 +6291,9 @@ LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsP
        }
        return ret_constr;
 }
-static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
-       LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
+       LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -6174,16 +6373,15 @@ void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
        (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
 }
-static void* LDKEventHandler_JCalls_clone(const void* this_arg) {
-       LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
+static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
+       LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -6252,16 +6450,15 @@ void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEve
        (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
 }
-static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
-       LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
+static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
+       LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -6290,7 +6487,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pendi
        LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
        if (handler_conv.free == LDKEventHandler_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKEventHandler_JCalls_clone(handler_conv.this_arg);
+               LDKEventHandler_JCalls_cloned(&handler_conv);
        }
        (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
 }
@@ -6331,10 +6528,10 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons
        (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
        }
        LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
@@ -6343,10 +6540,9 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons
        }
        return ret_conv;
 }
-static void* LDKAccess_JCalls_clone(const void* this_arg) {
-       LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
+       LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -6422,7 +6618,7 @@ void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uin
        (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -6444,16 +6640,15 @@ void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* h
        (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
 }
-static void* LDKListen_JCalls_clone(const void* this_arg) {
-       LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
+static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
+       LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -6550,7 +6745,7 @@ void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t
        (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -6572,7 +6767,7 @@ void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_
        (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -6594,7 +6789,7 @@ void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (*
        (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -6614,7 +6809,7 @@ LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
        jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
        }
        LDKCVec_TxidZ ret_constr;
        ret_constr.datalen = (*env)->GetArrayLength(env, ret);
@@ -6634,10 +6829,9 @@ LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
        }
        return ret_constr;
 }
-static void* LDKConfirm_JCalls_clone(const void* this_arg) {
-       LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
+static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
+       LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -6768,7 +6962,7 @@ void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32
        (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -6792,10 +6986,10 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
        }
        LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
        ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
@@ -6804,10 +6998,9 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void
        }
        return ret_conv;
 }
-static void* LDKFilter_JCalls_clone(const void* this_arg) {
-       LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
+       LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -6909,10 +7102,10 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*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, id_ref, data_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
        }
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
@@ -6955,10 +7148,10 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*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, id_ref, update_ref, data_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
        }
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
@@ -6967,10 +7160,9 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal
        }
        return ret_conv;
 }
-static void* LDKPersist_JCalls_clone(const void* this_arg) {
-       LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
+static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
+       LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -7102,7 +7294,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD
        (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7139,7 +7331,7 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg,
        (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7169,7 +7361,7 @@ void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg,
        (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7199,7 +7391,7 @@ void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg,
        (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7229,7 +7421,7 @@ void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg,
        (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7267,7 +7459,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub
        (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7297,7 +7489,7 @@ void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg,
        (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7327,7 +7519,7 @@ void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg,
        (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7357,7 +7549,7 @@ void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_
        (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7387,7 +7579,7 @@ void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg
        (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7417,7 +7609,7 @@ void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void
        (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7447,7 +7639,7 @@ void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_ar
        (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7477,7 +7669,7 @@ void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg,
        (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7507,7 +7699,7 @@ void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP
        (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7537,7 +7729,7 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t
        (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7559,7 +7751,7 @@ void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP
        (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7589,7 +7781,7 @@ void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPubl
        (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7619,7 +7811,7 @@ void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_
        (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7649,7 +7841,7 @@ void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg,
        (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -7679,17 +7871,16 @@ void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublic
        (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
 }
-static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
-       LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
+static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
+       LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
        atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -7772,6 +7963,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1n
        *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
        return (uint64_t)res_ptr;
 }
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
+       uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
+       DO_ASSERT((res_ptr & 1) == 0);
+       return (int64_t)(res_ptr | 1);
+}
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
        LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
        LDKPublicKey their_node_id_ref;
@@ -8053,10 +8250,10 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
@@ -8084,10 +8281,10 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
@@ -8115,10 +8312,10 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
@@ -8142,7 +8339,7 @@ void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void*
        (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_htlc_fail_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -8162,7 +8359,7 @@ LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel
        int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
        ret_constr.datalen = (*env)->GetArrayLength(env, ret);
@@ -8199,7 +8396,7 @@ LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_j
        int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCVec_NodeAnnouncementZ ret_constr;
        ret_constr.datalen = (*env)->GetArrayLength(env, ret);
@@ -8246,7 +8443,7 @@ void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDK
        (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -8272,10 +8469,10 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
@@ -8304,10 +8501,10 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
@@ -8336,10 +8533,10 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
@@ -8368,10 +8565,10 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
        }
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
@@ -8380,11 +8577,10 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH
        }
        return ret_conv;
 }
-static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
-       LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
+static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
+       LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
        atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -8440,6 +8636,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1n
        *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
        return (uint64_t)res_ptr;
 }
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
+       uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
+       DO_ASSERT((res_ptr & 1) == 0);
+       return (int64_t)(res_ptr | 1);
+}
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
        LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
        LDKNodeAnnouncement msg_conv;
@@ -8624,7 +8826,7 @@ uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, b
        int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -8645,7 +8847,7 @@ void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
        (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -8667,7 +8869,7 @@ bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescripto
        jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
@@ -8688,17 +8890,16 @@ uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
        int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
        }
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
        return ret;
 }
-static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
-       LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
+static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
+       LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -8722,7 +8923,7 @@ static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass
                .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
                .eq = eq_LDKSocketDescriptor_jcall,
                .hash = hash_LDKSocketDescriptor_jcall,
-               .clone = LDKSocketDescriptor_JCalls_clone,
+               .cloned = LDKSocketDescriptor_JCalls_cloned,
                .free = LDKSocketDescriptor_JCalls_free,
        };
        return ret;
@@ -8795,10 +8996,10 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
+               (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
        }
        LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
@@ -8807,10 +9008,9 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi
        }
        return ret_conv;
 }
-static void* LDKChannelManagerPersister_JCalls_clone(const void* this_arg) {
-       LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
+static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
+       LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
        atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-       return (void*) this_arg;
 }
 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
        jclass c = (*env)->GetObjectClass(env, o);
@@ -8893,12 +9093,14 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr
 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;
 }
 
@@ -8911,6 +9113,16 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env,
        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;
        LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
@@ -9394,6 +9606,67 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNo
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+       LDKInvalidShutdownScript e_conv;
+       e_conv.inner = (void*)(e & (~1));
+       e_conv.is_owned = (e & 1) || (e == 0);
+       // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
        LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
        *ret_conv = CResult_NoneErrorZ_ok();
@@ -10140,7 +10413,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1
        LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
        if (o_conv.free == LDKSign_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKSign_JCalls_clone(o_conv.this_arg);
+               LDKSign_JCalls_cloned(&o_conv);
        }
        LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
        *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
@@ -10421,6 +10694,35 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockH
        CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_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);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
+       LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
+       *ret_copy = COption_u16Z_none();
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       COption_u16Z_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
+       LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
+       *ret_copy = COption_u16Z_clone(orig_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
        LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
        *ret_conv = CResult_NoneAPIErrorZ_ok();
@@ -10511,6 +10813,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_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_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+       LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
        LDKCVec_NetAddressZ _res_constr;
        _res_constr.datalen = (*env)->GetArrayLength(env, _res);
@@ -12226,6 +12558,40 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecod
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKClosingSignedFeeRange o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ClosingSignedFeeRange_clone(&o_conv);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_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_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
        LDKCommitmentSigned o_conv;
        o_conv.inner = (void*)(o & (~1));
@@ -13175,14 +13541,52 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreat
        return (uint64_t)ret_conv;
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
-       LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
+       LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
        FREE((void*)this_ptr);
-       Event_free(this_ptr_conv);
+       PaymentPurpose_free(this_ptr_conv);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_clone(orig_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
+       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
+       LDKThirtyTwoBytes payment_secret_ref;
+       CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
+       (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
+       LDKThirtyTwoBytes a_ref;
+       CHECK((*env)->GetArrayLength(env, a) == 32);
+       (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       if ((this_ptr & 1) != 0) return;
+       LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
+       FREE((void*)this_ptr);
+       Event_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
        LDKEvent* orig_conv = (LDKEvent*)orig;
        LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
        *ret_copy = Event_clone(orig_conv);
@@ -13190,6 +13594,87 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, j
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
+       LDKThirtyTwoBytes temporary_channel_id_ref;
+       CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
+       (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
+       LDKCVec_u8Z output_script_ref;
+       output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
+       output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
+       (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amt, int64_t purpose) {
+       LDKThirtyTwoBytes payment_hash_ref;
+       CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
+       (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
+       LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage) {
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
+       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_payment_sent(payment_preimage_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest) {
+       LDKThirtyTwoBytes payment_hash_ref;
+       CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
+       (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
+       LDKCVec_SpendableOutputDescriptorZ outputs_constr;
+       outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
+       if (outputs_constr.datalen > 0)
+               outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
+       else
+               outputs_constr.data = NULL;
+       int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
+       for (size_t b = 0; b < outputs_constr.datalen; b++) {
+               int64_t outputs_conv_27 = outputs_vals[b];
+               LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
+               outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
+               outputs_constr.data[b] = outputs_conv_27_conv;
+       }
+       (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_spendable_outputs(outputs_constr);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
+       LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
        LDKEvent* obj_conv = (LDKEvent*)obj;
        LDKCVec_u8Z ret_var = Event_write(obj_conv);
@@ -13214,6 +13699,272 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNI
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKAcceptChannel msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = AcceptChannel_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKOpenChannel msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = OpenChannel_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKFundingCreated msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = FundingCreated_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKFundingSigned msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = FundingSigned_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKFundingLocked msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = FundingLocked_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKAnnouncementSignatures msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = AnnouncementSignatures_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKCommitmentUpdate updates_conv;
+       updates_conv.inner = (void*)(updates & (~1));
+       updates_conv.is_owned = (updates & 1) || (updates == 0);
+       updates_conv = CommitmentUpdate_clone(&updates_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKRevokeAndACK msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = RevokeAndACK_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKClosingSigned msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ClosingSigned_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKShutdown msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = Shutdown_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKChannelReestablish msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ChannelReestablish_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
+       LDKChannelAnnouncement msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ChannelAnnouncement_clone(&msg_conv);
+       LDKChannelUpdate update_msg_conv;
+       update_msg_conv.inner = (void*)(update_msg & (~1));
+       update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
+       update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
+       LDKNodeAnnouncement msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = NodeAnnouncement_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
+       LDKChannelUpdate msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ChannelUpdate_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKChannelUpdate msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ChannelUpdate_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1payment_1failure_1network_1update(JNIEnv *env, jclass clz, int64_t update) {
+       LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKQueryChannelRange msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = QueryChannelRange_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKQueryShortChannelIds msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = QueryShortChannelIds_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKReplyChannelRange msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ReplyChannelRange_clone(&msg_conv);
+       LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+       *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
@@ -13250,13 +14001,64 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
+       LDKStr err_conv = java_to_owned_str(env, err);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_apimisuse_error(err_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
+       LDKStr err_conv = java_to_owned_str(env, err);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
+       LDKStr err_conv = java_to_owned_str(env, err);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_route_error(err_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
+       LDKStr err_conv = java_to_owned_str(env, err);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_channel_unavailable(err_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_monitor_update_failed();
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
+       LDKShutdownScript script_conv;
+       script_conv.inner = (void*)(script & (~1));
+       script_conv.is_owned = (script & 1) || (script == 0);
+       script_conv = ShutdownScript_clone(&script_conv);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_incompatible_shutdown_script(script_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
        LDKu8slice msg_ref;
        msg_ref.datalen = (*env)->GetArrayLength(env, msg);
        msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
-       LDKSecretKey sk_ref;
+       unsigned char sk_arr[32];
        CHECK((*env)->GetArrayLength(env, sk) == 32);
-       (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_ref.bytes);
+       (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
+       unsigned char (*sk_ref)[32] = &sk_arr;
        LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
        *ret_conv = sign(msg_ref, sk_ref);
        (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
@@ -13293,6 +14095,31 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jc
        return ret_conv;
 }
 
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKLevel_to_java(env, Level_trace());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKLevel_to_java(env, Level_debug());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKLevel_to_java(env, Level_info());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKLevel_to_java(env, Level_warn());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKLevel_to_java(env, Level_error());
+       return ret_conv;
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
        LDKLevel* a_conv = (LDKLevel*)(a & ~1);
        LDKLevel* b_conv = (LDKLevel*)(b & ~1);
@@ -13576,19 +14403,34 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *en
        ChannelConfig_free(this_obj_conv);
 }
 
-JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
+JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
        LDKChannelConfig this_ptr_conv;
        this_ptr_conv.inner = (void*)(this_ptr & (~1));
        this_ptr_conv.is_owned = false;
-       int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
+       int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
        return ret_val;
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
        LDKChannelConfig this_ptr_conv;
        this_ptr_conv.inner = (void*)(this_ptr & (~1));
        this_ptr_conv.is_owned = false;
-       ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
+       ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
+}
+
+JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
 }
 
 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
@@ -13636,8 +14478,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1up
        ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
-       LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+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);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -13775,7 +14647,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1opti
        UserConfig_set_channel_options(&this_ptr_conv, val_conv);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg) {
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKUserConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
+       LDKUserConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg) {
        LDKChannelHandshakeConfig own_channel_config_arg_conv;
        own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
        own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
@@ -13788,7 +14675,32 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env
        channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
        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);
+       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);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKUserConfig orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKUserConfig ret_var = UserConfig_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 int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
+       LDKUserConfig ret_var = UserConfig_default();
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -13798,11 +14710,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env
        return ret_ref;
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
-       LDKUserConfig orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKBestBlock this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       BestBlock_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKBestBlock orig_conv;
        orig_conv.inner = (void*)(orig & (~1));
        orig_conv.is_owned = false;
-       LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
+       LDKBestBlock ret_var = BestBlock_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;
@@ -13812,8 +14731,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *e
        return ret_ref;
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
-       LDKUserConfig ret_var = UserConfig_default();
+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);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
+       LDKThirtyTwoBytes block_hash_ref;
+       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);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -13823,12 +14757,39 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv
        return ret_ref;
 }
 
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKBestBlock this_arg_conv;
+       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, BestBlock_block_hash(&this_arg_conv).data);
+       return ret_arr;
+}
+
+JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKBestBlock this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       int32_t ret_val = BestBlock_height(&this_arg_conv);
+       return ret_val;
+}
+
 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
        LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
        jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
        return ret_conv;
 }
 
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
+       return ret_conv;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
@@ -13993,6 +14954,28 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JN
        return ret_conv;
 }
 
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
+       return ret_conv;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+       LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
+       LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
+       jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
+       return ret_val;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
@@ -14014,7 +14997,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *e
                chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
                if (chain_source_conv.free == LDKFilter_JCalls_free) {
                        // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-                       LDKFilter_JCalls_clone(chain_source_conv.this_arg);
+                       LDKFilter_JCalls_cloned(&chain_source_conv);
                }
                chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
                *chain_source_conv_ptr = chain_source_conv;
@@ -14022,22 +15005,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *e
        LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
        if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
        }
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
        if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&feeest_conv);
        }
        LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
        if (persister_conv.free == LDKPersist_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKPersist_JCalls_clone(persister_conv.this_arg);
+               LDKPersist_JCalls_cloned(&persister_conv);
        }
        LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
@@ -14148,6 +15131,16 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clo
        return ret_conv;
 }
 
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
+       return ret_conv;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKMonitorUpdateError this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -14184,6 +15177,28 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
+       LDKHTLCUpdate a_conv;
+       a_conv.inner = (void*)(a & (~1));
+       a_conv.is_owned = (a & 1) || (a == 0);
+       a_conv = HTLCUpdate_clone(&a_conv);
+       LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
+       *ret_copy = MonitorEvent_htlcevent(a_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1broadcasted(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_commitment_tx_broadcasted(a_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 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));
@@ -14395,17 +15410,17 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_
        LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
        if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
        }
        LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
        if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
        }
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               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);
@@ -14431,17 +15446,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconn
        LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
        if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
        }
        LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
        if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
        }
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
 }
@@ -14471,17 +15486,17 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transa
        LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
        if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
        }
        LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
        if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
        }
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               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);
@@ -14507,17 +15522,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1u
        LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
        if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
        }
        LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
        if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
        }
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
 }
@@ -14533,17 +15548,17 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1
        LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
        if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
        }
        LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
        if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
        }
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               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);
@@ -14574,6 +15589,20 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1r
        return ret_arr;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKChannelMonitor this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKBestBlock ret_var = ChannelMonitor_current_best_block(&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;
+       }
+       return ret_ref;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
@@ -15040,6 +16069,40 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
+       LDKOutPoint outpoint_conv;
+       outpoint_conv.inner = (void*)(outpoint & (~1));
+       outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
+       outpoint_conv = OutPoint_clone(&outpoint_conv);
+       LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
+       LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
+       *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
+       LDKDelayedPaymentOutputDescriptor a_conv;
+       a_conv.inner = (void*)(a & (~1));
+       a_conv.is_owned = (a & 1) || (a == 0);
+       a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
+       LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
+       *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
+       LDKStaticPaymentOutputDescriptor a_conv;
+       a_conv.inner = (void*)(a & (~1));
+       a_conv.is_owned = (a & 1) || (a == 0);
+       a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
+       LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
+       *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
        LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
        LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
@@ -15568,30 +16631,37 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIE
        return ret_ref;
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
-       LDKBestBlock this_obj_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKChannelCounterparty this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
        this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
-       BestBlock_free(this_obj_conv);
+       ChannelCounterparty_free(this_obj_conv);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
-       LDKBestBlock orig_conv;
-       orig_conv.inner = (void*)(orig & (~1));
-       orig_conv.is_owned = false;
-       LDKBestBlock ret_var = BestBlock_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 int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelCounterparty 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, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
+       return ret_arr;
 }
 
-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);
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
+       LDKChannelCounterparty 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);
+       ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelCounterparty this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKInitFeatures ret_var = ChannelCounterparty_get_features(&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;
@@ -15601,11 +16671,37 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JN
        return ret_ref;
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
-       LDKThirtyTwoBytes block_hash_ref;
-       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);
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelCounterparty this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKInitFeatures val_conv;
+       val_conv.inner = (void*)(val & (~1));
+       val_conv.is_owned = (val & 1) || (val == 0);
+       val_conv = InitFeatures_clone(&val_conv);
+       ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelCounterparty this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelCounterparty this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKChannelCounterparty orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKChannelCounterparty ret_var = ChannelCounterparty_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;
@@ -15615,23 +16711,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env,
        return ret_ref;
 }
 
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
-       LDKBestBlock this_arg_conv;
-       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, BestBlock_block_hash(&this_arg_conv).data);
-       return ret_arr;
-}
-
-JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
-       LDKBestBlock this_arg_conv;
-       this_arg_conv.inner = (void*)(this_arg & (~1));
-       this_arg_conv.is_owned = false;
-       int32_t ret_val = BestBlock_height(&this_arg_conv);
-       return ret_val;
-}
-
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKChannelDetails this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -15658,6 +16737,31 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1
        ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelDetails this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&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_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelDetails this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKChannelCounterparty val_conv;
+       val_conv.inner = (void*)(val & (~1));
+       val_conv.is_owned = (val & 1) || (val == 0);
+       val_conv = ChannelCounterparty_clone(&val_conv);
+       ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
        LDKChannelDetails this_ptr_conv;
        this_ptr_conv.inner = (void*)(this_ptr & (~1));
@@ -15701,50 +16805,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1ch
        ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
 }
 
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
-       LDKChannelDetails 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, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
-       return ret_arr;
-}
-
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
-       LDKChannelDetails 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);
-       ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
-       LDKChannelDetails this_ptr_conv;
-       this_ptr_conv.inner = (void*)(this_ptr & (~1));
-       this_ptr_conv.is_owned = false;
-       LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&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_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
-       LDKChannelDetails this_ptr_conv;
-       this_ptr_conv.inner = (void*)(this_ptr & (~1));
-       this_ptr_conv.is_owned = false;
-       LDKInitFeatures val_conv;
-       val_conv.inner = (void*)(val & (~1));
-       val_conv.is_owned = (val & 1) || (val == 0);
-       val_conv = InitFeatures_clone(&val_conv);
-       ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
-}
-
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
        LDKChannelDetails this_ptr_conv;
        this_ptr_conv.inner = (void*)(this_ptr & (~1));
@@ -15760,6 +16820,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1
        ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelDetails 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 = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelDetails this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+       ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
        LDKChannelDetails this_ptr_conv;
        this_ptr_conv.inner = (void*)(this_ptr & (~1));
@@ -15805,6 +16883,42 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1
        ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelDetails this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
+       *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelDetails this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+       ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelDetails this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
+       *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelDetails this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
+       ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
        LDKChannelDetails this_ptr_conv;
        this_ptr_conv.inner = (void*)(this_ptr & (~1));
@@ -15865,6 +16979,32 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1publi
        ChannelDetails_set_is_public(&this_ptr_conv, val);
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
+       LDKThirtyTwoBytes channel_id_arg_ref;
+       CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
+       (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
+       LDKChannelCounterparty counterparty_arg_conv;
+       counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
+       counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
+       counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
+       LDKOutPoint funding_txo_arg_conv;
+       funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
+       funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
+       funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
+       LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
+       LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
+       LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
+       LDKCOption_u16Z force_close_spend_delay_arg_conv = *(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_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);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
        LDKChannelDetails orig_conv;
        orig_conv.inner = (void*)(orig & (~1));
@@ -15894,31 +17034,102 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(J
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
+       LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
+       LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
+       *ret_copy = PaymentSendFailure_parameter_error(a_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(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");
+       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];
+               LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
+               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);
+       LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
+       *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
+       LDKCVec_APIErrorZ a_constr;
+       a_constr.datalen = (*env)->GetArrayLength(env, a);
+       if (a_constr.datalen > 0)
+               a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
+       else
+               a_constr.data = NULL;
+       int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
+       for (size_t k = 0; k < a_constr.datalen; k++) {
+               int64_t a_conv_10 = a_vals[k];
+               LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
+               a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
+               a_constr.data[k] = a_conv_10_conv;
+       }
+       (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
+       LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
+       *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       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");
+       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];
+               LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
+               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);
+       LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
+       *ret_copy = PaymentSendFailure_partial_failure(a_constr);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t params) {
        LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
        if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
        }
        LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
        if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
+               LDKWatch_JCalls_cloned(&chain_monitor_conv);
        }
        LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
        if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
        }
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
        if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
+               LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
        }
        LDKUserConfig config_conv;
        config_conv.inner = (void*)(config & (~1));
@@ -16025,6 +17236,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1chan
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       unsigned char channel_id_arr[32];
+       CHECK((*env)->GetArrayLength(env, channel_id) == 32);
+       (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
+       unsigned char (*channel_id_ref)[32] = &channel_id_arr;
+       LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+       *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -16063,6 +17287,21 @@ 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_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
+       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;
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
+       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -16237,6 +17476,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persist
        ChannelManager_await_persistable_update(&this_arg_conv);
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(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;
+       LDKBestBlock ret_var = ChannelManager_current_best_block(&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;
+       }
+       return ret_ref;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -16279,7 +17532,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1k
        LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
        if (val_conv.free == LDKKeysInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKKeysInterface_JCalls_clone(val_conv.this_arg);
+               LDKKeysInterface_JCalls_cloned(&val_conv);
        }
        ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
 }
@@ -16299,7 +17552,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1f
        LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
        if (val_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&val_conv);
        }
        ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
 }
@@ -16319,7 +17572,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1c
        LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
        if (val_conv.free == LDKWatch_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKWatch_JCalls_clone(val_conv.this_arg);
+               LDKWatch_JCalls_cloned(&val_conv);
        }
        ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
 }
@@ -16339,7 +17592,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1t
        LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
        if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&val_conv);
        }
        ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
 }
@@ -16359,7 +17612,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1l
        LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
        if (val_conv.free == LDKLogger_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKLogger_JCalls_clone(val_conv.this_arg);
+               LDKLogger_JCalls_cloned(&val_conv);
        }
        ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
 }
@@ -16393,27 +17646,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new
        LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
        if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
+               LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
        }
        LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
        if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
+               LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
        }
        LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
        if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
+               LDKWatch_JCalls_cloned(&chain_monitor_conv);
        }
        LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
        if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
+               LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
        }
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        LDKUserConfig default_config_conv;
        default_config_conv.inner = (void*)(default_config & (~1));
@@ -16572,6 +17825,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNI
        this_ptr_conv.is_owned = false;
        LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -17647,6 +18901,68 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env
        return ret_ref;
 }
 
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKClosingSignedFeeRange this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ClosingSignedFeeRange_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+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);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKClosingSignedFeeRange orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_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 void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKClosingSigned this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -17707,14 +19023,43 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(
        ClosingSigned_set_signature(&this_ptr_conv, val_ref);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSigned this_ptr_conv;
+       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;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange val_conv;
+       val_conv.inner = (void*)(val & (~1));
+       val_conv.is_owned = (val & 1) || (val == 0);
+       val_conv = ClosingSignedFeeRange_clone(&val_conv);
+       ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
        LDKThirtyTwoBytes channel_id_arg_ref;
        CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
        (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
        LDKSignature signature_arg_ref;
        CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
        (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
-       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
+       LDKClosingSignedFeeRange fee_range_arg_conv;
+       fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
+       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);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -18608,6 +19953,46 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *e
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
+       LDKFourBytes addr_ref;
+       CHECK((*env)->GetArrayLength(env, addr) == 4);
+       (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
+       LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
+       *ret_copy = NetAddress_ipv4(addr_ref, port);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
+       LDKSixteenBytes addr_ref;
+       CHECK((*env)->GetArrayLength(env, addr) == 16);
+       (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
+       LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
+       *ret_copy = NetAddress_ipv6(addr_ref, port);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
+       LDKTenBytes addr_ref;
+       CHECK((*env)->GetArrayLength(env, addr) == 10);
+       (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
+       LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
+       *ret_copy = NetAddress_onion_v2(addr_ref, port);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
+       LDKThirtyTwoBytes ed25519_pubkey_ref;
+       CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
+       (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
+       LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
+       *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
        LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
        LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
@@ -19859,6 +21244,43 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
+       LDKErrorMessage msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ErrorMessage_clone(&msg_conv);
+       LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
+       *ret_copy = ErrorAction_disconnect_peer(msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
+       LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
+       *ret_copy = ErrorAction_ignore_error();
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
+       LDKLevel a_conv = LDKLevel_from_java(env, a);
+       LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
+       *ret_copy = ErrorAction_ignore_and_log(a_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
+       LDKErrorMessage msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ErrorMessage_clone(&msg_conv);
+       LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
+       *ret_copy = ErrorAction_send_error_message(msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKLightningError this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -19872,6 +21294,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JN
        this_ptr_conv.is_owned = false;
        LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -20189,6 +21612,34 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clon
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
+       LDKChannelUpdate msg_conv;
+       msg_conv.inner = (void*)(msg & (~1));
+       msg_conv.is_owned = (msg & 1) || (msg == 0);
+       msg_conv = ChannelUpdate_clone(&msg_conv);
+       LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
+       *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
+       LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
+       *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
+       LDKPublicKey node_id_ref;
+       CHECK((*env)->GetArrayLength(env, node_id) == 33);
+       (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+       LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
+       *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
@@ -20277,12 +21728,33 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JN
        return ret_arr;
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_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_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
+       *ret_conv = ClosingSigned_read(ser_ref);
+       (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
+       LDKClosingSignedFeeRange obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ClosingSignedFeeRange_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_ClosingSignedFeeRange_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_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
-       *ret_conv = ClosingSigned_read(ser_ref);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = ClosingSignedFeeRange_read(ser_ref);
        (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
        return (uint64_t)ret_conv;
 }
@@ -20956,7 +22428,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1han
        LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
        if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
+               LDKChannelMessageHandler_JCalls_cloned(&val_conv);
        }
        MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
 }
@@ -20976,7 +22448,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1ha
        LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
        if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
+               LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
        }
        MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
 }
@@ -20985,12 +22457,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv
        LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
        if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
+               LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
        }
        LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
        if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
+               LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
        }
        LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
@@ -21085,7 +22557,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *en
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
@@ -21123,7 +22595,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_
        LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
        if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
+               LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
        }
        LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
        *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
@@ -21137,7 +22609,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1
        LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
        if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
+               LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
        }
        LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
        *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
@@ -22945,6 +24417,193 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEn
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ShutdownScript_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKShutdownScript orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKShutdownScript ret_var = ShutdownScript_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 void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKInvalidShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       InvalidShutdownScript_free(this_obj_conv);
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
+       int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+       (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+       return ret_arr;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCVec_u8Z val_ref;
+       val_ref.datalen = (*env)->GetArrayLength(env, val);
+       val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
+       (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
+       InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
+       LDKCVec_u8Z script_arg_ref;
+       script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
+       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);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
+       LDKShutdownScript obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ShutdownScript_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_ShutdownScript_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = ShutdownScript_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_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
+       (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
+       unsigned char script_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, script_hash) == 20);
+       (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr);
+       unsigned char (*script_hash_ref)[20] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
+       (*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);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
+       unsigned char script_hash_arr[32];
+       CHECK((*env)->GetArrayLength(env, script_hash) == 32);
+       (*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);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&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 int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
+       LDKu8slice program_ref;
+       program_ref.datalen = (*env)->GetArrayLength(env, program);
+       program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
+       (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       this_arg_conv = ShutdownScript_clone(&this_arg_conv);
+       LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_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 int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
+       (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
+       return ret_arr;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKInitFeatures features_conv;
+       features_conv.inner = (void*)(features & (~1));
+       features_conv.is_owned = false;
+       jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
+       return ret_val;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKRouteHop this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -23429,6 +25088,62 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, 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) {
+       LDKPublicKey our_node_id_ref;
+       CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
+       (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_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);
+       LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+       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);
+       }
+       LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
+       *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
+       if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, 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) {
        LDKPublicKey our_node_id_ref;
        CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
@@ -23444,20 +25159,24 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jcl
        payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
        payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
        LDKCVec_ChannelDetailsZ first_hops_constr;
-       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);
+       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)
@@ -23477,11 +25196,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jcl
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
-       *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
-       FREE(first_hops_constr.data);
+       *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
+       if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
        return (uint64_t)ret_conv;
 }
 
@@ -23530,7 +25249,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNI
                chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
                if (chain_access_conv.free == LDKAccess_JCalls_free) {
                        // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-                       LDKAccess_JCalls_clone(chain_access_conv.this_arg);
+                       LDKAccess_JCalls_cloned(&chain_access_conv);
                }
                chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
                *chain_access_conv_ptr = chain_access_conv;
@@ -23538,7 +25257,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNI
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
@@ -23557,7 +25276,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1n
                chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
                if (chain_access_conv.free == LDKAccess_JCalls_free) {
                        // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-                       LDKAccess_JCalls_clone(chain_access_conv.this_arg);
+                       LDKAccess_JCalls_cloned(&chain_access_conv);
                }
                chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
                *chain_access_conv_ptr = chain_access_conv;
@@ -23565,7 +25284,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1n
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        LDKNetworkGraph network_graph_conv;
        network_graph_conv.inner = (void*)(network_graph & (~1));
@@ -23591,7 +25310,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain
                chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
                if (chain_access_conv.free == LDKAccess_JCalls_free) {
                        // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-                       LDKAccess_JCalls_clone(chain_access_conv.this_arg);
+                       LDKAccess_JCalls_cloned(&chain_access_conv);
                }
                chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
                *chain_access_conv_ptr = chain_access_conv;
@@ -24579,7 +26298,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann
                chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
                if (chain_access_conv.free == LDKAccess_JCalls_free) {
                        // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-                       LDKAccess_JCalls_clone(chain_access_conv.this_arg);
+                       LDKAccess_JCalls_cloned(&chain_access_conv);
                }
                chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
                *chain_access_conv_ptr = chain_access_conv;
@@ -24602,7 +26321,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann
                chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
                if (chain_access_conv.free == LDKAccess_JCalls_free) {
                        // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-                       LDKAccess_JCalls_clone(chain_access_conv.this_arg);
+                       LDKAccess_JCalls_cloned(&chain_access_conv);
                }
                chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
                *chain_access_conv_ptr = chain_access_conv;
@@ -24668,6 +26387,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1d
        this_arg_conv.is_owned = false;
        LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -24688,7 +26408,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1
        LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
        if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
+               LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
        }
        LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
        *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
@@ -24722,12 +26442,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(
        LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
        if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKChannelManagerPersister_JCalls_clone(persister_conv.this_arg);
+               LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
        }
        LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
        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_clone(event_handler_conv.this_arg);
+               LDKEventHandler_JCalls_cloned(&event_handler_conv);
        }
        LDKChainMonitor chain_monitor_conv;
        chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
@@ -24741,7 +26461,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(
        LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
        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_clone(logger_conv.this_arg);
+               LDKLogger_JCalls_cloned(&logger_conv);
        }
        LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
@@ -24753,6 +26473,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKBackgroundProcessor this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
+       LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
+       *ret_conv = BackgroundProcessor_join(this_arg_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
        LDKBackgroundProcessor this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -24983,6 +26713,26 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env,
        return ret_conv;
 }
 
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
+       return ret_conv;
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
        LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
        LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
@@ -25002,6 +26752,31 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env,
        return ret_conv;
 }
 
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
+       return ret_conv;
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
        LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
        LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
@@ -25184,6 +26959,38 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
+       
+       LDKCVec_u8Z program_ref;
+       program_ref.datalen = (*env)->GetArrayLength(env, program);
+       program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
+       (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
+       LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
+       *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
+       LDKTwentyBytes a_ref;
+       CHECK((*env)->GetArrayLength(env, a) == 20);
+       (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
+       LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
+       *ret_copy = Fallback_pub_key_hash(a_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
+       LDKTwentyBytes a_ref;
+       CHECK((*env)->GetArrayLength(env, a) == 20);
+       (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
+       LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
+       *ret_copy = Fallback_script_hash(a_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
        LDKFallback* a_conv = (LDKFallback*)a;
        LDKFallback* b_conv = (LDKFallback*)b;
@@ -25687,6 +27494,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JN
        this_arg_conv = Description_clone(&this_arg_conv);
        LDKStr ret_str = Description_into_inner(this_arg_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -25749,6 +27557,26 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv
        return ret_conv;
 }
 
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
+       return ret_conv;
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
        LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
        LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
@@ -25760,6 +27588,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIE
        LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
        LDKStr ret_str = CreationError_to_str(o_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -25769,6 +27598,46 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv
        return ret_conv;
 }
 
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
+       return ret_conv;
+}
+
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
+       jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
+       return ret_conv;
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
        LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
        LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
@@ -25780,6 +27649,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIE
        LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
        LDKStr ret_str = SemanticError_to_str(o_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -25798,6 +27668,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
+       LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
+       *ret_copy = SignOrCreationError_sign_error();
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
+       LDKCreationError a_conv = LDKCreationError_from_java(env, a);
+       LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
+       *ret_copy = SignOrCreationError_creation_error(a_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
        LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
        LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
@@ -25809,6 +27694,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1st
        LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
        LDKStr ret_str = SignOrCreationError_to_str(o_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -25819,7 +27705,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan
        LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
        if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
                // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
-               LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
+               LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
        }
        LDKCurrency network_conv = LDKCurrency_from_java(env, network);
        LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
@@ -25856,6 +27742,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *en
        o_conv.is_owned = false;
        LDKStr ret_str = Invoice_to_str(&o_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -25865,6 +27752,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(J
        o_conv.is_owned = false;
        LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -25872,6 +27760,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *e
        LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
        LDKStr ret_str = Currency_to_str(o_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
@@ -25879,10 +27768,7 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *e
        LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
        LDKStr ret_str = SiPrefix_to_str(o_conv);
        jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+       Str_free(ret_str);
        return ret_conv;
 }
 
-// __cxa_thread_atexit_impl is used to more effeciently cleanup per-thread local storage by rust libstd.
-// However, it is not available on glibc versions 2.17 or earlier, and rust libstd has a null-check and fallback in case it is missing.
-// Because it is weak-linked on the rust side, we should be able to simply define it explicitly here, forcing rust to use the fallback.
-void *__cxa_thread_atexit_impl = NULL;