From 592c4f92dd3011a2f2a7988ce66ed166c3a8f58c Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 15 Oct 2020 17:57:49 -0400 Subject: [PATCH] Properly set CVec_u8Z to a byte[] which adds a ton more fn's --- genbindings.py | 51 +- src/main/java/org/ldk/impl/bindings.java | 140 +- .../java/org/ldk/structs/AcceptChannel.java | 7 +- .../ldk/structs/AnnouncementSignatures.java | 7 +- .../org/ldk/structs/ChannelAnnouncement.java | 7 +- .../java/org/ldk/structs/ChannelConfig.java | 7 +- .../java/org/ldk/structs/ChannelInfo.java | 7 +- .../org/ldk/structs/ChannelMonitorUpdate.java | 7 +- .../org/ldk/structs/ChannelPublicKeys.java | 7 +- .../org/ldk/structs/ChannelReestablish.java | 7 +- .../java/org/ldk/structs/ChannelUpdate.java | 7 +- .../java/org/ldk/structs/ClosingSigned.java | 7 +- .../org/ldk/structs/CommitmentSigned.java | 7 +- .../ldk/structs/DirectionalChannelInfo.java | 7 +- .../java/org/ldk/structs/ErrorMessage.java | 18 +- .../java/org/ldk/structs/FundingCreated.java | 7 +- .../java/org/ldk/structs/FundingLocked.java | 7 +- .../java/org/ldk/structs/FundingSigned.java | 7 +- .../ldk/structs/GossipTimestampFilter.java | 7 +- .../ldk/structs/HTLCOutputInCommitment.java | 7 +- src/main/java/org/ldk/structs/HTLCUpdate.java | 7 +- .../structs/HolderCommitmentTransaction.java | 7 +- .../org/ldk/structs/InMemoryChannelKeys.java | 7 +- src/main/java/org/ldk/structs/Init.java | 7 +- .../java/org/ldk/structs/KeysInterface.java | 6 +- .../java/org/ldk/structs/LightningError.java | 6 +- .../java/org/ldk/structs/NetworkGraph.java | 7 +- .../org/ldk/structs/NodeAnnouncement.java | 7 +- .../org/ldk/structs/NodeAnnouncementInfo.java | 7 +- src/main/java/org/ldk/structs/NodeInfo.java | 7 +- .../java/org/ldk/structs/OpenChannel.java | 7 +- src/main/java/org/ldk/structs/OutPoint.java | 7 +- src/main/java/org/ldk/structs/Ping.java | 7 +- src/main/java/org/ldk/structs/Pong.java | 7 +- .../org/ldk/structs/QueryChannelRange.java | 7 +- .../org/ldk/structs/QueryShortChannelIds.java | 7 +- .../org/ldk/structs/ReplyChannelRange.java | 7 +- .../ldk/structs/ReplyShortChannelIdsEnd.java | 7 +- .../java/org/ldk/structs/RevokeAndACK.java | 7 +- src/main/java/org/ldk/structs/Route.java | 7 +- .../java/org/ldk/structs/RoutingFees.java | 7 +- src/main/java/org/ldk/structs/Shutdown.java | 18 +- .../java/org/ldk/structs/TxCreationKeys.java | 7 +- .../structs/UnsignedChannelAnnouncement.java | 7 +- .../ldk/structs/UnsignedChannelUpdate.java | 7 +- .../ldk/structs/UnsignedNodeAnnouncement.java | 7 +- .../java/org/ldk/structs/UpdateAddHTLC.java | 7 +- .../java/org/ldk/structs/UpdateFailHTLC.java | 7 +- .../ldk/structs/UpdateFailMalformedHTLC.java | 7 +- src/main/java/org/ldk/structs/UpdateFee.java | 7 +- .../org/ldk/structs/UpdateFulfillHTLC.java | 7 +- src/main/jni/bindings.c | 1392 +++++++++-------- src/main/jni/org_ldk_impl_bindings.h | 244 +-- .../java/org/ldk/HumanObjectPeerTest.java | 2 +- src/test/java/org/ldk/PeerTest.java | 2 +- 55 files changed, 1267 insertions(+), 927 deletions(-) diff --git a/genbindings.py b/genbindings.py index b1965938..cc03661a 100755 --- a/genbindings.py +++ b/genbindings.py @@ -127,10 +127,15 @@ def java_c_types(fn_arg, ret_arr_len): assert var_is_arr_regex.match(fn_arg[8:]) rust_obj = "LDKu8slice" arr_access = "data" - if fn_arg.startswith("LDKCVecTempl_u8"): - fn_arg = "uint8_t (*" + fn_arg[11:] + ")[datalen]" - assert var_is_arr_regex.match(fn_arg[8:]) - rust_obj = "LDKCVecTempl_u8" + if fn_arg.startswith("LDKCVecTempl_u8") or fn_arg.startswith("LDKCVec_u8Z"): + if fn_arg.startswith("LDKCVecTempl_u8"): + fn_arg = "uint8_t (*" + fn_arg[16:] + ")[datalen]" + rust_obj = "LDKCVecTempl_u8" + assert var_is_arr_regex.match(fn_arg[8:]) + else: + fn_arg = "uint8_t (*" + fn_arg[12:] + ")[datalen]" + rust_obj = "LDKCVec_u8Z" + assert var_is_arr_regex.match(fn_arg[8:]) arr_access = "data" if fn_arg.startswith("void"): @@ -423,7 +428,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name, arg_conv = None, arg_conv_name = None, arg_conv_cleanup = None, ret_conv = None, ret_conv_name = None, - to_hu_conv = ("TODO d", ""), from_hu_conv = None) + to_hu_conv = None, from_hu_conv = None) def map_fn(line, re_match, ret_arr_len, c_call_string): out_java.write("\t// " + line) @@ -702,7 +707,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_c.write("\t" + struct_name + "_" + var_name + "_meth = (*env)->GetMethodID(env, " + struct_name + "_" + var_name + "_class, \"\", \"(" + init_meth_jty_strs[var_name] + ")V\");\n") out_c.write("\tCHECK(" + struct_name + "_" + var_name + "_meth != NULL);\n") out_c.write("}\n") - out_c.write("JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_" + struct_name.replace("_", "_1") + "_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {\n") + out_c.write("JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_" + struct_name.replace("_", "_1") + "_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {\n") out_c.write("\t" + struct_name + " *obj = (" + struct_name + "*)ptr;\n") out_c.write("\tswitch(obj->tag) {\n") for idx, struct_line in enumerate(tag_field_lines): @@ -716,13 +721,13 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg if idx != 0 and idx < len(enum_var_lines) - 2: field_map = map_type(field.strip(' ;'), False, None, False) if field_map.ret_conv is not None: - out_c.write("\t\t\t" + field_map.ret_conv[0].replace("\n", "\n\t\t\t").replace("_env", "env")) + out_c.write("\t\t\t" + field_map.ret_conv[0].replace("\n", "\n\t\t\t")) out_c.write("obj->" + camel_to_snake(var_name) + "." + field_map.arg_name) out_c.write(field_map.ret_conv[1].replace("\n", "\n\t\t\t") + "\n") c_params_text = c_params_text + ", " + field_map.ret_conv_name else: c_params_text = c_params_text + ", obj->" + camel_to_snake(var_name) + "." + field_map.arg_name - out_c.write("\t\t\treturn (*env)->NewObject(env, " + struct_name + "_" + var_name + "_class, " + struct_name + "_" + var_name + "_meth" + c_params_text + ");\n") + out_c.write("\t\t\treturn (*_env)->NewObject(_env, " + struct_name + "_" + var_name + "_class, " + struct_name + "_" + var_name + "_meth" + c_params_text + ");\n") out_c.write("\t\t}\n") out_c.write("\t\tdefault: abort();\n") out_c.write("\t}\n}\n") @@ -746,7 +751,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_java_trait.write("import org.ldk.enums.*;\n\n") out_java_trait.write("public class " + struct_name.replace("LDK","") + " extends CommonBase {\n") out_java_trait.write("\t" + struct_name.replace("LDK", "") + "(Object _dummy, long ptr) { super(ptr); }\n") - out_java_trait.write("\tpublic " + struct_name.replace("LDK", "") + "(bindings." + struct_name + " arg") + out_java_trait.write("\tpublic " + struct_name.replace("LDK", "") + "(bindings." + struct_name + " arg") # XXX: Should be priv for var_line in field_var_lines: if var_line.group(1) in trait_structs: out_java_trait.write(", bindings." + var_line.group(1) + " " + var_line.group(2)) @@ -768,7 +773,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg for fn_line in trait_fn_lines: java_meth_descr = "(" if fn_line.group(2) != "free" and fn_line.group(2) != "clone": - ret_ty_info = java_c_types(fn_line.group(1), None) + ret_ty_info = map_type(fn_line.group(1), True, None, False) out_java.write("\t\t " + ret_ty_info.java_ty + " " + fn_line.group(2) + "(") is_const = fn_line.group(3) is not None @@ -796,23 +801,23 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_java.write(");\n") out_c.write(") {\n") out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") - out_c.write("\tJNIEnv *env;\n") - out_c.write("\tDO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);\n") + out_c.write("\tJNIEnv *_env;\n") + out_c.write("\tDO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);\n") for arg_info in arg_names: if arg_info.ret_conv is not None: - out_c.write("\t" + arg_info.ret_conv[0].replace('\n', '\n\t').replace("_env", "env")); + out_c.write("\t" + arg_info.ret_conv[0].replace('\n', '\n\t')); out_c.write(arg_info.arg_name) - out_c.write(arg_info.ret_conv[1].replace('\n', '\n\t').replace("_env", "env") + "\n") + out_c.write(arg_info.ret_conv[1].replace('\n', '\n\t') + "\n") - out_c.write("\tjobject obj = (*env)->NewLocalRef(env, j_calls->o);\n\tCHECK(obj != NULL);\n") + out_c.write("\tjobject obj = (*_env)->NewLocalRef(_env, j_calls->o);\n\tCHECK(obj != NULL);\n") if ret_ty_info.c_ty.endswith("Array"): assert(ret_ty_info.c_ty == "jbyteArray") - out_c.write("\tjbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->" + fn_line.group(2) + "_meth") + out_c.write("\tjbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->" + fn_line.group(2) + "_meth") elif not ret_ty_info.passed_as_ptr: - out_c.write("\treturn (*env)->Call" + ret_ty_info.java_ty.title() + "Method(env, obj, j_calls->" + fn_line.group(2) + "_meth") + out_c.write("\treturn (*_env)->Call" + ret_ty_info.java_ty.title() + "Method(_env, obj, j_calls->" + fn_line.group(2) + "_meth") else: - out_c.write("\t" + fn_line.group(1).strip() + "* ret = (" + fn_line.group(1).strip() + "*)(*env)->CallLongMethod(env, obj, j_calls->" + fn_line.group(2) + "_meth"); + out_c.write("\t" + fn_line.group(1).strip() + "* ret = (" + fn_line.group(1).strip() + "*)(*_env)->CallLongMethod(_env, obj, j_calls->" + fn_line.group(2) + "_meth"); for arg_info in arg_names: if arg_info.ret_conv is not None: @@ -820,11 +825,8 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg else: out_c.write(", " + arg_info.arg_name) out_c.write(");\n"); - if ret_ty_info.c_ty.endswith("Array"): - out_c.write("\t" + ret_ty_info.rust_obj + " ret;\n") - out_c.write("\tCHECK((*env)->GetArrayLength(env, jret) == " + ret_ty_info.arr_len + ");\n") - out_c.write("\t(*env)->GetByteArrayRegion(env, jret, 0, " + ret_ty_info.arr_len + ", ret." + ret_ty_info.arr_access + ");\n") - out_c.write("\treturn ret;\n") + if ret_ty_info.arg_conv is not None: + out_c.write("\t" + ret_ty_info.arg_conv.replace("\n", "\n\t").replace("arg", "ret") + "\n\treturn " + ret_ty_info.arg_conv_name.replace("arg", "ret") + ";\n") if ret_ty_info.passed_as_ptr: out_c.write("\t" + fn_line.group(1).strip() + " res = *ret;\n") @@ -1286,7 +1288,8 @@ class CommonBase { out_c.write("\n\tret->" + e + " = " + ty_info.arg_conv_name + ";\n") else: out_c.write("\tret->" + e + " = " + e + ";\n") - assert ty_info.arg_conv_cleanup is None + if ty_info.arg_conv_cleanup is not None: + out_c.write("\t//TODO: Really need to call " + ty_info.arg_conv_cleanup + " here\n") out_c.write("\treturn (long)ret;\n") out_c.write("}\n") elif vec_ty is not None: diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index a6d965bb..8309b71c 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -41,7 +41,7 @@ public class bindings { public static native boolean LDKCResult_NoneMonitorUpdateErrorZ_result_ok(long arg); public static native byte LDKCResult_NoneMonitorUpdateErrorZ_get_ok(long arg); public static native long LDKCResult_NoneMonitorUpdateErrorZ_get_err(long arg); - public static native long LDKC2TupleTempl_OutPoint__CVec_u8Z_new(long a, long b); + public static native long LDKC2TupleTempl_OutPoint__CVec_u8Z_new(long a, byte[] b); public static native VecOrSliceDef LDKCVecTempl_TxOut_arr_info(long vec_ptr); public static native long LDKCVecTempl_TxOut_new(long[] elems); public static native long LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut_new(byte[] a, long b); @@ -60,21 +60,21 @@ public class bindings { public static class LDKAPIError { private LDKAPIError() {} public final static class APIMisuseError extends LDKAPIError { - public long err; - APIMisuseError(long err) { this.err = err; } + public byte[] err; + APIMisuseError(byte[] err) { this.err = err; } } public final static class FeeRateTooHigh extends LDKAPIError { - public long err; + public byte[] err; public int feerate; - FeeRateTooHigh(long err, int feerate) { this.err = err; this.feerate = feerate; } + FeeRateTooHigh(byte[] err, int feerate) { this.err = err; this.feerate = feerate; } } public final static class RouteError extends LDKAPIError { public long err; RouteError(long err) { this.err = err; } } public final static class ChannelUnavailable extends LDKAPIError { - public long err; - ChannelUnavailable(long err) { this.err = err; } + public byte[] err; + ChannelUnavailable(byte[] err) { this.err = err; } } public final static class MonitorUpdateFailed extends LDKAPIError { } @@ -126,9 +126,9 @@ public class bindings { public final static class FundingGenerationReady extends LDKEvent { public byte[] temporary_channel_id; public long channel_value_satoshis; - public long output_script; + public byte[] output_script; public long user_channel_id; - FundingGenerationReady(byte[] temporary_channel_id, long channel_value_satoshis, long output_script, long user_channel_id) { this.temporary_channel_id = temporary_channel_id; this.channel_value_satoshis = channel_value_satoshis; this.output_script = output_script; this.user_channel_id = user_channel_id; } + FundingGenerationReady(byte[] temporary_channel_id, long channel_value_satoshis, byte[] output_script, long user_channel_id) { this.temporary_channel_id = temporary_channel_id; this.channel_value_satoshis = channel_value_satoshis; this.output_script = output_script; this.user_channel_id = user_channel_id; } } public final static class FundingBroadcastSafe extends LDKEvent { public long funding_txo; @@ -400,7 +400,7 @@ public class bindings { public static native long LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut_new(long[] elems); public interface LDKKeysInterface { byte[] get_node_secret(); - long get_destination_script(); + byte[] get_destination_script(); byte[] get_shutdown_pubkey(); long get_channel_keys(boolean inbound, long channel_value_satoshis); byte[] get_secure_random_bytes(); @@ -410,7 +410,7 @@ public class bindings { // LDKSecretKey KeysInterface_get_node_secret LDKKeysInterface* this_arg public static native byte[] KeysInterface_get_node_secret(long this_arg); // LDKCVec_u8Z KeysInterface_get_destination_script LDKKeysInterface* this_arg - public static native long KeysInterface_get_destination_script(long this_arg); + public static native byte[] KeysInterface_get_destination_script(long this_arg); // LDKPublicKey KeysInterface_get_shutdown_pubkey LDKKeysInterface* this_arg public static native byte[] KeysInterface_get_shutdown_pubkey(long this_arg); // LDKChannelKeys KeysInterface_get_channel_keys LDKKeysInterface* this_arg, bool inbound, uint64_t channel_value_satoshis @@ -622,7 +622,7 @@ public class bindings { // extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ); public static native void CResult_CVec_u8ZPeerHandleErrorZ_free(long arg); // extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z); - public static native long CResult_CVec_u8ZPeerHandleErrorZ_ok(long arg); + public static native long CResult_CVec_u8ZPeerHandleErrorZ_ok(byte[] arg); // extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(LDKAPIError); public static native long CResult_NoneAPIErrorZ_err(long arg); // extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ); @@ -740,7 +740,7 @@ public class bindings { // extern const void (*CVec_u64Z_free)(LDKCVec_u64Z); public static native void CVec_u64Z_free(long arg); // extern const void (*CVec_u8Z_free)(LDKCVec_u8Z); - public static native void CVec_u8Z_free(long arg); + public static native void CVec_u8Z_free(byte[] arg); // void Transaction_free(LDKTransaction _res); public static native void Transaction_free(long _res); // void TxOut_free(LDKTxOut _res); @@ -752,7 +752,7 @@ public class bindings { // LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void); public static native long CResult_NoneMonitorUpdateErrorZ_ok(); // LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b); - public static native long C2Tuple_OutPointScriptZ_new(long a, long b); + public static native long C2Tuple_OutPointScriptZ_new(long a, byte[] b); // LDKC2Tuple_TxidCVec_TxOutZZ C2Tuple_TxidCVec_TxOutZZ_new(LDKThirtyTwoBytes a, LDKCVec_TxOutZ b); public static native long C2Tuple_TxidCVec_TxOutZZ_new(byte[] a, long b); // LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); @@ -878,7 +878,7 @@ public class bindings { // MUST_USE_RES LDKChannelConfig ChannelConfig_default(void); public static native long ChannelConfig_default(); // LDKCVec_u8Z ChannelConfig_write(const LDKChannelConfig *obj); - public static native long ChannelConfig_write(long obj); + public static native byte[] ChannelConfig_write(long obj); // LDKChannelConfig ChannelConfig_read(LDKu8slice ser); public static native long ChannelConfig_read(byte[] ser); // void UserConfig_free(LDKUserConfig this_ptr); @@ -932,7 +932,7 @@ public class bindings { // void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val); public static native void ChannelMonitorUpdate_set_update_id(long this_ptr, long val); // LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj); - public static native long ChannelMonitorUpdate_write(long obj); + public static native byte[] ChannelMonitorUpdate_write(long obj); // LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser); public static native long ChannelMonitorUpdate_read(byte[] ser); // void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr); @@ -944,7 +944,7 @@ public class bindings { // LDKHTLCUpdate HTLCUpdate_clone(const LDKHTLCUpdate *orig); public static native long HTLCUpdate_clone(long orig); // LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj); - public static native long HTLCUpdate_write(long obj); + public static native byte[] HTLCUpdate_write(long obj); // LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser); public static native long HTLCUpdate_read(byte[] ser); // void ChannelMonitor_free(LDKChannelMonitor this_ptr); @@ -982,7 +982,7 @@ public class bindings { // MUST_USE_RES LDKThirtyTwoBytes OutPoint_to_channel_id(const LDKOutPoint *this_arg); public static native byte[] OutPoint_to_channel_id(long this_arg); // LDKCVec_u8Z OutPoint_write(const LDKOutPoint *obj); - public static native long OutPoint_write(long obj); + public static native byte[] OutPoint_write(long obj); // LDKOutPoint OutPoint_read(LDKu8slice ser); public static native long OutPoint_read(byte[] ser); // void SpendableOutputDescriptor_free(LDKSpendableOutputDescriptor this_ptr); @@ -1030,7 +1030,7 @@ public class bindings { // LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const LDKInMemoryChannelKeys *this_arg); public static native long InMemoryChannelKeys_as_ChannelKeys(long this_arg); // LDKCVec_u8Z InMemoryChannelKeys_write(const LDKInMemoryChannelKeys *obj); - public static native long InMemoryChannelKeys_write(long obj); + public static native byte[] InMemoryChannelKeys_write(long obj); // LDKInMemoryChannelKeys InMemoryChannelKeys_read(LDKu8slice ser); public static native long InMemoryChannelKeys_read(byte[] ser); // void KeysManager_free(LDKKeysManager this_ptr); @@ -1168,9 +1168,9 @@ public class bindings { // LDKStr ErrorMessage_get_data(const LDKErrorMessage *this_ptr); public static native long ErrorMessage_get_data(long this_ptr); // void ErrorMessage_set_data(LDKErrorMessage *this_ptr, LDKCVec_u8Z val); - public static native void ErrorMessage_set_data(long this_ptr, long val); + public static native void ErrorMessage_set_data(long this_ptr, byte[] val); // MUST_USE_RES LDKErrorMessage ErrorMessage_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg); - public static native long ErrorMessage_new(byte[] channel_id_arg, long data_arg); + public static native long ErrorMessage_new(byte[] channel_id_arg, byte[] data_arg); // void Ping_free(LDKPing this_ptr); public static native void Ping_free(long this_ptr); // LDKPing Ping_clone(const LDKPing *orig); @@ -1392,9 +1392,9 @@ public class bindings { // LDKu8slice Shutdown_get_scriptpubkey(const LDKShutdown *this_ptr); public static native byte[] Shutdown_get_scriptpubkey(long this_ptr); // void Shutdown_set_scriptpubkey(LDKShutdown *this_ptr, LDKCVec_u8Z val); - public static native void Shutdown_set_scriptpubkey(long this_ptr, long val); + public static native void Shutdown_set_scriptpubkey(long this_ptr, byte[] val); // MUST_USE_RES LDKShutdown Shutdown_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg); - public static native long Shutdown_new(byte[] channel_id_arg, long scriptpubkey_arg); + public static native long Shutdown_new(byte[] channel_id_arg, byte[] scriptpubkey_arg); // void ClosingSigned_free(LDKClosingSigned this_ptr); public static native void ClosingSigned_free(long this_ptr); // LDKClosingSigned ClosingSigned_clone(const LDKClosingSigned *orig); @@ -1826,13 +1826,13 @@ public class bindings { // LDKStr LightningError_get_err(const LDKLightningError *this_ptr); public static native long LightningError_get_err(long this_ptr); // void LightningError_set_err(LDKLightningError *this_ptr, LDKCVec_u8Z val); - public static native void LightningError_set_err(long this_ptr, long val); + public static native void LightningError_set_err(long this_ptr, byte[] val); // LDKErrorAction LightningError_get_action(const LDKLightningError *this_ptr); public static native long LightningError_get_action(long this_ptr); // void LightningError_set_action(LDKLightningError *this_ptr, LDKErrorAction val); public static native void LightningError_set_action(long this_ptr, long val); // MUST_USE_RES LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, LDKErrorAction action_arg); - public static native long LightningError_new(long err_arg, long action_arg); + public static native long LightningError_new(byte[] err_arg, long action_arg); // void CommitmentUpdate_free(LDKCommitmentUpdate this_ptr); public static native void CommitmentUpdate_free(long this_ptr); // LDKCommitmentUpdate CommitmentUpdate_clone(const LDKCommitmentUpdate *orig); @@ -1862,129 +1862,129 @@ public class bindings { // void RoutingMessageHandler_free(LDKRoutingMessageHandler this_ptr); public static native void RoutingMessageHandler_free(long this_ptr); // LDKCVec_u8Z AcceptChannel_write(const LDKAcceptChannel *obj); - public static native long AcceptChannel_write(long obj); + public static native byte[] AcceptChannel_write(long obj); // LDKAcceptChannel AcceptChannel_read(LDKu8slice ser); public static native long AcceptChannel_read(byte[] ser); // LDKCVec_u8Z AnnouncementSignatures_write(const LDKAnnouncementSignatures *obj); - public static native long AnnouncementSignatures_write(long obj); + public static native byte[] AnnouncementSignatures_write(long obj); // LDKAnnouncementSignatures AnnouncementSignatures_read(LDKu8slice ser); public static native long AnnouncementSignatures_read(byte[] ser); // LDKCVec_u8Z ChannelReestablish_write(const LDKChannelReestablish *obj); - public static native long ChannelReestablish_write(long obj); + public static native byte[] ChannelReestablish_write(long obj); // LDKChannelReestablish ChannelReestablish_read(LDKu8slice ser); public static native long ChannelReestablish_read(byte[] ser); // LDKCVec_u8Z ClosingSigned_write(const LDKClosingSigned *obj); - public static native long ClosingSigned_write(long obj); + public static native byte[] ClosingSigned_write(long obj); // LDKClosingSigned ClosingSigned_read(LDKu8slice ser); public static native long ClosingSigned_read(byte[] ser); // LDKCVec_u8Z CommitmentSigned_write(const LDKCommitmentSigned *obj); - public static native long CommitmentSigned_write(long obj); + public static native byte[] CommitmentSigned_write(long obj); // LDKCommitmentSigned CommitmentSigned_read(LDKu8slice ser); public static native long CommitmentSigned_read(byte[] ser); // LDKCVec_u8Z FundingCreated_write(const LDKFundingCreated *obj); - public static native long FundingCreated_write(long obj); + public static native byte[] FundingCreated_write(long obj); // LDKFundingCreated FundingCreated_read(LDKu8slice ser); public static native long FundingCreated_read(byte[] ser); // LDKCVec_u8Z FundingSigned_write(const LDKFundingSigned *obj); - public static native long FundingSigned_write(long obj); + public static native byte[] FundingSigned_write(long obj); // LDKFundingSigned FundingSigned_read(LDKu8slice ser); public static native long FundingSigned_read(byte[] ser); // LDKCVec_u8Z FundingLocked_write(const LDKFundingLocked *obj); - public static native long FundingLocked_write(long obj); + public static native byte[] FundingLocked_write(long obj); // LDKFundingLocked FundingLocked_read(LDKu8slice ser); public static native long FundingLocked_read(byte[] ser); // LDKCVec_u8Z Init_write(const LDKInit *obj); - public static native long Init_write(long obj); + public static native byte[] Init_write(long obj); // LDKInit Init_read(LDKu8slice ser); public static native long Init_read(byte[] ser); // LDKCVec_u8Z OpenChannel_write(const LDKOpenChannel *obj); - public static native long OpenChannel_write(long obj); + public static native byte[] OpenChannel_write(long obj); // LDKOpenChannel OpenChannel_read(LDKu8slice ser); public static native long OpenChannel_read(byte[] ser); // LDKCVec_u8Z RevokeAndACK_write(const LDKRevokeAndACK *obj); - public static native long RevokeAndACK_write(long obj); + public static native byte[] RevokeAndACK_write(long obj); // LDKRevokeAndACK RevokeAndACK_read(LDKu8slice ser); public static native long RevokeAndACK_read(byte[] ser); // LDKCVec_u8Z Shutdown_write(const LDKShutdown *obj); - public static native long Shutdown_write(long obj); + public static native byte[] Shutdown_write(long obj); // LDKShutdown Shutdown_read(LDKu8slice ser); public static native long Shutdown_read(byte[] ser); // LDKCVec_u8Z UpdateFailHTLC_write(const LDKUpdateFailHTLC *obj); - public static native long UpdateFailHTLC_write(long obj); + public static native byte[] UpdateFailHTLC_write(long obj); // LDKUpdateFailHTLC UpdateFailHTLC_read(LDKu8slice ser); public static native long UpdateFailHTLC_read(byte[] ser); // LDKCVec_u8Z UpdateFailMalformedHTLC_write(const LDKUpdateFailMalformedHTLC *obj); - public static native long UpdateFailMalformedHTLC_write(long obj); + public static native byte[] UpdateFailMalformedHTLC_write(long obj); // LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(LDKu8slice ser); public static native long UpdateFailMalformedHTLC_read(byte[] ser); // LDKCVec_u8Z UpdateFee_write(const LDKUpdateFee *obj); - public static native long UpdateFee_write(long obj); + public static native byte[] UpdateFee_write(long obj); // LDKUpdateFee UpdateFee_read(LDKu8slice ser); public static native long UpdateFee_read(byte[] ser); // LDKCVec_u8Z UpdateFulfillHTLC_write(const LDKUpdateFulfillHTLC *obj); - public static native long UpdateFulfillHTLC_write(long obj); + public static native byte[] UpdateFulfillHTLC_write(long obj); // LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(LDKu8slice ser); public static native long UpdateFulfillHTLC_read(byte[] ser); // LDKCVec_u8Z UpdateAddHTLC_write(const LDKUpdateAddHTLC *obj); - public static native long UpdateAddHTLC_write(long obj); + public static native byte[] UpdateAddHTLC_write(long obj); // LDKUpdateAddHTLC UpdateAddHTLC_read(LDKu8slice ser); public static native long UpdateAddHTLC_read(byte[] ser); // LDKCVec_u8Z Ping_write(const LDKPing *obj); - public static native long Ping_write(long obj); + public static native byte[] Ping_write(long obj); // LDKPing Ping_read(LDKu8slice ser); public static native long Ping_read(byte[] ser); // LDKCVec_u8Z Pong_write(const LDKPong *obj); - public static native long Pong_write(long obj); + public static native byte[] Pong_write(long obj); // LDKPong Pong_read(LDKu8slice ser); public static native long Pong_read(byte[] ser); // LDKCVec_u8Z UnsignedChannelAnnouncement_write(const LDKUnsignedChannelAnnouncement *obj); - public static native long UnsignedChannelAnnouncement_write(long obj); + public static native byte[] UnsignedChannelAnnouncement_write(long obj); // LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_read(LDKu8slice ser); public static native long UnsignedChannelAnnouncement_read(byte[] ser); // LDKCVec_u8Z ChannelAnnouncement_write(const LDKChannelAnnouncement *obj); - public static native long ChannelAnnouncement_write(long obj); + public static native byte[] ChannelAnnouncement_write(long obj); // LDKChannelAnnouncement ChannelAnnouncement_read(LDKu8slice ser); public static native long ChannelAnnouncement_read(byte[] ser); // LDKCVec_u8Z UnsignedChannelUpdate_write(const LDKUnsignedChannelUpdate *obj); - public static native long UnsignedChannelUpdate_write(long obj); + public static native byte[] UnsignedChannelUpdate_write(long obj); // LDKUnsignedChannelUpdate UnsignedChannelUpdate_read(LDKu8slice ser); public static native long UnsignedChannelUpdate_read(byte[] ser); // LDKCVec_u8Z ChannelUpdate_write(const LDKChannelUpdate *obj); - public static native long ChannelUpdate_write(long obj); + public static native byte[] ChannelUpdate_write(long obj); // LDKChannelUpdate ChannelUpdate_read(LDKu8slice ser); public static native long ChannelUpdate_read(byte[] ser); // LDKCVec_u8Z ErrorMessage_write(const LDKErrorMessage *obj); - public static native long ErrorMessage_write(long obj); + public static native byte[] ErrorMessage_write(long obj); // LDKErrorMessage ErrorMessage_read(LDKu8slice ser); public static native long ErrorMessage_read(byte[] ser); // LDKCVec_u8Z UnsignedNodeAnnouncement_write(const LDKUnsignedNodeAnnouncement *obj); - public static native long UnsignedNodeAnnouncement_write(long obj); + public static native byte[] UnsignedNodeAnnouncement_write(long obj); // LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_read(LDKu8slice ser); public static native long UnsignedNodeAnnouncement_read(byte[] ser); // LDKCVec_u8Z NodeAnnouncement_write(const LDKNodeAnnouncement *obj); - public static native long NodeAnnouncement_write(long obj); + public static native byte[] NodeAnnouncement_write(long obj); // LDKNodeAnnouncement NodeAnnouncement_read(LDKu8slice ser); public static native long NodeAnnouncement_read(byte[] ser); // LDKQueryShortChannelIds QueryShortChannelIds_read(LDKu8slice ser); public static native long QueryShortChannelIds_read(byte[] ser); // LDKCVec_u8Z QueryShortChannelIds_write(const LDKQueryShortChannelIds *obj); - public static native long QueryShortChannelIds_write(long obj); + public static native byte[] QueryShortChannelIds_write(long obj); // LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_read(LDKu8slice ser); public static native long ReplyShortChannelIdsEnd_read(byte[] ser); // LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const LDKReplyShortChannelIdsEnd *obj); - public static native long ReplyShortChannelIdsEnd_write(long obj); + public static native byte[] ReplyShortChannelIdsEnd_write(long obj); // LDKQueryChannelRange QueryChannelRange_read(LDKu8slice ser); public static native long QueryChannelRange_read(byte[] ser); // LDKCVec_u8Z QueryChannelRange_write(const LDKQueryChannelRange *obj); - public static native long QueryChannelRange_write(long obj); + public static native byte[] QueryChannelRange_write(long obj); // LDKReplyChannelRange ReplyChannelRange_read(LDKu8slice ser); public static native long ReplyChannelRange_read(byte[] ser); // LDKCVec_u8Z ReplyChannelRange_write(const LDKReplyChannelRange *obj); - public static native long ReplyChannelRange_write(long obj); + public static native byte[] ReplyChannelRange_write(long obj); // LDKGossipTimestampFilter GossipTimestampFilter_read(LDKu8slice ser); public static native long GossipTimestampFilter_read(byte[] ser); // LDKCVec_u8Z GossipTimestampFilter_write(const LDKGossipTimestampFilter *obj); - public static native long GossipTimestampFilter_write(long obj); + public static native byte[] GossipTimestampFilter_write(long obj); // void MessageHandler_free(LDKMessageHandler this_ptr); public static native void MessageHandler_free(long this_ptr); // const LDKChannelMessageHandler *MessageHandler_get_chan_handler(const LDKMessageHandler *this_ptr); @@ -2064,7 +2064,7 @@ public class bindings { // MUST_USE_RES LDKTxCreationKeys TxCreationKeys_new(LDKPublicKey per_commitment_point_arg, LDKPublicKey revocation_key_arg, LDKPublicKey broadcaster_htlc_key_arg, LDKPublicKey countersignatory_htlc_key_arg, LDKPublicKey broadcaster_delayed_payment_key_arg); public static native long TxCreationKeys_new(byte[] per_commitment_point_arg, byte[] revocation_key_arg, byte[] broadcaster_htlc_key_arg, byte[] countersignatory_htlc_key_arg, byte[] broadcaster_delayed_payment_key_arg); // LDKCVec_u8Z TxCreationKeys_write(const LDKTxCreationKeys *obj); - public static native long TxCreationKeys_write(long obj); + public static native byte[] TxCreationKeys_write(long obj); // LDKTxCreationKeys TxCreationKeys_read(LDKu8slice ser); public static native long TxCreationKeys_read(byte[] ser); // void PreCalculatedTxCreationKeys_free(LDKPreCalculatedTxCreationKeys this_ptr); @@ -2102,13 +2102,13 @@ public class bindings { // MUST_USE_RES LDKChannelPublicKeys ChannelPublicKeys_new(LDKPublicKey funding_pubkey_arg, LDKPublicKey revocation_basepoint_arg, LDKPublicKey payment_point_arg, LDKPublicKey delayed_payment_basepoint_arg, LDKPublicKey htlc_basepoint_arg); public static native long ChannelPublicKeys_new(byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg); // LDKCVec_u8Z ChannelPublicKeys_write(const LDKChannelPublicKeys *obj); - public static native long ChannelPublicKeys_write(long obj); + public static native byte[] ChannelPublicKeys_write(long obj); // LDKChannelPublicKeys ChannelPublicKeys_read(LDKu8slice ser); public static native long ChannelPublicKeys_read(byte[] ser); // MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(LDKPublicKey per_commitment_point, LDKPublicKey broadcaster_delayed_payment_base, LDKPublicKey broadcaster_htlc_base, LDKPublicKey countersignatory_revocation_base, LDKPublicKey countersignatory_htlc_base); public static native long TxCreationKeys_derive_new(byte[] per_commitment_point, byte[] broadcaster_delayed_payment_base, byte[] broadcaster_htlc_base, byte[] countersignatory_revocation_base, byte[] countersignatory_htlc_base); // LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t contest_delay, LDKPublicKey broadcaster_delayed_payment_key); - public static native long get_revokeable_redeemscript(byte[] revocation_key, short contest_delay, byte[] broadcaster_delayed_payment_key); + public static native byte[] get_revokeable_redeemscript(byte[] revocation_key, short contest_delay, byte[] broadcaster_delayed_payment_key); // void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr); public static native void HTLCOutputInCommitment_free(long this_ptr); // LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const LDKHTLCOutputInCommitment *orig); @@ -2130,13 +2130,13 @@ public class bindings { // void HTLCOutputInCommitment_set_payment_hash(LDKHTLCOutputInCommitment *this_ptr, LDKThirtyTwoBytes val); public static native void HTLCOutputInCommitment_set_payment_hash(long this_ptr, byte[] val); // LDKCVec_u8Z HTLCOutputInCommitment_write(const LDKHTLCOutputInCommitment *obj); - public static native long HTLCOutputInCommitment_write(long obj); + public static native byte[] HTLCOutputInCommitment_write(long obj); // LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser); public static native long HTLCOutputInCommitment_read(byte[] ser); // LDKCVec_u8Z get_htlc_redeemscript(const LDKHTLCOutputInCommitment *htlc, const LDKTxCreationKeys *keys); - public static native long get_htlc_redeemscript(long htlc, long keys); + public static native byte[] get_htlc_redeemscript(long htlc, long keys); // LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey countersignatory); - public static native long make_funding_redeemscript(byte[] broadcaster, byte[] countersignatory); + public static native byte[] make_funding_redeemscript(byte[] broadcaster, byte[] countersignatory); // LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey broadcaster_delayed_payment_key, LDKPublicKey revocation_key); public static native long build_htlc_transaction(byte[] prev_hash, int feerate_per_kw, short contest_delay, long htlc, byte[] broadcaster_delayed_payment_key, byte[] revocation_key); // void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr); @@ -2168,7 +2168,7 @@ public class bindings { // MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ HolderCommitmentTransaction_get_htlc_sigs(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*htlc_base_key)[32], uint16_t counterparty_selected_contest_delay); public static native long HolderCommitmentTransaction_get_htlc_sigs(long this_arg, byte[] htlc_base_key, short counterparty_selected_contest_delay); // LDKCVec_u8Z HolderCommitmentTransaction_write(const LDKHolderCommitmentTransaction *obj); - public static native long HolderCommitmentTransaction_write(long obj); + public static native byte[] HolderCommitmentTransaction_write(long obj); // LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(LDKu8slice ser); public static native long HolderCommitmentTransaction_read(byte[] ser); // void InitFeatures_free(LDKInitFeatures this_ptr); @@ -2216,7 +2216,7 @@ public class bindings { // MUST_USE_RES LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg); public static native long Route_new(long paths_arg); // LDKCVec_u8Z Route_write(const LDKRoute *obj); - public static native long Route_write(long obj); + public static native byte[] Route_write(long obj); // LDKRoute Route_read(LDKu8slice ser); public static native long Route_read(byte[] ser); // void RouteHint_free(LDKRouteHint this_ptr); @@ -2286,7 +2286,7 @@ public class bindings { // void DirectionalChannelInfo_set_last_update_message(LDKDirectionalChannelInfo *this_ptr, LDKChannelUpdate val); public static native void DirectionalChannelInfo_set_last_update_message(long this_ptr, long val); // LDKCVec_u8Z DirectionalChannelInfo_write(const LDKDirectionalChannelInfo *obj); - public static native long DirectionalChannelInfo_write(long obj); + public static native byte[] DirectionalChannelInfo_write(long obj); // LDKDirectionalChannelInfo DirectionalChannelInfo_read(LDKu8slice ser); public static native long DirectionalChannelInfo_read(byte[] ser); // void ChannelInfo_free(LDKChannelInfo this_ptr); @@ -2316,7 +2316,7 @@ public class bindings { // void ChannelInfo_set_announcement_message(LDKChannelInfo *this_ptr, LDKChannelAnnouncement val); public static native void ChannelInfo_set_announcement_message(long this_ptr, long val); // LDKCVec_u8Z ChannelInfo_write(const LDKChannelInfo *obj); - public static native long ChannelInfo_write(long obj); + public static native byte[] ChannelInfo_write(long obj); // LDKChannelInfo ChannelInfo_read(LDKu8slice ser); public static native long ChannelInfo_read(byte[] ser); // void RoutingFees_free(LDKRoutingFees this_ptr); @@ -2336,7 +2336,7 @@ public class bindings { // LDKRoutingFees RoutingFees_read(LDKu8slice ser); public static native long RoutingFees_read(byte[] ser); // LDKCVec_u8Z RoutingFees_write(const LDKRoutingFees *obj); - public static native long RoutingFees_write(long obj); + public static native byte[] RoutingFees_write(long obj); // void NodeAnnouncementInfo_free(LDKNodeAnnouncementInfo this_ptr); public static native void NodeAnnouncementInfo_free(long this_ptr); // LDKNodeFeatures NodeAnnouncementInfo_get_features(const LDKNodeAnnouncementInfo *this_ptr); @@ -2364,7 +2364,7 @@ public class bindings { // MUST_USE_RES LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(LDKNodeFeatures features_arg, uint32_t last_update_arg, LDKThreeBytes rgb_arg, LDKThirtyTwoBytes alias_arg, LDKCVec_NetAddressZ addresses_arg, LDKNodeAnnouncement announcement_message_arg); public static native long NodeAnnouncementInfo_new(long features_arg, int last_update_arg, byte[] rgb_arg, byte[] alias_arg, long addresses_arg, long announcement_message_arg); // LDKCVec_u8Z NodeAnnouncementInfo_write(const LDKNodeAnnouncementInfo *obj); - public static native long NodeAnnouncementInfo_write(long obj); + public static native byte[] NodeAnnouncementInfo_write(long obj); // LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser); public static native long NodeAnnouncementInfo_read(byte[] ser); // void NodeInfo_free(LDKNodeInfo this_ptr); @@ -2382,11 +2382,11 @@ public class bindings { // MUST_USE_RES LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, LDKRoutingFees lowest_inbound_channel_fees_arg, LDKNodeAnnouncementInfo announcement_info_arg); public static native long NodeInfo_new(long channels_arg, long lowest_inbound_channel_fees_arg, long announcement_info_arg); // LDKCVec_u8Z NodeInfo_write(const LDKNodeInfo *obj); - public static native long NodeInfo_write(long obj); + public static native byte[] NodeInfo_write(long obj); // LDKNodeInfo NodeInfo_read(LDKu8slice ser); public static native long NodeInfo_read(byte[] ser); // LDKCVec_u8Z NetworkGraph_write(const LDKNetworkGraph *obj); - public static native long NetworkGraph_write(long obj); + public static native byte[] NetworkGraph_write(long obj); // LDKNetworkGraph NetworkGraph_read(LDKu8slice ser); public static native long NetworkGraph_read(byte[] ser); // MUST_USE_RES LDKNetworkGraph NetworkGraph_new(void); diff --git a/src/main/java/org/ldk/structs/AcceptChannel.java b/src/main/java/org/ldk/structs/AcceptChannel.java index a3c4f0c3..5397d48e 100644 --- a/src/main/java/org/ldk/structs/AcceptChannel.java +++ b/src/main/java/org/ldk/structs/AcceptChannel.java @@ -170,7 +170,12 @@ public class AcceptChannel extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped AcceptChannel_write + public byte[] write(AcceptChannel obj) { + byte[] ret = bindings.AcceptChannel_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public AcceptChannel(byte[] ser) { super(bindings.AcceptChannel_read(ser)); } diff --git a/src/main/java/org/ldk/structs/AnnouncementSignatures.java b/src/main/java/org/ldk/structs/AnnouncementSignatures.java index 90abb315..80845344 100644 --- a/src/main/java/org/ldk/structs/AnnouncementSignatures.java +++ b/src/main/java/org/ldk/structs/AnnouncementSignatures.java @@ -64,7 +64,12 @@ public class AnnouncementSignatures extends CommonBase { super(bindings.AnnouncementSignatures_new(channel_id_arg, short_channel_id_arg, node_signature_arg, bitcoin_signature_arg)); } - // Skipped AnnouncementSignatures_write + public byte[] write(AnnouncementSignatures obj) { + byte[] ret = bindings.AnnouncementSignatures_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public AnnouncementSignatures(byte[] ser) { super(bindings.AnnouncementSignatures_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ChannelAnnouncement.java b/src/main/java/org/ldk/structs/ChannelAnnouncement.java index 0b17c7a0..9d36fcdf 100644 --- a/src/main/java/org/ldk/structs/ChannelAnnouncement.java +++ b/src/main/java/org/ldk/structs/ChannelAnnouncement.java @@ -77,7 +77,12 @@ public class ChannelAnnouncement extends CommonBase { this.ptrs_to.add(contents_arg); } - // Skipped ChannelAnnouncement_write + public byte[] write(ChannelAnnouncement obj) { + byte[] ret = bindings.ChannelAnnouncement_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ChannelAnnouncement(byte[] ser) { super(bindings.ChannelAnnouncement_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ChannelConfig.java b/src/main/java/org/ldk/structs/ChannelConfig.java index fe80bccf..e91b4c2a 100644 --- a/src/main/java/org/ldk/structs/ChannelConfig.java +++ b/src/main/java/org/ldk/structs/ChannelConfig.java @@ -57,7 +57,12 @@ public class ChannelConfig extends CommonBase { super(bindings.ChannelConfig_default()); } - // Skipped ChannelConfig_write + public byte[] write(ChannelConfig obj) { + byte[] ret = bindings.ChannelConfig_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ChannelConfig(byte[] ser) { super(bindings.ChannelConfig_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java index d5b23cc4..9cdbd75f 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -66,7 +66,12 @@ public class ChannelInfo extends CommonBase { this.ptrs_to.add(val); } - // Skipped ChannelInfo_write + public byte[] write(ChannelInfo obj) { + byte[] ret = bindings.ChannelInfo_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ChannelInfo(byte[] ser) { super(bindings.ChannelInfo_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java b/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java index 7aabae2f..16789254 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java +++ b/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java @@ -27,7 +27,12 @@ public class ChannelMonitorUpdate extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped ChannelMonitorUpdate_write + public byte[] write(ChannelMonitorUpdate obj) { + byte[] ret = bindings.ChannelMonitorUpdate_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ChannelMonitorUpdate(byte[] ser) { super(bindings.ChannelMonitorUpdate_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ChannelPublicKeys.java b/src/main/java/org/ldk/structs/ChannelPublicKeys.java index e62ea44f..8b059bf1 100644 --- a/src/main/java/org/ldk/structs/ChannelPublicKeys.java +++ b/src/main/java/org/ldk/structs/ChannelPublicKeys.java @@ -75,7 +75,12 @@ public class ChannelPublicKeys extends CommonBase { super(bindings.ChannelPublicKeys_new(funding_pubkey_arg, revocation_basepoint_arg, payment_point_arg, delayed_payment_basepoint_arg, htlc_basepoint_arg)); } - // Skipped ChannelPublicKeys_write + public byte[] write(ChannelPublicKeys obj) { + byte[] ret = bindings.ChannelPublicKeys_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ChannelPublicKeys(byte[] ser) { super(bindings.ChannelPublicKeys_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ChannelReestablish.java b/src/main/java/org/ldk/structs/ChannelReestablish.java index 97f72ee3..3d47cc18 100644 --- a/src/main/java/org/ldk/structs/ChannelReestablish.java +++ b/src/main/java/org/ldk/structs/ChannelReestablish.java @@ -49,7 +49,12 @@ public class ChannelReestablish extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped ChannelReestablish_write + public byte[] write(ChannelReestablish obj) { + byte[] ret = bindings.ChannelReestablish_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ChannelReestablish(byte[] ser) { super(bindings.ChannelReestablish_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ChannelUpdate.java b/src/main/java/org/ldk/structs/ChannelUpdate.java index d4b306b4..b6a3f8d5 100644 --- a/src/main/java/org/ldk/structs/ChannelUpdate.java +++ b/src/main/java/org/ldk/structs/ChannelUpdate.java @@ -44,7 +44,12 @@ public class ChannelUpdate extends CommonBase { this.ptrs_to.add(contents_arg); } - // Skipped ChannelUpdate_write + public byte[] write(ChannelUpdate obj) { + byte[] ret = bindings.ChannelUpdate_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ChannelUpdate(byte[] ser) { super(bindings.ChannelUpdate_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ClosingSigned.java b/src/main/java/org/ldk/structs/ClosingSigned.java index 4f960828..b9cea8b9 100644 --- a/src/main/java/org/ldk/structs/ClosingSigned.java +++ b/src/main/java/org/ldk/structs/ClosingSigned.java @@ -53,7 +53,12 @@ public class ClosingSigned extends CommonBase { super(bindings.ClosingSigned_new(channel_id_arg, fee_satoshis_arg, signature_arg)); } - // Skipped ClosingSigned_write + public byte[] write(ClosingSigned obj) { + byte[] ret = bindings.ClosingSigned_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ClosingSigned(byte[] ser) { super(bindings.ClosingSigned_read(ser)); } diff --git a/src/main/java/org/ldk/structs/CommitmentSigned.java b/src/main/java/org/ldk/structs/CommitmentSigned.java index db4b65d0..12f35522 100644 --- a/src/main/java/org/ldk/structs/CommitmentSigned.java +++ b/src/main/java/org/ldk/structs/CommitmentSigned.java @@ -40,7 +40,12 @@ public class CommitmentSigned extends CommonBase { // Skipped CommitmentSigned_set_htlc_signatures // Skipped CommitmentSigned_new - // Skipped CommitmentSigned_write + public byte[] write(CommitmentSigned obj) { + byte[] ret = bindings.CommitmentSigned_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public CommitmentSigned(byte[] ser) { super(bindings.CommitmentSigned_read(ser)); } diff --git a/src/main/java/org/ldk/structs/DirectionalChannelInfo.java b/src/main/java/org/ldk/structs/DirectionalChannelInfo.java index a1845552..bcb2e8e3 100644 --- a/src/main/java/org/ldk/structs/DirectionalChannelInfo.java +++ b/src/main/java/org/ldk/structs/DirectionalChannelInfo.java @@ -67,7 +67,12 @@ public class DirectionalChannelInfo extends CommonBase { this.ptrs_to.add(val); } - // Skipped DirectionalChannelInfo_write + public byte[] write(DirectionalChannelInfo obj) { + byte[] ret = bindings.DirectionalChannelInfo_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public DirectionalChannelInfo(byte[] ser) { super(bindings.DirectionalChannelInfo_read(ser)); } diff --git a/src/main/java/org/ldk/structs/ErrorMessage.java b/src/main/java/org/ldk/structs/ErrorMessage.java index 6d7494fa..25f19094 100644 --- a/src/main/java/org/ldk/structs/ErrorMessage.java +++ b/src/main/java/org/ldk/structs/ErrorMessage.java @@ -28,9 +28,21 @@ public class ErrorMessage extends CommonBase { } // Skipped ErrorMessage_get_data - // Skipped ErrorMessage_set_data - // Skipped ErrorMessage_new - // Skipped ErrorMessage_write + public void set_data(ErrorMessage this_ptr, byte[] val) { + bindings.ErrorMessage_set_data(this_ptr == null ? 0 : this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public ErrorMessage(byte[] channel_id_arg, byte[] data_arg) { + super(bindings.ErrorMessage_new(channel_id_arg, data_arg)); + } + + public byte[] write(ErrorMessage obj) { + byte[] ret = bindings.ErrorMessage_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public ErrorMessage(byte[] ser) { super(bindings.ErrorMessage_read(ser)); } diff --git a/src/main/java/org/ldk/structs/FundingCreated.java b/src/main/java/org/ldk/structs/FundingCreated.java index adf4275c..27c86a0c 100644 --- a/src/main/java/org/ldk/structs/FundingCreated.java +++ b/src/main/java/org/ldk/structs/FundingCreated.java @@ -64,7 +64,12 @@ public class FundingCreated extends CommonBase { super(bindings.FundingCreated_new(temporary_channel_id_arg, funding_txid_arg, funding_output_index_arg, signature_arg)); } - // Skipped FundingCreated_write + public byte[] write(FundingCreated obj) { + byte[] ret = bindings.FundingCreated_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public FundingCreated(byte[] ser) { super(bindings.FundingCreated_read(ser)); } diff --git a/src/main/java/org/ldk/structs/FundingLocked.java b/src/main/java/org/ldk/structs/FundingLocked.java index 6b8f5b99..ac0cdf23 100644 --- a/src/main/java/org/ldk/structs/FundingLocked.java +++ b/src/main/java/org/ldk/structs/FundingLocked.java @@ -42,7 +42,12 @@ public class FundingLocked extends CommonBase { super(bindings.FundingLocked_new(channel_id_arg, next_per_commitment_point_arg)); } - // Skipped FundingLocked_write + public byte[] write(FundingLocked obj) { + byte[] ret = bindings.FundingLocked_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public FundingLocked(byte[] ser) { super(bindings.FundingLocked_read(ser)); } diff --git a/src/main/java/org/ldk/structs/FundingSigned.java b/src/main/java/org/ldk/structs/FundingSigned.java index f0b2fa8c..8cd651c1 100644 --- a/src/main/java/org/ldk/structs/FundingSigned.java +++ b/src/main/java/org/ldk/structs/FundingSigned.java @@ -42,7 +42,12 @@ public class FundingSigned extends CommonBase { super(bindings.FundingSigned_new(channel_id_arg, signature_arg)); } - // Skipped FundingSigned_write + public byte[] write(FundingSigned obj) { + byte[] ret = bindings.FundingSigned_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public FundingSigned(byte[] ser) { super(bindings.FundingSigned_read(ser)); } diff --git a/src/main/java/org/ldk/structs/GossipTimestampFilter.java b/src/main/java/org/ldk/structs/GossipTimestampFilter.java index 862b477f..96787b6a 100644 --- a/src/main/java/org/ldk/structs/GossipTimestampFilter.java +++ b/src/main/java/org/ldk/structs/GossipTimestampFilter.java @@ -57,5 +57,10 @@ public class GossipTimestampFilter extends CommonBase { super(bindings.GossipTimestampFilter_read(ser)); } - // Skipped GossipTimestampFilter_write + public byte[] write(GossipTimestampFilter obj) { + byte[] ret = bindings.GossipTimestampFilter_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java index 9cf88009..eaf132b8 100644 --- a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java +++ b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java @@ -60,7 +60,12 @@ public class HTLCOutputInCommitment extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped HTLCOutputInCommitment_write + public byte[] write(HTLCOutputInCommitment obj) { + byte[] ret = bindings.HTLCOutputInCommitment_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public HTLCOutputInCommitment(byte[] ser) { super(bindings.HTLCOutputInCommitment_read(ser)); } diff --git a/src/main/java/org/ldk/structs/HTLCUpdate.java b/src/main/java/org/ldk/structs/HTLCUpdate.java index c8751fd3..9ffcbd0f 100644 --- a/src/main/java/org/ldk/structs/HTLCUpdate.java +++ b/src/main/java/org/ldk/structs/HTLCUpdate.java @@ -16,7 +16,12 @@ public class HTLCUpdate extends CommonBase { this.ptrs_to.add(orig); } - // Skipped HTLCUpdate_write + public byte[] write(HTLCUpdate obj) { + byte[] ret = bindings.HTLCUpdate_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public HTLCUpdate(byte[] ser) { super(bindings.HTLCUpdate_read(ser)); } diff --git a/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java b/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java index 9751cebc..e48709b7 100644 --- a/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java @@ -58,7 +58,12 @@ public class HolderCommitmentTransaction extends CommonBase { } // Skipped HolderCommitmentTransaction_get_htlc_sigs - // Skipped HolderCommitmentTransaction_write + public byte[] write(HolderCommitmentTransaction obj) { + byte[] ret = bindings.HolderCommitmentTransaction_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public HolderCommitmentTransaction(byte[] ser) { super(bindings.HolderCommitmentTransaction_read(ser)); } diff --git a/src/main/java/org/ldk/structs/InMemoryChannelKeys.java b/src/main/java/org/ldk/structs/InMemoryChannelKeys.java index 792c7527..5176b137 100644 --- a/src/main/java/org/ldk/structs/InMemoryChannelKeys.java +++ b/src/main/java/org/ldk/structs/InMemoryChannelKeys.java @@ -104,7 +104,12 @@ public class InMemoryChannelKeys extends CommonBase { return ret; } - // Skipped InMemoryChannelKeys_write + public byte[] write(InMemoryChannelKeys obj) { + byte[] ret = bindings.InMemoryChannelKeys_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public InMemoryChannelKeys(byte[] ser) { super(bindings.InMemoryChannelKeys_read(ser)); } diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java index 491e692a..3c998bd9 100644 --- a/src/main/java/org/ldk/structs/Init.java +++ b/src/main/java/org/ldk/structs/Init.java @@ -16,7 +16,12 @@ public class Init extends CommonBase { this.ptrs_to.add(orig); } - // Skipped Init_write + public byte[] write(Init obj) { + byte[] ret = bindings.Init_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public Init(byte[] ser) { super(bindings.Init_read(ser)); } diff --git a/src/main/java/org/ldk/structs/KeysInterface.java b/src/main/java/org/ldk/structs/KeysInterface.java index fe7b60c2..22ea9eb3 100644 --- a/src/main/java/org/ldk/structs/KeysInterface.java +++ b/src/main/java/org/ldk/structs/KeysInterface.java @@ -20,7 +20,11 @@ public class KeysInterface extends CommonBase { return ret; } - // Skipped KeysInterface_get_destination_script + public byte[] get_destination_script() { + byte[] ret = bindings.KeysInterface_get_destination_script(this.ptr); + return ret; + } + public byte[] get_shutdown_pubkey() { byte[] ret = bindings.KeysInterface_get_shutdown_pubkey(this.ptr); return ret; diff --git a/src/main/java/org/ldk/structs/LightningError.java b/src/main/java/org/ldk/structs/LightningError.java index 4db4ea09..6574e77b 100644 --- a/src/main/java/org/ldk/structs/LightningError.java +++ b/src/main/java/org/ldk/structs/LightningError.java @@ -12,7 +12,11 @@ public class LightningError extends CommonBase { } // Skipped LightningError_get_err - // Skipped LightningError_set_err + public void set_err(LightningError this_ptr, byte[] val) { + bindings.LightningError_set_err(this_ptr == null ? 0 : this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + // Skipped LightningError_get_action // Skipped LightningError_set_action // Skipped LightningError_new diff --git a/src/main/java/org/ldk/structs/NetworkGraph.java b/src/main/java/org/ldk/structs/NetworkGraph.java index f18a9645..79647091 100644 --- a/src/main/java/org/ldk/structs/NetworkGraph.java +++ b/src/main/java/org/ldk/structs/NetworkGraph.java @@ -11,7 +11,12 @@ public class NetworkGraph extends CommonBase { bindings.NetworkGraph_free(ptr); } - // Skipped NetworkGraph_write + public byte[] write(NetworkGraph obj) { + byte[] ret = bindings.NetworkGraph_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public NetworkGraph(byte[] ser) { super(bindings.NetworkGraph_read(ser)); } diff --git a/src/main/java/org/ldk/structs/NodeAnnouncement.java b/src/main/java/org/ldk/structs/NodeAnnouncement.java index 019017c3..f65da9b8 100644 --- a/src/main/java/org/ldk/structs/NodeAnnouncement.java +++ b/src/main/java/org/ldk/structs/NodeAnnouncement.java @@ -44,7 +44,12 @@ public class NodeAnnouncement extends CommonBase { this.ptrs_to.add(contents_arg); } - // Skipped NodeAnnouncement_write + public byte[] write(NodeAnnouncement obj) { + byte[] ret = bindings.NodeAnnouncement_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public NodeAnnouncement(byte[] ser) { super(bindings.NodeAnnouncement_read(ser)); } diff --git a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java index e9a35ffb..9edaf2f1 100644 --- a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java +++ b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java @@ -65,7 +65,12 @@ public class NodeAnnouncementInfo extends CommonBase { } // Skipped NodeAnnouncementInfo_new - // Skipped NodeAnnouncementInfo_write + public byte[] write(NodeAnnouncementInfo obj) { + byte[] ret = bindings.NodeAnnouncementInfo_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public NodeAnnouncementInfo(byte[] ser) { super(bindings.NodeAnnouncementInfo_read(ser)); } diff --git a/src/main/java/org/ldk/structs/NodeInfo.java b/src/main/java/org/ldk/structs/NodeInfo.java index 4812f2f3..7d797e15 100644 --- a/src/main/java/org/ldk/structs/NodeInfo.java +++ b/src/main/java/org/ldk/structs/NodeInfo.java @@ -32,7 +32,12 @@ public class NodeInfo extends CommonBase { // Skipped NodeInfo_set_announcement_info // Skipped NodeInfo_new - // Skipped NodeInfo_write + public byte[] write(NodeInfo obj) { + byte[] ret = bindings.NodeInfo_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public NodeInfo(byte[] ser) { super(bindings.NodeInfo_read(ser)); } diff --git a/src/main/java/org/ldk/structs/OpenChannel.java b/src/main/java/org/ldk/structs/OpenChannel.java index e497933d..8c550ed8 100644 --- a/src/main/java/org/ldk/structs/OpenChannel.java +++ b/src/main/java/org/ldk/structs/OpenChannel.java @@ -214,7 +214,12 @@ public class OpenChannel extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped OpenChannel_write + public byte[] write(OpenChannel obj) { + byte[] ret = bindings.OpenChannel_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public OpenChannel(byte[] ser) { super(bindings.OpenChannel_read(ser)); } diff --git a/src/main/java/org/ldk/structs/OutPoint.java b/src/main/java/org/ldk/structs/OutPoint.java index 12fffe16..a980f095 100644 --- a/src/main/java/org/ldk/structs/OutPoint.java +++ b/src/main/java/org/ldk/structs/OutPoint.java @@ -47,7 +47,12 @@ public class OutPoint extends CommonBase { return ret; } - // Skipped OutPoint_write + public byte[] write(OutPoint obj) { + byte[] ret = bindings.OutPoint_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public OutPoint(byte[] ser) { super(bindings.OutPoint_read(ser)); } diff --git a/src/main/java/org/ldk/structs/Ping.java b/src/main/java/org/ldk/structs/Ping.java index a6cc369b..a6953912 100644 --- a/src/main/java/org/ldk/structs/Ping.java +++ b/src/main/java/org/ldk/structs/Ping.java @@ -42,7 +42,12 @@ public class Ping extends CommonBase { super(bindings.Ping_new(ponglen_arg, byteslen_arg)); } - // Skipped Ping_write + public byte[] write(Ping obj) { + byte[] ret = bindings.Ping_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public Ping(byte[] ser) { super(bindings.Ping_read(ser)); } diff --git a/src/main/java/org/ldk/structs/Pong.java b/src/main/java/org/ldk/structs/Pong.java index a674d05a..35be59ce 100644 --- a/src/main/java/org/ldk/structs/Pong.java +++ b/src/main/java/org/ldk/structs/Pong.java @@ -31,7 +31,12 @@ public class Pong extends CommonBase { super(bindings.Pong_new(byteslen_arg)); } - // Skipped Pong_write + public byte[] write(Pong obj) { + byte[] ret = bindings.Pong_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public Pong(byte[] ser) { super(bindings.Pong_read(ser)); } diff --git a/src/main/java/org/ldk/structs/QueryChannelRange.java b/src/main/java/org/ldk/structs/QueryChannelRange.java index 9d15fee3..d0f45df0 100644 --- a/src/main/java/org/ldk/structs/QueryChannelRange.java +++ b/src/main/java/org/ldk/structs/QueryChannelRange.java @@ -57,5 +57,10 @@ public class QueryChannelRange extends CommonBase { super(bindings.QueryChannelRange_read(ser)); } - // Skipped QueryChannelRange_write + public byte[] write(QueryChannelRange obj) { + byte[] ret = bindings.QueryChannelRange_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/QueryShortChannelIds.java b/src/main/java/org/ldk/structs/QueryShortChannelIds.java index e43f686d..4a04a404 100644 --- a/src/main/java/org/ldk/structs/QueryShortChannelIds.java +++ b/src/main/java/org/ldk/structs/QueryShortChannelIds.java @@ -33,5 +33,10 @@ public class QueryShortChannelIds extends CommonBase { super(bindings.QueryShortChannelIds_read(ser)); } - // Skipped QueryShortChannelIds_write + public byte[] write(QueryShortChannelIds obj) { + byte[] ret = bindings.QueryShortChannelIds_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/ReplyChannelRange.java b/src/main/java/org/ldk/structs/ReplyChannelRange.java index 7d33ba4b..3a306718 100644 --- a/src/main/java/org/ldk/structs/ReplyChannelRange.java +++ b/src/main/java/org/ldk/structs/ReplyChannelRange.java @@ -66,5 +66,10 @@ public class ReplyChannelRange extends CommonBase { super(bindings.ReplyChannelRange_read(ser)); } - // Skipped ReplyChannelRange_write + public byte[] write(ReplyChannelRange obj) { + byte[] ret = bindings.ReplyChannelRange_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java b/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java index 6ea3e720..9af5948d 100644 --- a/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java +++ b/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java @@ -46,5 +46,10 @@ public class ReplyShortChannelIdsEnd extends CommonBase { super(bindings.ReplyShortChannelIdsEnd_read(ser)); } - // Skipped ReplyShortChannelIdsEnd_write + public byte[] write(ReplyShortChannelIdsEnd obj) { + byte[] ret = bindings.ReplyShortChannelIdsEnd_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/RevokeAndACK.java b/src/main/java/org/ldk/structs/RevokeAndACK.java index 1c7a4a03..fe189a83 100644 --- a/src/main/java/org/ldk/structs/RevokeAndACK.java +++ b/src/main/java/org/ldk/structs/RevokeAndACK.java @@ -53,7 +53,12 @@ public class RevokeAndACK extends CommonBase { super(bindings.RevokeAndACK_new(channel_id_arg, per_commitment_secret_arg, next_per_commitment_point_arg)); } - // Skipped RevokeAndACK_write + public byte[] write(RevokeAndACK obj) { + byte[] ret = bindings.RevokeAndACK_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public RevokeAndACK(byte[] ser) { super(bindings.RevokeAndACK_read(ser)); } diff --git a/src/main/java/org/ldk/structs/Route.java b/src/main/java/org/ldk/structs/Route.java index aa4dd123..ec5853e3 100644 --- a/src/main/java/org/ldk/structs/Route.java +++ b/src/main/java/org/ldk/structs/Route.java @@ -18,7 +18,12 @@ public class Route extends CommonBase { // Skipped Route_set_paths // Skipped Route_new - // Skipped Route_write + public byte[] write(Route obj) { + byte[] ret = bindings.Route_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public Route(byte[] ser) { super(bindings.Route_read(ser)); } diff --git a/src/main/java/org/ldk/structs/RoutingFees.java b/src/main/java/org/ldk/structs/RoutingFees.java index 80183bb9..201b830a 100644 --- a/src/main/java/org/ldk/structs/RoutingFees.java +++ b/src/main/java/org/ldk/structs/RoutingFees.java @@ -46,5 +46,10 @@ public class RoutingFees extends CommonBase { super(bindings.RoutingFees_read(ser)); } - // Skipped RoutingFees_write + public byte[] write(RoutingFees obj) { + byte[] ret = bindings.RoutingFees_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/Shutdown.java b/src/main/java/org/ldk/structs/Shutdown.java index d1b08971..11151126 100644 --- a/src/main/java/org/ldk/structs/Shutdown.java +++ b/src/main/java/org/ldk/structs/Shutdown.java @@ -33,9 +33,21 @@ public class Shutdown extends CommonBase { return ret; } - // Skipped Shutdown_set_scriptpubkey - // Skipped Shutdown_new - // Skipped Shutdown_write + public void set_scriptpubkey(Shutdown this_ptr, byte[] val) { + bindings.Shutdown_set_scriptpubkey(this_ptr == null ? 0 : this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public Shutdown(byte[] channel_id_arg, byte[] scriptpubkey_arg) { + super(bindings.Shutdown_new(channel_id_arg, scriptpubkey_arg)); + } + + public byte[] write(Shutdown obj) { + byte[] ret = bindings.Shutdown_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public Shutdown(byte[] ser) { super(bindings.Shutdown_read(ser)); } diff --git a/src/main/java/org/ldk/structs/TxCreationKeys.java b/src/main/java/org/ldk/structs/TxCreationKeys.java index 0e2cc4ae..ece60151 100644 --- a/src/main/java/org/ldk/structs/TxCreationKeys.java +++ b/src/main/java/org/ldk/structs/TxCreationKeys.java @@ -75,7 +75,12 @@ public class TxCreationKeys extends CommonBase { super(bindings.TxCreationKeys_new(per_commitment_point_arg, revocation_key_arg, broadcaster_htlc_key_arg, countersignatory_htlc_key_arg, broadcaster_delayed_payment_key_arg)); } - // Skipped TxCreationKeys_write + public byte[] write(TxCreationKeys obj) { + byte[] ret = bindings.TxCreationKeys_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public TxCreationKeys(byte[] ser) { super(bindings.TxCreationKeys_read(ser)); } diff --git a/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java index e11c520c..959ad922 100644 --- a/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java +++ b/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java @@ -89,7 +89,12 @@ public class UnsignedChannelAnnouncement extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped UnsignedChannelAnnouncement_write + public byte[] write(UnsignedChannelAnnouncement obj) { + byte[] ret = bindings.UnsignedChannelAnnouncement_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public UnsignedChannelAnnouncement(byte[] ser) { super(bindings.UnsignedChannelAnnouncement_read(ser)); } diff --git a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java index b3520d33..20f1fe20 100644 --- a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java +++ b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java @@ -104,7 +104,12 @@ public class UnsignedChannelUpdate extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped UnsignedChannelUpdate_write + public byte[] write(UnsignedChannelUpdate obj) { + byte[] ret = bindings.UnsignedChannelUpdate_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public UnsignedChannelUpdate(byte[] ser) { super(bindings.UnsignedChannelUpdate_read(ser)); } diff --git a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java index adee1f66..7c336734 100644 --- a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java +++ b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java @@ -68,7 +68,12 @@ public class UnsignedNodeAnnouncement extends CommonBase { } // Skipped UnsignedNodeAnnouncement_set_addresses - // Skipped UnsignedNodeAnnouncement_write + public byte[] write(UnsignedNodeAnnouncement obj) { + byte[] ret = bindings.UnsignedNodeAnnouncement_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public UnsignedNodeAnnouncement(byte[] ser) { super(bindings.UnsignedNodeAnnouncement_read(ser)); } diff --git a/src/main/java/org/ldk/structs/UpdateAddHTLC.java b/src/main/java/org/ldk/structs/UpdateAddHTLC.java index 86bb2b41..2d1baf69 100644 --- a/src/main/java/org/ldk/structs/UpdateAddHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateAddHTLC.java @@ -71,7 +71,12 @@ public class UpdateAddHTLC extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped UpdateAddHTLC_write + public byte[] write(UpdateAddHTLC obj) { + byte[] ret = bindings.UpdateAddHTLC_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public UpdateAddHTLC(byte[] ser) { super(bindings.UpdateAddHTLC_read(ser)); } diff --git a/src/main/java/org/ldk/structs/UpdateFailHTLC.java b/src/main/java/org/ldk/structs/UpdateFailHTLC.java index 50147508..2c4536e8 100644 --- a/src/main/java/org/ldk/structs/UpdateFailHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFailHTLC.java @@ -38,7 +38,12 @@ public class UpdateFailHTLC extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped UpdateFailHTLC_write + public byte[] write(UpdateFailHTLC obj) { + byte[] ret = bindings.UpdateFailHTLC_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public UpdateFailHTLC(byte[] ser) { super(bindings.UpdateFailHTLC_read(ser)); } diff --git a/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java b/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java index 66e394dd..ea74f6d7 100644 --- a/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java @@ -49,7 +49,12 @@ public class UpdateFailMalformedHTLC extends CommonBase { this.ptrs_to.add(this_ptr); } - // Skipped UpdateFailMalformedHTLC_write + public byte[] write(UpdateFailMalformedHTLC obj) { + byte[] ret = bindings.UpdateFailMalformedHTLC_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public UpdateFailMalformedHTLC(byte[] ser) { super(bindings.UpdateFailMalformedHTLC_read(ser)); } diff --git a/src/main/java/org/ldk/structs/UpdateFee.java b/src/main/java/org/ldk/structs/UpdateFee.java index 9756771b..e915bad0 100644 --- a/src/main/java/org/ldk/structs/UpdateFee.java +++ b/src/main/java/org/ldk/structs/UpdateFee.java @@ -42,7 +42,12 @@ public class UpdateFee extends CommonBase { super(bindings.UpdateFee_new(channel_id_arg, feerate_per_kw_arg)); } - // Skipped UpdateFee_write + public byte[] write(UpdateFee obj) { + byte[] ret = bindings.UpdateFee_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public UpdateFee(byte[] ser) { super(bindings.UpdateFee_read(ser)); } diff --git a/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java b/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java index 5bb0940a..a373425c 100644 --- a/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java @@ -53,7 +53,12 @@ public class UpdateFulfillHTLC extends CommonBase { super(bindings.UpdateFulfillHTLC_new(channel_id_arg, htlc_id_arg, payment_preimage_arg)); } - // Skipped UpdateFulfillHTLC_write + public byte[] write(UpdateFulfillHTLC obj) { + byte[] ret = bindings.UpdateFulfillHTLC_write(obj == null ? 0 : obj.ptr & ~1); + this.ptrs_to.add(obj); + return ret; + } + public UpdateFulfillHTLC(byte[] ser) { super(bindings.UpdateFulfillHTLC_read(ser)); } diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 9858f24f..36a107ed 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -475,7 +475,7 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdate LDKMonitorUpdateError ret = (*val->contents.err); return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) { +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) { LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z"); LDKOutPoint a_conv; a_conv.inner = (void*)(a & (~1)); @@ -483,9 +483,11 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1 if (a_conv.inner != NULL) a_conv = OutPoint_clone(&a_conv); ret->a = a_conv; - LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b; - FREE((void*)b); - ret->b = b_conv; + LDKCVec_u8Z b_ref; + b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL); + b_ref.datalen = (*_env)->GetArrayLength (_env, b); + ret->b = b_ref; + //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here return (long)ret; } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { @@ -601,12 +603,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv LDKAPIError_APIMisuseError_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;")); CHECK(LDKAPIError_APIMisuseError_class != NULL); - LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "", "(J)V"); + LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "", "([B)V"); CHECK(LDKAPIError_APIMisuseError_meth != NULL); LDKAPIError_FeeRateTooHigh_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;")); CHECK(LDKAPIError_FeeRateTooHigh_class != NULL); - LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "", "(JI)V"); + LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "", "([BI)V"); CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL); LDKAPIError_RouteError_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;")); @@ -616,7 +618,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv LDKAPIError_ChannelUnavailable_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;")); CHECK(LDKAPIError_ChannelUnavailable_class != NULL); - LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "", "(J)V"); + LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "", "([B)V"); CHECK(LDKAPIError_ChannelUnavailable_meth != NULL); LDKAPIError_MonitorUpdateFailed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;")); @@ -624,27 +626,33 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "", "()V"); CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL); } -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) { +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) { LDKAPIError *obj = (LDKAPIError*)ptr; switch(obj->tag) { case LDKAPIError_APIMisuseError: { - long err_ref = (long)&obj->api_misuse_error.err; - return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref); + LDKCVec_u8Z err_var = obj->api_misuse_error.err; + jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen); + (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data); + return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr); } case LDKAPIError_FeeRateTooHigh: { - long err_ref = (long)&obj->fee_rate_too_high.err; - return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_ref, obj->fee_rate_too_high.feerate); + LDKCVec_u8Z err_var = obj->fee_rate_too_high.err; + jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen); + (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data); + return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate); } case LDKAPIError_RouteError: { long err_ref = (long)&obj->route_error.err; - return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref); + return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref); } case LDKAPIError_ChannelUnavailable: { - long err_ref = (long)&obj->channel_unavailable.err; - return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_ref); + LDKCVec_u8Z err_var = obj->channel_unavailable.err; + jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen); + (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data); + return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr); } case LDKAPIError_MonitorUpdateFailed: { - return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth); + return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth); } default: abort(); } @@ -751,7 +759,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescrip LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "", "(JJJ)V"); CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL); } -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) { +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) { LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr; switch(obj->tag) { case LDKSpendableOutputDescriptor_StaticOutput: { @@ -765,7 +773,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescripto outpoint_ref = (long)&outpoint_var; } long output_ref = (long)&obj->static_output.output; - return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref); + return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref); } case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: { LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint; @@ -777,13 +785,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescripto } else { outpoint_ref = (long)&outpoint_var; } - jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form); + jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form); long output_ref = (long)&obj->dynamic_output_p2wsh.output; long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params; - jbyteArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form); - return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, output_ref, key_derivation_params_ref, revocation_pubkey_arr); + jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form); + return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, output_ref, key_derivation_params_ref, revocation_pubkey_arr); } case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: { LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint; @@ -797,7 +805,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescripto } long output_ref = (long)&obj->static_output_counterparty_payment.output; long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params; - return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref); + return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref); } default: abort(); } @@ -842,7 +850,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * e LDKEvent_FundingGenerationReady_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;")); CHECK(LDKEvent_FundingGenerationReady_class != NULL); - LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "", "([BJJJ)V"); + LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "", "([BJ[BJ)V"); CHECK(LDKEvent_FundingGenerationReady_meth != NULL); LDKEvent_FundingBroadcastSafe_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;")); @@ -875,14 +883,16 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * e LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "", "(J)V"); CHECK(LDKEvent_SpendableOutputs_meth != NULL); } -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) { +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) { LDKEvent *obj = (LDKEvent*)ptr; switch(obj->tag) { case LDKEvent_FundingGenerationReady: { - jbyteArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data); - long output_script_ref = (long)&obj->funding_generation_ready.output_script; - return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_ref, obj->funding_generation_ready.user_channel_id); + jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data); + LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script; + jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen); + (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data); + return (*_env)->NewObject(_env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id); } case LDKEvent_FundingBroadcastSafe: { LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo; @@ -894,31 +904,31 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (J } else { funding_txo_ref = (long)&funding_txo_var; } - return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id); + return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id); } case LDKEvent_PaymentReceived: { - jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data); - jbyteArray 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_secret_arr, obj->payment_received.amt); + jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data); + jbyteArray 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_secret_arr, obj->payment_received.amt); } case LDKEvent_PaymentSent: { - jbyteArray payment_preimage_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data); - return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr); + jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data); + return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr); } case LDKEvent_PaymentFailed: { - jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data); - return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest); + jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data); + return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest); } case LDKEvent_PendingHTLCsForwardable: { - return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable); + return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable); } case LDKEvent_SpendableOutputs: { long outputs_ref = (long)&obj->spendable_outputs.outputs; - return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref); + return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref); } default: abort(); } @@ -946,7 +956,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIE LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "", "(J)V"); CHECK(LDKErrorAction_SendErrorMessage_meth != NULL); } -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) { +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) { LDKErrorAction *obj = (LDKErrorAction*)ptr; switch(obj->tag) { case LDKErrorAction_DisconnectPeer: { @@ -959,10 +969,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref); + return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref); } case LDKErrorAction_IgnoreError: { - return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth); + return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth); } case LDKErrorAction_SendErrorMessage: { LDKErrorMessage msg_var = obj->send_error_message.msg; @@ -974,7 +984,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref); + return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref); } default: abort(); } @@ -1002,7 +1012,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_ LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "", "([BZ)V"); CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL); } -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) { +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) { LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr; switch(obj->tag) { case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: { @@ -1015,15 +1025,15 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1r } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref); + return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref); } case LDKHTLCFailChannelUpdate_ChannelClosed: { - return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent); + return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent); } case LDKHTLCFailChannelUpdate_NodeFailure: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form); - return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form); + return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent); } default: abort(); } @@ -1142,12 +1152,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "", "(J)V"); CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL); } -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) { +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) { LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr; switch(obj->tag) { case LDKMessageSendEvent_SendAcceptChannel: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form); LDKAcceptChannel msg_var = obj->send_accept_channel.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1157,11 +1167,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendOpenChannel: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form); LDKOpenChannel msg_var = obj->send_open_channel.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1171,11 +1181,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendFundingCreated: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form); LDKFundingCreated msg_var = obj->send_funding_created.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1185,11 +1195,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendFundingSigned: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form); LDKFundingSigned msg_var = obj->send_funding_signed.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1199,11 +1209,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendFundingLocked: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form); LDKFundingLocked msg_var = obj->send_funding_locked.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1213,11 +1223,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendAnnouncementSignatures: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form); LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1227,11 +1237,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_UpdateHTLCs: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form); LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates; CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1241,11 +1251,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { updates_ref = (long)&updates_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref); } case LDKMessageSendEvent_SendRevokeAndACK: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form); LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1255,11 +1265,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendClosingSigned: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form); LDKClosingSigned msg_var = obj->send_closing_signed.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1269,11 +1279,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendShutdown: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form); LDKShutdown msg_var = obj->send_shutdown.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1283,11 +1293,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_SendChannelReestablish: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form); LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg; CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1297,7 +1307,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref); } case LDKMessageSendEvent_BroadcastChannelAnnouncement: { LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg; @@ -1318,7 +1328,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { update_msg_ref = (long)&update_msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref); } case LDKMessageSendEvent_BroadcastNodeAnnouncement: { LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg; @@ -1330,7 +1340,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref); } case LDKMessageSendEvent_BroadcastChannelUpdate: { LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg; @@ -1342,17 +1352,17 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f } else { msg_ref = (long)&msg_var; } - return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref); } case LDKMessageSendEvent_HandleError: { - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form); long action_ref = (long)&obj->handle_error.action; - return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref); } case LDKMessageSendEvent_PaymentFailureNetworkUpdate: { long update_ref = (long)&obj->payment_failure_network_update.update; - return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref); + return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref); } default: abort(); } @@ -1387,11 +1397,11 @@ typedef struct LDKMessageSendEventsProvider_JCalls { } LDKMessageSendEventsProvider_JCalls; LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) { LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth); + LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth); LDKCVec_MessageSendEventZ res = *ret; FREE(ret); return res; @@ -1474,11 +1484,11 @@ typedef struct LDKEventsProvider_JCalls { } LDKEventsProvider_JCalls; LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) { LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_events_meth); + LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_and_clear_pending_events_meth); LDKCVec_EventZ res = *ret; FREE(ret); return res; @@ -1539,12 +1549,12 @@ typedef struct LDKLogger_JCalls { } LDKLogger_JCalls; void log_jcall(const void* this_arg, const char *record) { LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jstring record_conv = (*env)->NewStringUTF(env, record); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jstring record_conv = (*_env)->NewStringUTF(_env, record); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv); + return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv); } static void LDKLogger_JCalls_free(void* this_arg) { LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg; @@ -1611,13 +1621,13 @@ typedef struct LDKAccess_JCalls { } LDKAccess_JCalls; LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) { LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32); + (*_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); + LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id); LDKCResult_TxOutAccessErrorZ res = *ret; FREE(ret); return res; @@ -1724,132 +1734,132 @@ typedef struct LDKChannelKeys_JCalls { } LDKChannelKeys_JCalls; LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx); - LDKPublicKey ret; - CHECK((*env)->GetArrayLength(env, jret) == 33); - (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form); - return ret; + jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx); + LDKPublicKey ret_ref; + CHECK((*_env)->GetArrayLength (_env, ret) == 33); + (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form); + return ret_ref; } LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx); - LDKThirtyTwoBytes ret; - CHECK((*env)->GetArrayLength(env, jret) == 32); - (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data); - return ret; + jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx); + LDKThirtyTwoBytes ret_ref; + CHECK((*_env)->GetArrayLength (_env, ret) == 32); + (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data); + return ret_ref; } LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth); + LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth); LDKC2Tuple_u64u64Z res = *ret; FREE(ret); return res; } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); long commitment_tx_ref = (long)&commitment_tx; long htlcs_ref = (long)&htlcs; - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + 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, feerate_per_kw, commitment_tx_ref, keys, htlcs_ref); + LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys, htlcs_ref); LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret; FREE(ret); return res; } LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx); + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx); LDKCResult_SignatureNoneZ res = *ret; FREE(ret); return res; } LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx); + LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx); LDKCResult_CVec_SignatureZNoneZ res = *ret; FREE(ret); return res; } LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); long justice_tx_ref = (long)&justice_tx; - jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32); + (*_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_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc); + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc); LDKCResult_SignatureNoneZ res = *ret; FREE(ret); return res; } LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); long htlc_tx_ref = (long)&htlc_tx; - jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form); + 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_ref, input, amount, per_commitment_point_arr, htlc); + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_arr, htlc); LDKCResult_SignatureNoneZ res = *ret; FREE(ret); return res; } LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); long closing_tx_ref = (long)&closing_tx; - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + 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_ref); + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref); LDKCResult_SignatureNoneZ res = *ret; FREE(ret); return res; } LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + 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); + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg); LDKCResult_SignatureNoneZ res = *ret; FREE(ret); return res; } void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay); + return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay); } static void LDKChannelKeys_JCalls_free(void* this_arg) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; @@ -2077,8 +2087,8 @@ typedef struct LDKWatch_JCalls { } LDKWatch_JCalls; LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); LDKOutPoint funding_txo_var = funding_txo; CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2097,17 +2107,17 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg } else { monitor_ref = (long)&monitor_var; } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + 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); + LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref); LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret; FREE(ret); return res; } LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); LDKOutPoint funding_txo_var = funding_txo; CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2126,20 +2136,20 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_ar } else { update_ref = (long)&update_var; } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + 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); + LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref); LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret; FREE(ret); return res; } LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, obj, j_calls->release_pending_monitor_events_meth); + LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*_env)->CallLongMethod(_env, obj, j_calls->release_pending_monitor_events_meth); LDKCVec_MonitorEventZ res = *ret; FREE(ret); return res; @@ -2240,27 +2250,27 @@ typedef struct LDKFilter_JCalls { } LDKFilter_JCalls; void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray txid_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid); LDKu8slice script_pubkey_var = script_pubkey; - jbyteArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen); - (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen); + (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr); + return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr); } void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); LDKu8slice script_pubkey_var = script_pubkey; - jbyteArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen); - (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen); + (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr); + return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr); } static void LDKFilter_JCalls_free(void* this_arg) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg; @@ -2339,12 +2349,12 @@ typedef struct LDKBroadcasterInterface_JCalls { } LDKBroadcasterInterface_JCalls; void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) { LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); long tx_ref = (long)&tx; - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_ref); + return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref); } static void LDKBroadcasterInterface_JCalls_free(void* this_arg) { LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg; @@ -2402,12 +2412,12 @@ typedef struct LDKFeeEstimator_JCalls { } LDKFeeEstimator_JCalls; uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) { LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv); + return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv); } static void LDKFeeEstimator_JCalls_free(void* this_arg) { LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg; @@ -2535,61 +2545,62 @@ typedef struct LDKKeysInterface_JCalls { } LDKKeysInterface_JCalls; LDKSecretKey get_node_secret_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth); - LDKSecretKey ret; - CHECK((*env)->GetArrayLength(env, jret) == 32); - (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.bytes); - return ret; + jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth); + LDKSecretKey ret_ref; + CHECK((*_env)->GetArrayLength (_env, ret) == 32); + (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.bytes); + return ret_ref; } LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth); - LDKCVec_u8Z res = *ret; - FREE(ret); - return res; + jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth); + LDKCVec_u8Z ret_ref; + ret_ref.data = (*_env)->GetByteArrayElements (_env, ret, NULL); + ret_ref.datalen = (*_env)->GetArrayLength (_env, ret); + return ret_ref; } LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth); - LDKPublicKey ret; - CHECK((*env)->GetArrayLength(env, jret) == 33); - (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form); - return ret; + jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth); + LDKPublicKey ret_ref; + CHECK((*_env)->GetArrayLength (_env, ret) == 33); + (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form); + return ret_ref; } LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis); + LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis); LDKChannelKeys res = *ret; FREE(ret); return res; } LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); - LDKThirtyTwoBytes ret; - CHECK((*env)->GetArrayLength(env, jret) == 32); - (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data); - return ret; + jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth); + LDKThirtyTwoBytes ret_ref; + CHECK((*_env)->GetArrayLength (_env, ret) == 32); + (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data); + return ret_ref; } static void LDKKeysInterface_JCalls_free(void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -2614,7 +2625,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, j calls->o = (*env)->NewWeakGlobalRef(env, o); calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B"); CHECK(calls->get_node_secret_meth != NULL); - calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J"); + 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); @@ -2651,11 +2662,12 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node return arg_arr; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); - return (long)ret; + LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) { @@ -2741,25 +2753,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEn LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "", "([BSBS)V"); CHECK(LDKNetAddress_OnionV3_meth != NULL); } -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) { +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) { LDKNetAddress *obj = (LDKNetAddress*)ptr; switch(obj->tag) { case LDKNetAddress_IPv4: { long addr_ref = (long)&obj->i_pv4.addr; - return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port); + return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port); } case LDKNetAddress_IPv6: { long addr_ref = (long)&obj->i_pv6.addr; - return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port); + return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port); } case LDKNetAddress_OnionV2: { long addr_ref = (long)&obj->onion_v2.addr; - return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port); + return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port); } case LDKNetAddress_OnionV3: { - jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data); - return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, obj->onion_v3.checksum, obj->onion_v3.version, obj->onion_v3.port); + jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data); + return (*_env)->NewObject(_env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, obj->onion_v3.checksum, obj->onion_v3.version, obj->onion_v3.port); } default: abort(); } @@ -2813,10 +2825,10 @@ typedef struct LDKChannelMessageHandler_JCalls { } LDKChannelMessageHandler_JCalls; void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInitFeatures their_features_var = their_features; CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2826,16 +2838,16 @@ void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, } else { their_features_ref = (long)&their_features_var; } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg); } void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); LDKInitFeatures their_features_var = their_features; CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2845,179 +2857,179 @@ void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_i } else { their_features_ref = (long)&their_features_var; } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg); } void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg); } void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg); } void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg); } void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg); } void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg); } void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg); } void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg); } void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg); } void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg); } void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg); } void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg); } void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg); } void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg); } void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible); + return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible); } void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg); } void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg); } void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg); } static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -3591,78 +3603,78 @@ typedef struct LDKRoutingMessageHandler_JCalls { } LDKRoutingMessageHandler_JCalls; LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + 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); + LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg); LDKCResult_boolLightningErrorZ res = *ret; FREE(ret); return res; } LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + 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); + LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg); LDKCResult_boolLightningErrorZ res = *ret; FREE(ret); return res; } LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + 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); + LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg); LDKCResult_boolLightningErrorZ res = *ret; FREE(ret); return res; } void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, update); + return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, update); } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); + LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret; FREE(ret); return res; } LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray starting_point_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount); + LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount); LDKCVec_NodeAnnouncementZ res = *ret; FREE(ret); return res; } bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jbyteArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, node_id.compressed_form); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33); + (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallBooleanMethod(env, obj, j_calls->should_request_full_sync_meth, node_id_arr); + return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr); } static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; @@ -3796,38 +3808,38 @@ typedef struct LDKSocketDescriptor_JCalls { } LDKSocketDescriptor_JCalls; uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); LDKu8slice data_var = data; - jbyteArray data_arr = (*env)->NewByteArray(env, data_var.datalen); - (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen); + (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read); + return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read); } void disconnect_socket_jcall(void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth); + return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth); } bool eq_jcall(const void* this_arg, const void *other_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, other_arg); + return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg); } uint64_t hash_jcall(const void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; - JNIEnv *env; - DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); + JNIEnv *_env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK); + jobject obj = (*_env)->NewLocalRef(_env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallLongMethod(env, obj, j_calls->hash_meth); + return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth); } static void LDKSocketDescriptor_JCalls_free(void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; @@ -3911,10 +3923,10 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerH JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) { LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg; CHECK(val->result_ok); - LDKCVecTempl_u8 l_u8_var = (*val->contents.result); - jbyteArray l_u8_arr = (*_env)->NewByteArray(_env, l_u8_var.datalen); - (*_env)->SetByteArrayRegion(_env, l_u8_arr, 0, l_u8_var.datalen, l_u8_var.data); - return l_u8_arr; + LDKCVecTempl_u8 arg_var = (*val->contents.result); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) { LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg; @@ -4190,11 +4202,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleEr CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) { - LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg; - FREE((void*)arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) { + LDKCVec_u8Z arg_ref; + arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL); + arg_ref.datalen = (*_env)->GetArrayLength (_env, arg); LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); - *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv); + *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref); + (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0); return (long)ret; } @@ -4585,10 +4599,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env CVec_u64Z_free(arg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) { - LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg; - FREE((void*)arg); - CVec_u8Z_free(arg_conv); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) { + LDKCVec_u8Z arg_ref; + arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL); + arg_ref.datalen = (*_env)->GetArrayLength (_env, arg); + CVec_u8Z_free(arg_ref); + (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) { @@ -4623,16 +4639,18 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErr return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) { +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) { LDKOutPoint a_conv; a_conv.inner = (void*)(a & (~1)); a_conv.is_owned = (a & 1) || (a == 0); if (a_conv.inner != NULL) a_conv = OutPoint_clone(&a_conv); - LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b; - FREE((void*)b); + LDKCVec_u8Z b_ref; + b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL); + b_ref.datalen = (*_env)->GetArrayLength (_env, b); LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ"); - *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv); + *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_ref); + (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); return (long)ret; } @@ -5091,13 +5109,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKChannelConfig obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ChannelConfig_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -5339,13 +5358,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1upd ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKChannelMonitorUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ChannelMonitorUpdate_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -5386,13 +5406,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _e return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKHTLCUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = HTLCUpdate_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -5594,13 +5615,14 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1i return arg_arr; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKOutPoint obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = OutPoint_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -5817,13 +5839,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1Chan return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKInMemoryChannelKeys obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = InMemoryChannelKeys_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -6523,22 +6546,26 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEn return (long)ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKErrorMessage this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val; - FREE((void*)val); - ErrorMessage_set_data(&this_ptr_conv, val_conv); + LDKCVec_u8Z val_ref; + val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL); + val_ref.datalen = (*_env)->GetArrayLength (_env, val); + ErrorMessage_set_data(&this_ptr_conv, val_ref); + (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) { +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_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); - LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg; - FREE((void*)data_arg); - LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv); + LDKCVec_u8Z data_arg_ref; + data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL); + data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg); + LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_ref); + (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0); return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } @@ -7470,22 +7497,26 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpub return arg_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKShutdown this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val; - FREE((void*)val); - Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv); + LDKCVec_u8Z val_ref; + val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL); + val_ref.datalen = (*_env)->GetArrayLength (_env, val); + Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref); + (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) { +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_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); - LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg; - FREE((void*)scriptpubkey_arg); - LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv); + LDKCVec_u8Z scriptpubkey_arg_ref; + scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL); + scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg); + LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref); + (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0); return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } @@ -9350,13 +9381,15 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIE return (long)ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKLightningError this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val; - FREE((void*)val); - LightningError_set_err(&this_ptr_conv, val_conv); + LDKCVec_u8Z val_ref; + val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL); + val_ref.datalen = (*_env)->GetArrayLength (_env, val); + LightningError_set_err(&this_ptr_conv, val_ref); + (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -9377,12 +9410,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JN LightningError_set_action(&this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) { - LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg; - FREE((void*)err_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) { + LDKCVec_u8Z err_arg_ref; + err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL); + err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg); LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg; FREE((void*)action_arg); - LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv); + LDKLightningError ret = LightningError_new(err_arg_ref, action_arg_conv); + (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0); return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } @@ -9518,13 +9553,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JN RoutingMessageHandler_free(this_ptr_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKAcceptChannel obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = AcceptChannel_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9536,13 +9572,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKAnnouncementSignatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = AnnouncementSignatures_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9554,13 +9591,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read( return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKChannelReestablish obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ChannelReestablish_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9572,13 +9610,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIE return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKClosingSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ClosingSigned_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9590,13 +9629,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKCommitmentSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = CommitmentSigned_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9608,13 +9648,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKFundingCreated obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = FundingCreated_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9626,13 +9667,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKFundingSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = FundingSigned_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9644,13 +9686,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKFundingLocked obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = FundingLocked_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9662,13 +9705,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKInit obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = Init_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = Init_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9680,13 +9724,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jcl return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKOpenChannel obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = OpenChannel_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9698,13 +9743,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _e return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKRevokeAndACK obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = RevokeAndACK_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9716,13 +9762,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _ return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKShutdown obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = Shutdown_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9734,13 +9781,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKUpdateFailHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = UpdateFailHTLC_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9752,13 +9800,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKUpdateFailMalformedHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = UpdateFailMalformedHTLC_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9770,13 +9819,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKUpdateFee obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = UpdateFee_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9788,13 +9838,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKUpdateFulfillHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = UpdateFulfillHTLC_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9806,13 +9857,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEn return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKUpdateAddHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = UpdateAddHTLC_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9824,13 +9876,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKPing obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = Ping_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = Ping_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9842,13 +9895,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jcl return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKPong obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = Pong_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = Pong_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9860,13 +9914,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jcl return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKUnsignedChannelAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = UnsignedChannelAnnouncement_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9878,13 +9933,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1 return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKChannelAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ChannelAnnouncement_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9896,13 +9952,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNI return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKUnsignedChannelUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = UnsignedChannelUpdate_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9914,13 +9971,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(J return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKChannelUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ChannelUpdate_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9932,13 +9990,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKErrorMessage obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ErrorMessage_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9950,13 +10009,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _ return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKUnsignedNodeAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = UnsignedNodeAnnouncement_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9968,13 +10028,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1rea return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKNodeAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = NodeAnnouncement_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -9995,13 +10056,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JN return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKQueryShortChannelIds obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = QueryShortChannelIds_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -10013,13 +10075,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKReplyShortChannelIdsEnd obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ReplyShortChannelIdsEnd_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -10031,13 +10094,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEn return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKQueryChannelRange obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = QueryChannelRange_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -10049,13 +10113,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEn return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKReplyChannelRange obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ReplyChannelRange_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -10067,13 +10132,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(J return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKGossipTimestampFilter obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = GossipTimestampFilter_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -10476,13 +10542,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv * return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKTxCreationKeys obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = TxCreationKeys_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -10658,13 +10725,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKChannelPublicKeys obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ChannelPublicKeys_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -10697,16 +10765,17 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(J return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray revocation_key, jshort contest_delay, jbyteArray broadcaster_delayed_payment_key) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray revocation_key, jshort contest_delay, jbyteArray broadcaster_delayed_payment_key) { LDKPublicKey revocation_key_ref; CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33); (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form); LDKPublicKey broadcaster_delayed_payment_key_ref; CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33); (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref); - return (long)ret; + LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -10788,13 +10857,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1p HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKHTLCOutputInCommitment obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = HTLCOutputInCommitment_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -10806,28 +10876,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read( return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) { LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = (void*)(htlc & (~1)); htlc_conv.is_owned = (htlc & 1) || (htlc == 0); LDKTxCreationKeys keys_conv; keys_conv.inner = (void*)(keys & (~1)); keys_conv.is_owned = (keys & 1) || (keys == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv); - return (long)ret; + LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) { LDKPublicKey broadcaster_ref; CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33); (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form); LDKPublicKey countersignatory_ref; CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33); (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = make_funding_redeemscript(broadcaster_ref, countersignatory_ref); - return (long)ret; + LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jshort contest_delay, jlong htlc, jbyteArray broadcaster_delayed_payment_key, jbyteArray revocation_key) { @@ -10995,13 +11067,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1 return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKHolderCommitmentTransaction obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = HolderCommitmentTransaction_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -11198,13 +11271,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jcl return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKRoute obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = Route_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = Route_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -11510,13 +11584,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1l DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKDirectionalChannelInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = DirectionalChannelInfo_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -11650,13 +11725,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKChannelInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = ChannelInfo_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -11727,13 +11803,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _e return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKRoutingFees obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = RoutingFees_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -11866,13 +11943,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNI return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKNodeAnnouncementInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = NodeAnnouncementInfo_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -11955,13 +12033,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv * _env, return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKNodeInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = NodeInfo_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { @@ -11973,13 +12052,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) { LDKNetworkGraph obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = (obj & 1) || (obj == 0); - LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = NetworkGraph_write(&obj_conv); - return (long)ret; + LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv); + jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data); + return arg_arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) { diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index c46c4c76..9ba7a2c0 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -162,10 +162,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdate /* * Class: org_ldk_impl_bindings * Method: LDKC2TupleTempl_OutPoint__CVec_u8Z_new - * Signature: (JJ)J + * Signature: (J[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -914,9 +914,9 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node /* * Class: org_ldk_impl_bindings * Method: KeysInterface_get_destination_script - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script (JNIEnv *, jclass, jlong); /* @@ -1738,10 +1738,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleEr /* * Class: org_ldk_impl_bindings * Method: CResult_CVec_u8ZPeerHandleErrorZ_ok - * Signature: (J)J + * Signature: ([B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok - (JNIEnv *, jclass, jlong); + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -2210,10 +2210,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free /* * Class: org_ldk_impl_bindings * Method: CVec_u8Z_free - * Signature: (J)V + * Signature: ([B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free - (JNIEnv *, jclass, jlong); + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -2258,10 +2258,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErr /* * Class: org_ldk_impl_bindings * Method: C2Tuple_OutPointScriptZ_new - * Signature: (JJ)J + * Signature: (J[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -2762,9 +2762,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default /* * Class: org_ldk_impl_bindings * Method: ChannelConfig_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write (JNIEnv *, jclass, jlong); /* @@ -2978,9 +2978,9 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1upd /* * Class: org_ldk_impl_bindings * Method: ChannelMonitorUpdate_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write (JNIEnv *, jclass, jlong); /* @@ -3026,9 +3026,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone /* * Class: org_ldk_impl_bindings * Method: HTLCUpdate_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write (JNIEnv *, jclass, jlong); /* @@ -3178,9 +3178,9 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1i /* * Class: org_ldk_impl_bindings * Method: OutPoint_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write (JNIEnv *, jclass, jlong); /* @@ -3370,9 +3370,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1Chan /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write (JNIEnv *, jclass, jlong); /* @@ -3922,18 +3922,18 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data /* * Class: org_ldk_impl_bindings * Method: ErrorMessage_set_data - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings * Method: ErrorMessage_new - * Signature: ([BJ)J + * Signature: ([B[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new - (JNIEnv *, jclass, jbyteArray, jlong); + (JNIEnv *, jclass, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4818,18 +4818,18 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpub /* * Class: org_ldk_impl_bindings * Method: Shutdown_set_scriptpubkey - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings * Method: Shutdown_new - * Signature: ([BJ)J + * Signature: ([B[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new - (JNIEnv *, jclass, jbyteArray, jlong); + (JNIEnv *, jclass, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -6554,10 +6554,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err /* * Class: org_ldk_impl_bindings * Method: LightningError_set_err - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -6578,10 +6578,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action /* * Class: org_ldk_impl_bindings * Method: LightningError_new - * Signature: (JJ)J + * Signature: ([BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -6698,9 +6698,9 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free /* * Class: org_ldk_impl_bindings * Method: AcceptChannel_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write (JNIEnv *, jclass, jlong); /* @@ -6714,9 +6714,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read /* * Class: org_ldk_impl_bindings * Method: AnnouncementSignatures_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write (JNIEnv *, jclass, jlong); /* @@ -6730,9 +6730,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read /* * Class: org_ldk_impl_bindings * Method: ChannelReestablish_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write (JNIEnv *, jclass, jlong); /* @@ -6746,9 +6746,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read /* * Class: org_ldk_impl_bindings * Method: ClosingSigned_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write (JNIEnv *, jclass, jlong); /* @@ -6762,9 +6762,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read /* * Class: org_ldk_impl_bindings * Method: CommitmentSigned_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write (JNIEnv *, jclass, jlong); /* @@ -6778,9 +6778,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read /* * Class: org_ldk_impl_bindings * Method: FundingCreated_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write (JNIEnv *, jclass, jlong); /* @@ -6794,9 +6794,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read /* * Class: org_ldk_impl_bindings * Method: FundingSigned_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write (JNIEnv *, jclass, jlong); /* @@ -6810,9 +6810,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read /* * Class: org_ldk_impl_bindings * Method: FundingLocked_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write (JNIEnv *, jclass, jlong); /* @@ -6826,9 +6826,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read /* * Class: org_ldk_impl_bindings * Method: Init_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write (JNIEnv *, jclass, jlong); /* @@ -6842,9 +6842,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read /* * Class: org_ldk_impl_bindings * Method: OpenChannel_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write (JNIEnv *, jclass, jlong); /* @@ -6858,9 +6858,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read /* * Class: org_ldk_impl_bindings * Method: RevokeAndACK_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write (JNIEnv *, jclass, jlong); /* @@ -6874,9 +6874,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read /* * Class: org_ldk_impl_bindings * Method: Shutdown_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write (JNIEnv *, jclass, jlong); /* @@ -6890,9 +6890,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read /* * Class: org_ldk_impl_bindings * Method: UpdateFailHTLC_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write (JNIEnv *, jclass, jlong); /* @@ -6906,9 +6906,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read /* * Class: org_ldk_impl_bindings * Method: UpdateFailMalformedHTLC_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write (JNIEnv *, jclass, jlong); /* @@ -6922,9 +6922,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read /* * Class: org_ldk_impl_bindings * Method: UpdateFee_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write (JNIEnv *, jclass, jlong); /* @@ -6938,9 +6938,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read /* * Class: org_ldk_impl_bindings * Method: UpdateFulfillHTLC_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write (JNIEnv *, jclass, jlong); /* @@ -6954,9 +6954,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read /* * Class: org_ldk_impl_bindings * Method: UpdateAddHTLC_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write (JNIEnv *, jclass, jlong); /* @@ -6970,9 +6970,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read /* * Class: org_ldk_impl_bindings * Method: Ping_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write (JNIEnv *, jclass, jlong); /* @@ -6986,9 +6986,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read /* * Class: org_ldk_impl_bindings * Method: Pong_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write (JNIEnv *, jclass, jlong); /* @@ -7002,9 +7002,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write (JNIEnv *, jclass, jlong); /* @@ -7018,9 +7018,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1 /* * Class: org_ldk_impl_bindings * Method: ChannelAnnouncement_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write (JNIEnv *, jclass, jlong); /* @@ -7034,9 +7034,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelUpdate_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write (JNIEnv *, jclass, jlong); /* @@ -7050,9 +7050,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read /* * Class: org_ldk_impl_bindings * Method: ChannelUpdate_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write (JNIEnv *, jclass, jlong); /* @@ -7066,9 +7066,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read /* * Class: org_ldk_impl_bindings * Method: ErrorMessage_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write (JNIEnv *, jclass, jlong); /* @@ -7082,9 +7082,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read /* * Class: org_ldk_impl_bindings * Method: UnsignedNodeAnnouncement_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write (JNIEnv *, jclass, jlong); /* @@ -7098,9 +7098,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1rea /* * Class: org_ldk_impl_bindings * Method: NodeAnnouncement_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write (JNIEnv *, jclass, jlong); /* @@ -7122,9 +7122,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read /* * Class: org_ldk_impl_bindings * Method: QueryShortChannelIds_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write (JNIEnv *, jclass, jlong); /* @@ -7138,9 +7138,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read /* * Class: org_ldk_impl_bindings * Method: ReplyShortChannelIdsEnd_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write (JNIEnv *, jclass, jlong); /* @@ -7154,9 +7154,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read /* * Class: org_ldk_impl_bindings * Method: QueryChannelRange_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write (JNIEnv *, jclass, jlong); /* @@ -7170,9 +7170,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read /* * Class: org_ldk_impl_bindings * Method: ReplyChannelRange_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write (JNIEnv *, jclass, jlong); /* @@ -7186,9 +7186,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read /* * Class: org_ldk_impl_bindings * Method: GossipTimestampFilter_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write (JNIEnv *, jclass, jlong); /* @@ -7506,9 +7506,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new /* * Class: org_ldk_impl_bindings * Method: TxCreationKeys_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write (JNIEnv *, jclass, jlong); /* @@ -7658,9 +7658,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new /* * Class: org_ldk_impl_bindings * Method: ChannelPublicKeys_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write (JNIEnv *, jclass, jlong); /* @@ -7682,9 +7682,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new /* * Class: org_ldk_impl_bindings * Method: get_revokeable_redeemscript - * Signature: ([BS[B)J + * Signature: ([BS[B)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript (JNIEnv *, jclass, jbyteArray, jshort, jbyteArray); /* @@ -7770,9 +7770,9 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1p /* * Class: org_ldk_impl_bindings * Method: HTLCOutputInCommitment_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write (JNIEnv *, jclass, jlong); /* @@ -7786,17 +7786,17 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read /* * Class: org_ldk_impl_bindings * Method: get_htlc_redeemscript - * Signature: (JJ)J + * Signature: (JJ)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: make_funding_redeemscript - * Signature: ([B[B)J + * Signature: ([B[B)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript (JNIEnv *, jclass, jbyteArray, jbyteArray); /* @@ -7922,9 +7922,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1 /* * Class: org_ldk_impl_bindings * Method: HolderCommitmentTransaction_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write (JNIEnv *, jclass, jlong); /* @@ -8114,9 +8114,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new /* * Class: org_ldk_impl_bindings * Method: Route_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write (JNIEnv *, jclass, jlong); /* @@ -8394,9 +8394,9 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1l /* * Class: org_ldk_impl_bindings * Method: DirectionalChannelInfo_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write (JNIEnv *, jclass, jlong); /* @@ -8514,9 +8514,9 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement /* * Class: org_ldk_impl_bindings * Method: ChannelInfo_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write (JNIEnv *, jclass, jlong); /* @@ -8594,9 +8594,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read /* * Class: org_ldk_impl_bindings * Method: RoutingFees_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write (JNIEnv *, jclass, jlong); /* @@ -8706,9 +8706,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new /* * Class: org_ldk_impl_bindings * Method: NodeAnnouncementInfo_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write (JNIEnv *, jclass, jlong); /* @@ -8778,9 +8778,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new /* * Class: org_ldk_impl_bindings * Method: NodeInfo_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write (JNIEnv *, jclass, jlong); /* @@ -8794,9 +8794,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read /* * Class: org_ldk_impl_bindings * Method: NetworkGraph_write - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write (JNIEnv *, jclass, jlong); /* diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java index 30c94ea1..7f9e470c 100644 --- a/src/test/java/org/ldk/HumanObjectPeerTest.java +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -219,7 +219,7 @@ public class HumanObjectPeerTest { assert event instanceof bindings.LDKEvent.FundingGenerationReady; assert ((bindings.LDKEvent.FundingGenerationReady) event).channel_value_satoshis == 10000; assert ((bindings.LDKEvent.FundingGenerationReady) event).user_channel_id == 42; - byte[] funding_spk = bindings.get_u8_slice_bytes(((bindings.LDKEvent.FundingGenerationReady) event).output_script); + byte[] funding_spk = ((bindings.LDKEvent.FundingGenerationReady) event).output_script; assert funding_spk.length == 34 && funding_spk[0] == 0 && funding_spk[1] == 32; // P2WSH byte[] chan_id = ((bindings.LDKEvent.FundingGenerationReady) event).temporary_channel_id; bindings.CVec_EventZ_free(events); diff --git a/src/test/java/org/ldk/PeerTest.java b/src/test/java/org/ldk/PeerTest.java index 398e159e..01e6d33a 100644 --- a/src/test/java/org/ldk/PeerTest.java +++ b/src/test/java/org/ldk/PeerTest.java @@ -219,7 +219,7 @@ public class PeerTest { assert event instanceof bindings.LDKEvent.FundingGenerationReady; assert ((bindings.LDKEvent.FundingGenerationReady)event).channel_value_satoshis == 10000; assert ((bindings.LDKEvent.FundingGenerationReady)event).user_channel_id == 42; - byte[] funding_spk = bindings.get_u8_slice_bytes(((bindings.LDKEvent.FundingGenerationReady)event).output_script); + byte[] funding_spk = ((bindings.LDKEvent.FundingGenerationReady)event).output_script; assert funding_spk.length == 34 && funding_spk[0] == 0 && funding_spk[1] == 32; // P2WSH byte[] chan_id = ((bindings.LDKEvent.FundingGenerationReady)event).temporary_channel_id; bindings.CVec_EventZ_free(events); -- 2.39.5