From 00aa80bd7fe8b602055403997f54632170745438 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 8 Oct 2020 16:51:09 -0400 Subject: [PATCH] Convert LDKThirtyTwoBytes to byte[32] instead of taking a ptr --- genbindings.py | 57 +- src/main/java/org/ldk/impl/bindings.java | 158 ++-- src/main/jni/bindings.c | 922 ++++++++++++----------- src/main/jni/org_ldk_impl_bindings.h | 264 +++---- src/test/java/org/ldk/PeerTest.java | 15 +- 5 files changed, 733 insertions(+), 683 deletions(-) diff --git a/genbindings.py b/genbindings.py index 902cf6df..4e78598f 100755 --- a/genbindings.py +++ b/genbindings.py @@ -74,7 +74,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg lastund = True return (ret + lastchar.lower()).strip("_") - var_is_arr_regex = re.compile("\(\*([A-za-z_]*)\)\[([0-9]*)\]") + var_is_arr_regex = re.compile("\(\*([A-za-z0-9_]*)\)\[([0-9]*)\]") var_ty_regex = re.compile("([A-za-z_0-9]*)(.*)") def java_c_types(fn_arg, ret_arr_len): fn_arg = fn_arg.strip() @@ -88,6 +88,11 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg is_ptr = False take_by_ptr = False rust_obj = None + if fn_arg.startswith("LDKThirtyTwoBytes"): + fn_arg = "uint8_t (*" + fn_arg[18:] + ")[32]" + assert var_is_arr_regex.match(fn_arg[8:]) + rust_obj = "LDKThirtyTwoBytes" + if fn_arg.startswith("void"): java_ty = "void" c_ty = "void" @@ -157,7 +162,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg java_ty = java_ty + "[]" c_ty = c_ty + "Array" if var_is_arr is not None: - return TypeInfo(rust_obj=None, java_ty=java_ty, java_fn_ty_arg="[" + fn_ty_arg, c_ty=c_ty, + return TypeInfo(rust_obj=rust_obj, java_ty=java_ty, java_fn_ty_arg="[" + fn_ty_arg, c_ty=c_ty, passed_as_ptr=False, is_ptr=False, var_name=var_is_arr.group(1), arr_len=var_is_arr.group(2)) return TypeInfo(rust_obj=rust_obj, java_ty=java_ty, java_fn_ty_arg=fn_ty_arg, c_ty=c_ty, passed_as_ptr=is_ptr or take_by_ptr, is_ptr=is_ptr, var_name=fn_arg, arr_len=None) @@ -178,14 +183,18 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg arr_name = "ret" arr_len = ret_arr_len assert(ty_info.c_ty == "jbyteArray") + if ty_info.rust_obj is not None: + arg_conv = ty_info.rust_obj + " " + arr_name + "_ref;\n" + "(*_env)->GetByteArrayRegion (_env, """ + arr_name + ", 0, " + arr_len + ", " + arr_name + "_ref.data);" + arr_access = ("", ".data") + else: + arg_conv = "unsigned char " + arr_name + "_arr[" + arr_len + "];\n" + "(*_env)->GetByteArrayRegion (_env, """ + arr_name + ", 0, " + arr_len + ", " + arr_name + "_arr);\n" + "unsigned char (*""" + arr_name + "_ref)[" + arr_len + "] = &" + arr_name + "_arr;" + arr_access = ("*", "") return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name, - arg_conv = "unsigned char " + arr_name + "_arr[" + arr_len + "];\n" + - "(*_env)->GetByteArrayRegion (_env, """ + arr_name + ", 0, " + arr_len + ", " + arr_name + "_arr);\n" + - "unsigned char (*""" + arr_name + "_ref)[" + arr_len + "] = &" + arr_name + "_arr;", + arg_conv = arg_conv, arg_conv_name = arr_name + "_ref", ret_conv = ("jbyteArray " + arr_name + "_arr = (*_env)->NewByteArray(_env, " + arr_len + ");\n" + - "(*_env)->SetByteArrayRegion(_env, " + arr_name + "_arr, 0, " + arr_len + ", *", - ");"), + "(*_env)->SetByteArrayRegion(_env, " + arr_name + "_arr, 0, " + arr_len + ", " + arr_access[0], + arr_access[1] + ");"), ret_conv_name = arr_name + "_arr") elif ty_info.var_name != "": # If we have a parameter name, print it (noting that it may indicate its a pointer) @@ -392,7 +401,10 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_c.write(arg_info.arg_name) out_c.write(arg_info.ret_conv[1].replace('\n', '\n\t').replace("_env", "env") + "\n") - if not ret_ty_info.passed_as_ptr: + if ret_ty_info.c_ty.endswith("Array"): + assert(ret_ty_info.c_ty == "jbyteArray") + out_c.write("\tjbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, 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, j_calls->o, 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, j_calls->o, j_calls->" + fn_line.group(2) + "_meth"); @@ -403,6 +415,10 @@ 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("\tLDKThirtyTwoBytes ret;\n") + out_c.write("\t(*env)->GetByteArrayRegion(env, jret, 0, " + ret_ty_info.arr_len + ", ret.data);\n") + out_c.write("\treturn ret;\n") if ret_ty_info.passed_as_ptr: out_c.write("\t" + fn_line.group(1).strip() + " res = *ret;\n") @@ -822,23 +838,22 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), for idx, struct_line in enumerate(tag_field_lines): if idx != 0 and idx < len(tag_field_lines) - 3: var_name = struct_line.strip(' ,')[len(struct_name) + 1:] - out_c.write("\t\tcase " + struct_name + "_" + var_name + ":\n") - out_c.write("\t\t\treturn (*env)->NewObject(env, " + struct_name + "_" + var_name + "_class, " + struct_name + "_" + var_name + "_meth") + out_c.write("\t\tcase " + struct_name + "_" + var_name + ": {\n") + c_params_text = "" if "LDK" + var_name in union_enum_items[struct_name]: enum_var_lines = union_enum_items[struct_name]["LDK" + var_name] - out_c.write(",\n\t\t\t\t") for idx, field in enumerate(enum_var_lines): if idx != 0 and idx < len(enum_var_lines) - 2: - field_ty = java_c_types(field.strip(' ;'), None) - if idx >= 2: - out_c.write(", ") - if field_ty.is_ptr: - out_c.write("(long)") - elif field_ty.passed_as_ptr or field_ty.arr_len is not None: - out_c.write("(long)&") - out_c.write("obj->" + camel_to_snake(var_name) + "." + field_ty.var_name) - out_c.write("\n\t\t\t") - out_c.write(");\n") + 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("obj->" + camel_to_snake(var_name) + "." + field_map.arg_name) + out_c.write(field_map.ret_conv[1] + "\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}\n") out_c.write("\t\tdefault: abort();\n") out_c.write("\t}\n}\n") elif is_unitary_enum: diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 995a03e0..1f61ac2e 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -114,11 +114,11 @@ public class bindings { public static class LDKEvent { private LDKEvent() {} public final static class FundingGenerationReady extends LDKEvent { - public long temporary_channel_id; + public byte[] temporary_channel_id; public long channel_value_satoshis; public long output_script; public long user_channel_id; - FundingGenerationReady(long 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, 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; } } public final static class FundingBroadcastSafe extends LDKEvent { public long funding_txo; @@ -126,19 +126,19 @@ public class bindings { FundingBroadcastSafe(long funding_txo, long user_channel_id) { this.funding_txo = funding_txo; this.user_channel_id = user_channel_id; } } public final static class PaymentReceived extends LDKEvent { - public long payment_hash; - public long payment_secret; + public byte[] payment_hash; + public byte[] payment_secret; public long amt; - PaymentReceived(long payment_hash, long payment_secret, long amt) { this.payment_hash = payment_hash; this.payment_secret = payment_secret; this.amt = amt; } + PaymentReceived(byte[] payment_hash, byte[] payment_secret, long amt) { this.payment_hash = payment_hash; this.payment_secret = payment_secret; this.amt = amt; } } public final static class PaymentSent extends LDKEvent { - public long payment_preimage; - PaymentSent(long payment_preimage) { this.payment_preimage = payment_preimage; } + public byte[] payment_preimage; + PaymentSent(byte[] payment_preimage) { this.payment_preimage = payment_preimage; } } public final static class PaymentFailed extends LDKEvent { - public long payment_hash; + public byte[] payment_hash; public boolean rejected_by_dest; - PaymentFailed(long payment_hash, boolean rejected_by_dest) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; } + PaymentFailed(byte[] payment_hash, boolean rejected_by_dest) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; } } public final static class PendingHTLCsForwardable extends LDKEvent { public long time_forwardable; @@ -325,7 +325,7 @@ public class bindings { public static native long LDKUnsignedChannelAnnouncement_optional_none(); public interface LDKChannelKeys { long get_per_commitment_point(long idx); - long release_commitment_secret(long idx); + byte[] release_commitment_secret(long idx); long key_derivation_params(); long sign_counterparty_commitment(int feerate_per_kw, long commitment_tx, long keys, long htlcs); long sign_holder_commitment(long holder_commitment_tx); @@ -341,7 +341,7 @@ public class bindings { // LDKPublicKey LDKChannelKeys_call_get_per_commitment_point LDKChannelKeys* arg, uint64_t idx public static native long LDKChannelKeys_call_get_per_commitment_point(long arg, long idx); // LDKThirtyTwoBytes LDKChannelKeys_call_release_commitment_secret LDKChannelKeys* arg, uint64_t idx - public static native long LDKChannelKeys_call_release_commitment_secret(long arg, long idx); + public static native byte[] LDKChannelKeys_call_release_commitment_secret(long arg, long idx); // LDKC2Tuple_u64u64Z LDKChannelKeys_call_key_derivation_params LDKChannelKeys* arg public static native long LDKChannelKeys_call_key_derivation_params(long arg); // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ LDKChannelKeys_call_sign_counterparty_commitment LDKChannelKeys* arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs @@ -411,7 +411,7 @@ public class bindings { long get_destination_script(); long get_shutdown_pubkey(); long get_channel_keys(boolean inbound, long channel_value_satoshis); - long get_secure_random_bytes(); + byte[] get_secure_random_bytes(); } public static native long LDKKeysInterface_new(LDKKeysInterface impl); public static native LDKKeysInterface LDKKeysInterface_get_obj_from_jcalls(long val); @@ -424,7 +424,7 @@ public class bindings { // LDKChannelKeys LDKKeysInterface_call_get_channel_keys LDKKeysInterface* arg, bool inbound, uint64_t channel_value_satoshis public static native long LDKKeysInterface_call_get_channel_keys(long arg, boolean inbound, long channel_value_satoshis); // LDKThirtyTwoBytes LDKKeysInterface_call_get_secure_random_bytes LDKKeysInterface* arg - public static native long LDKKeysInterface_call_get_secure_random_bytes(long arg); + public static native byte[] LDKKeysInterface_call_get_secure_random_bytes(long arg); public static native long LDKInMemoryChannelKeys_optional_none(); public static native long LDKKeysManager_optional_none(); public static native long LDKChannelManager_optional_none(); @@ -450,11 +450,11 @@ public class bindings { OnionV2(long addr, short port) { this.addr = addr; this.port = port; } } public final static class OnionV3 extends LDKNetAddress { - public long ed25519_pubkey; + public byte[] ed25519_pubkey; public short checksum; public byte version; public short port; - OnionV3(long ed25519_pubkey, short checksum, byte version, short port) { this.ed25519_pubkey = ed25519_pubkey; this.checksum = checksum; this.version = version; this.port = port; } + OnionV3(byte[] ed25519_pubkey, short checksum, byte version, short port) { this.ed25519_pubkey = ed25519_pubkey; this.checksum = checksum; this.version = version; this.port = port; } } static native void init(); } @@ -782,7 +782,7 @@ public class bindings { // LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b); public static native long C2Tuple_OutPointScriptZ_new(long a, long b); // LDKC2Tuple_TxidCVec_TxOutZZ C2Tuple_TxidCVec_TxOutZZ_new(LDKThirtyTwoBytes a, LDKCVec_TxOutZ b); - public static native long C2Tuple_TxidCVec_TxOutZZ_new(long a, long b); + public static native long C2Tuple_TxidCVec_TxOutZZ_new(byte[] a, long b); // LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); public static native long C2Tuple_u64u64Z_new(long a, long b); // LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(LDKSignature a, LDKCVec_SignatureZ b); @@ -986,15 +986,15 @@ public class bindings { // const uint8_t (*OutPoint_get_txid(const LDKOutPoint *this_ptr))[32]; public static native byte[] OutPoint_get_txid(long this_ptr); // void OutPoint_set_txid(LDKOutPoint *this_ptr, LDKThirtyTwoBytes val); - public static native void OutPoint_set_txid(long this_ptr, long val); + public static native void OutPoint_set_txid(long this_ptr, byte[] val); // uint16_t OutPoint_get_index(const LDKOutPoint *this_ptr); public static native short OutPoint_get_index(long this_ptr); // void OutPoint_set_index(LDKOutPoint *this_ptr, uint16_t val); public static native void OutPoint_set_index(long this_ptr, short val); // MUST_USE_RES LDKOutPoint OutPoint_new(LDKThirtyTwoBytes txid_arg, uint16_t index_arg); - public static native long OutPoint_new(long txid_arg, short index_arg); + public static native long OutPoint_new(byte[] txid_arg, short index_arg); // MUST_USE_RES LDKThirtyTwoBytes OutPoint_to_channel_id(const LDKOutPoint *this_arg); - public static native long OutPoint_to_channel_id(long 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); // LDKOutPoint OutPoint_read(LDKu8slice ser); @@ -1030,9 +1030,9 @@ public class bindings { // const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const LDKInMemoryChannelKeys *this_ptr))[32]; public static native byte[] InMemoryChannelKeys_get_commitment_seed(long this_ptr); // void InMemoryChannelKeys_set_commitment_seed(LDKInMemoryChannelKeys *this_ptr, LDKThirtyTwoBytes val); - public static native void InMemoryChannelKeys_set_commitment_seed(long this_ptr, long val); + public static native void InMemoryChannelKeys_set_commitment_seed(long this_ptr, byte[] val); // MUST_USE_RES LDKInMemoryChannelKeys InMemoryChannelKeys_new(LDKSecretKey funding_key, LDKSecretKey revocation_base_key, LDKSecretKey payment_key, LDKSecretKey delayed_payment_base_key, LDKSecretKey htlc_base_key, LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, LDKC2Tuple_u64u64Z key_derivation_params); - public static native long InMemoryChannelKeys_new(long funding_key, long revocation_base_key, long payment_key, long delayed_payment_base_key, long htlc_base_key, long commitment_seed, long channel_value_satoshis, long key_derivation_params); + public static native long InMemoryChannelKeys_new(long funding_key, long revocation_base_key, long payment_key, long delayed_payment_base_key, long htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, long key_derivation_params); // MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const LDKInMemoryChannelKeys *this_arg); public static native long InMemoryChannelKeys_counterparty_pubkeys(long this_arg); // MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg); @@ -1060,7 +1060,7 @@ public class bindings { // const uint8_t (*ChannelDetails_get_channel_id(const LDKChannelDetails *this_ptr))[32]; public static native byte[] ChannelDetails_get_channel_id(long this_ptr); // void ChannelDetails_set_channel_id(LDKChannelDetails *this_ptr, LDKThirtyTwoBytes val); - public static native void ChannelDetails_set_channel_id(long this_ptr, long val); + public static native void ChannelDetails_set_channel_id(long this_ptr, byte[] val); // LDKPublicKey ChannelDetails_get_remote_network_id(const LDKChannelDetails *this_ptr); public static native long ChannelDetails_get_remote_network_id(long this_ptr); // void ChannelDetails_set_remote_network_id(LDKChannelDetails *this_ptr, LDKPublicKey val); @@ -1106,19 +1106,19 @@ public class bindings { // void ChannelManager_force_close_all_channels(const LDKChannelManager *this_arg); public static native void ChannelManager_force_close_all_channels(long this_arg); // MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const LDKChannelManager *this_arg, const LDKRoute *route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret); - public static native long ChannelManager_send_payment(long this_arg, long route, long payment_hash, long payment_secret); + public static native long ChannelManager_send_payment(long this_arg, long route, byte[] payment_hash, byte[] payment_secret); // void ChannelManager_funding_transaction_generated(const LDKChannelManager *this_arg, const uint8_t (*temporary_channel_id)[32], LDKOutPoint funding_txo); public static native void ChannelManager_funding_transaction_generated(long this_arg, byte[] temporary_channel_id, long funding_txo); // void ChannelManager_broadcast_node_announcement(const LDKChannelManager *this_arg, LDKThreeBytes rgb, LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses); - public static native void ChannelManager_broadcast_node_announcement(long this_arg, long rgb, long alias, long addresses); + public static native void ChannelManager_broadcast_node_announcement(long this_arg, long rgb, byte[] alias, long addresses); // void ChannelManager_process_pending_htlc_forwards(const LDKChannelManager *this_arg); public static native void ChannelManager_process_pending_htlc_forwards(long this_arg); // void ChannelManager_timer_chan_freshness_every_min(const LDKChannelManager *this_arg); public static native void ChannelManager_timer_chan_freshness_every_min(long this_arg); // MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const LDKChannelManager *this_arg, const uint8_t (*payment_hash)[32], LDKThirtyTwoBytes payment_secret); - public static native boolean ChannelManager_fail_htlc_backwards(long this_arg, byte[] payment_hash, long payment_secret); + public static native boolean ChannelManager_fail_htlc_backwards(long this_arg, byte[] payment_hash, byte[] payment_secret); // MUST_USE_RES bool ChannelManager_claim_funds(const LDKChannelManager *this_arg, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_secret, uint64_t expected_amount); - public static native boolean ChannelManager_claim_funds(long this_arg, long payment_preimage, long payment_secret, long expected_amount); + public static native boolean ChannelManager_claim_funds(long this_arg, byte[] payment_preimage, byte[] payment_secret, long expected_amount); // MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager *this_arg); public static native long ChannelManager_get_our_node_id(long this_arg); // void ChannelManager_channel_monitor_updated(const LDKChannelManager *this_arg, const LDKOutPoint *funding_txo, uint64_t highest_applied_update_id); @@ -1170,13 +1170,13 @@ public class bindings { // const uint8_t (*ErrorMessage_get_channel_id(const LDKErrorMessage *this_ptr))[32]; public static native byte[] ErrorMessage_get_channel_id(long this_ptr); // void ErrorMessage_set_channel_id(LDKErrorMessage *this_ptr, LDKThirtyTwoBytes val); - public static native void ErrorMessage_set_channel_id(long this_ptr, long val); + public static native void ErrorMessage_set_channel_id(long this_ptr, byte[] val); // 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); // MUST_USE_RES LDKErrorMessage ErrorMessage_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg); - public static native long ErrorMessage_new(long channel_id_arg, long data_arg); + public static native long ErrorMessage_new(byte[] channel_id_arg, long data_arg); // void Ping_free(LDKPing this_ptr); public static native void Ping_free(long this_ptr); // uint16_t Ping_get_ponglen(const LDKPing *this_ptr); @@ -1202,11 +1202,11 @@ public class bindings { // const uint8_t (*OpenChannel_get_chain_hash(const LDKOpenChannel *this_ptr))[32]; public static native byte[] OpenChannel_get_chain_hash(long this_ptr); // void OpenChannel_set_chain_hash(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val); - public static native void OpenChannel_set_chain_hash(long this_ptr, long val); + public static native void OpenChannel_set_chain_hash(long this_ptr, byte[] val); // const uint8_t (*OpenChannel_get_temporary_channel_id(const LDKOpenChannel *this_ptr))[32]; public static native byte[] OpenChannel_get_temporary_channel_id(long this_ptr); // void OpenChannel_set_temporary_channel_id(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val); - public static native void OpenChannel_set_temporary_channel_id(long this_ptr, long val); + public static native void OpenChannel_set_temporary_channel_id(long this_ptr, byte[] val); // uint64_t OpenChannel_get_funding_satoshis(const LDKOpenChannel *this_ptr); public static native long OpenChannel_get_funding_satoshis(long this_ptr); // void OpenChannel_set_funding_satoshis(LDKOpenChannel *this_ptr, uint64_t val); @@ -1276,7 +1276,7 @@ public class bindings { // const uint8_t (*AcceptChannel_get_temporary_channel_id(const LDKAcceptChannel *this_ptr))[32]; public static native byte[] AcceptChannel_get_temporary_channel_id(long this_ptr); // void AcceptChannel_set_temporary_channel_id(LDKAcceptChannel *this_ptr, LDKThirtyTwoBytes val); - public static native void AcceptChannel_set_temporary_channel_id(long this_ptr, long val); + public static native void AcceptChannel_set_temporary_channel_id(long this_ptr, byte[] val); // uint64_t AcceptChannel_get_dust_limit_satoshis(const LDKAcceptChannel *this_ptr); public static native long AcceptChannel_get_dust_limit_satoshis(long this_ptr); // void AcceptChannel_set_dust_limit_satoshis(LDKAcceptChannel *this_ptr, uint64_t val); @@ -1334,11 +1334,11 @@ public class bindings { // const uint8_t (*FundingCreated_get_temporary_channel_id(const LDKFundingCreated *this_ptr))[32]; public static native byte[] FundingCreated_get_temporary_channel_id(long this_ptr); // void FundingCreated_set_temporary_channel_id(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val); - public static native void FundingCreated_set_temporary_channel_id(long this_ptr, long val); + public static native void FundingCreated_set_temporary_channel_id(long this_ptr, byte[] val); // const uint8_t (*FundingCreated_get_funding_txid(const LDKFundingCreated *this_ptr))[32]; public static native byte[] FundingCreated_get_funding_txid(long this_ptr); // void FundingCreated_set_funding_txid(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val); - public static native void FundingCreated_set_funding_txid(long this_ptr, long val); + public static native void FundingCreated_set_funding_txid(long this_ptr, byte[] val); // uint16_t FundingCreated_get_funding_output_index(const LDKFundingCreated *this_ptr); public static native short FundingCreated_get_funding_output_index(long this_ptr); // void FundingCreated_set_funding_output_index(LDKFundingCreated *this_ptr, uint16_t val); @@ -1348,49 +1348,49 @@ public class bindings { // void FundingCreated_set_signature(LDKFundingCreated *this_ptr, LDKSignature val); public static native void FundingCreated_set_signature(long this_ptr, long val); // MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_channel_id_arg, LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, LDKSignature signature_arg); - public static native long FundingCreated_new(long temporary_channel_id_arg, long funding_txid_arg, short funding_output_index_arg, long signature_arg); + public static native long FundingCreated_new(byte[] temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, long signature_arg); // void FundingSigned_free(LDKFundingSigned this_ptr); public static native void FundingSigned_free(long this_ptr); // const uint8_t (*FundingSigned_get_channel_id(const LDKFundingSigned *this_ptr))[32]; public static native byte[] FundingSigned_get_channel_id(long this_ptr); // void FundingSigned_set_channel_id(LDKFundingSigned *this_ptr, LDKThirtyTwoBytes val); - public static native void FundingSigned_set_channel_id(long this_ptr, long val); + public static native void FundingSigned_set_channel_id(long this_ptr, byte[] val); // LDKSignature FundingSigned_get_signature(const LDKFundingSigned *this_ptr); public static native long FundingSigned_get_signature(long this_ptr); // void FundingSigned_set_signature(LDKFundingSigned *this_ptr, LDKSignature val); public static native void FundingSigned_set_signature(long this_ptr, long val); // MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg); - public static native long FundingSigned_new(long channel_id_arg, long signature_arg); + public static native long FundingSigned_new(byte[] channel_id_arg, long signature_arg); // void FundingLocked_free(LDKFundingLocked this_ptr); public static native void FundingLocked_free(long this_ptr); // const uint8_t (*FundingLocked_get_channel_id(const LDKFundingLocked *this_ptr))[32]; public static native byte[] FundingLocked_get_channel_id(long this_ptr); // void FundingLocked_set_channel_id(LDKFundingLocked *this_ptr, LDKThirtyTwoBytes val); - public static native void FundingLocked_set_channel_id(long this_ptr, long val); + public static native void FundingLocked_set_channel_id(long this_ptr, byte[] val); // LDKPublicKey FundingLocked_get_next_per_commitment_point(const LDKFundingLocked *this_ptr); public static native long FundingLocked_get_next_per_commitment_point(long this_ptr); // void FundingLocked_set_next_per_commitment_point(LDKFundingLocked *this_ptr, LDKPublicKey val); public static native void FundingLocked_set_next_per_commitment_point(long this_ptr, long val); // MUST_USE_RES LDKFundingLocked FundingLocked_new(LDKThirtyTwoBytes channel_id_arg, LDKPublicKey next_per_commitment_point_arg); - public static native long FundingLocked_new(long channel_id_arg, long next_per_commitment_point_arg); + public static native long FundingLocked_new(byte[] channel_id_arg, long next_per_commitment_point_arg); // void Shutdown_free(LDKShutdown this_ptr); public static native void Shutdown_free(long this_ptr); // const uint8_t (*Shutdown_get_channel_id(const LDKShutdown *this_ptr))[32]; public static native byte[] Shutdown_get_channel_id(long this_ptr); // void Shutdown_set_channel_id(LDKShutdown *this_ptr, LDKThirtyTwoBytes val); - public static native void Shutdown_set_channel_id(long this_ptr, long val); + public static native void Shutdown_set_channel_id(long this_ptr, byte[] val); // LDKu8slice Shutdown_get_scriptpubkey(const LDKShutdown *this_ptr); public static native long 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); // MUST_USE_RES LDKShutdown Shutdown_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg); - public static native long Shutdown_new(long channel_id_arg, long scriptpubkey_arg); + public static native long Shutdown_new(byte[] channel_id_arg, long scriptpubkey_arg); // void ClosingSigned_free(LDKClosingSigned this_ptr); public static native void ClosingSigned_free(long this_ptr); // const uint8_t (*ClosingSigned_get_channel_id(const LDKClosingSigned *this_ptr))[32]; public static native byte[] ClosingSigned_get_channel_id(long this_ptr); // void ClosingSigned_set_channel_id(LDKClosingSigned *this_ptr, LDKThirtyTwoBytes val); - public static native void ClosingSigned_set_channel_id(long this_ptr, long val); + public static native void ClosingSigned_set_channel_id(long this_ptr, byte[] val); // uint64_t ClosingSigned_get_fee_satoshis(const LDKClosingSigned *this_ptr); public static native long ClosingSigned_get_fee_satoshis(long this_ptr); // void ClosingSigned_set_fee_satoshis(LDKClosingSigned *this_ptr, uint64_t val); @@ -1400,13 +1400,13 @@ public class bindings { // void ClosingSigned_set_signature(LDKClosingSigned *this_ptr, LDKSignature val); public static native void ClosingSigned_set_signature(long this_ptr, long val); // MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, LDKSignature signature_arg); - public static native long ClosingSigned_new(long channel_id_arg, long fee_satoshis_arg, long signature_arg); + public static native long ClosingSigned_new(byte[] channel_id_arg, long fee_satoshis_arg, long signature_arg); // void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr); public static native void UpdateAddHTLC_free(long this_ptr); // const uint8_t (*UpdateAddHTLC_get_channel_id(const LDKUpdateAddHTLC *this_ptr))[32]; public static native byte[] UpdateAddHTLC_get_channel_id(long this_ptr); // void UpdateAddHTLC_set_channel_id(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val); - public static native void UpdateAddHTLC_set_channel_id(long this_ptr, long val); + public static native void UpdateAddHTLC_set_channel_id(long this_ptr, byte[] val); // uint64_t UpdateAddHTLC_get_htlc_id(const LDKUpdateAddHTLC *this_ptr); public static native long UpdateAddHTLC_get_htlc_id(long this_ptr); // void UpdateAddHTLC_set_htlc_id(LDKUpdateAddHTLC *this_ptr, uint64_t val); @@ -1418,7 +1418,7 @@ public class bindings { // const uint8_t (*UpdateAddHTLC_get_payment_hash(const LDKUpdateAddHTLC *this_ptr))[32]; public static native byte[] UpdateAddHTLC_get_payment_hash(long this_ptr); // void UpdateAddHTLC_set_payment_hash(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val); - public static native void UpdateAddHTLC_set_payment_hash(long this_ptr, long val); + public static native void UpdateAddHTLC_set_payment_hash(long this_ptr, byte[] val); // uint32_t UpdateAddHTLC_get_cltv_expiry(const LDKUpdateAddHTLC *this_ptr); public static native int UpdateAddHTLC_get_cltv_expiry(long this_ptr); // void UpdateAddHTLC_set_cltv_expiry(LDKUpdateAddHTLC *this_ptr, uint32_t val); @@ -1428,7 +1428,7 @@ public class bindings { // const uint8_t (*UpdateFulfillHTLC_get_channel_id(const LDKUpdateFulfillHTLC *this_ptr))[32]; public static native byte[] UpdateFulfillHTLC_get_channel_id(long this_ptr); // void UpdateFulfillHTLC_set_channel_id(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val); - public static native void UpdateFulfillHTLC_set_channel_id(long this_ptr, long val); + public static native void UpdateFulfillHTLC_set_channel_id(long this_ptr, byte[] val); // uint64_t UpdateFulfillHTLC_get_htlc_id(const LDKUpdateFulfillHTLC *this_ptr); public static native long UpdateFulfillHTLC_get_htlc_id(long this_ptr); // void UpdateFulfillHTLC_set_htlc_id(LDKUpdateFulfillHTLC *this_ptr, uint64_t val); @@ -1436,15 +1436,15 @@ public class bindings { // const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const LDKUpdateFulfillHTLC *this_ptr))[32]; public static native byte[] UpdateFulfillHTLC_get_payment_preimage(long this_ptr); // void UpdateFulfillHTLC_set_payment_preimage(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val); - public static native void UpdateFulfillHTLC_set_payment_preimage(long this_ptr, long val); + public static native void UpdateFulfillHTLC_set_payment_preimage(long this_ptr, byte[] val); // MUST_USE_RES LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, LDKThirtyTwoBytes payment_preimage_arg); - public static native long UpdateFulfillHTLC_new(long channel_id_arg, long htlc_id_arg, long payment_preimage_arg); + public static native long UpdateFulfillHTLC_new(byte[] channel_id_arg, long htlc_id_arg, byte[] payment_preimage_arg); // void UpdateFailHTLC_free(LDKUpdateFailHTLC this_ptr); public static native void UpdateFailHTLC_free(long this_ptr); // const uint8_t (*UpdateFailHTLC_get_channel_id(const LDKUpdateFailHTLC *this_ptr))[32]; public static native byte[] UpdateFailHTLC_get_channel_id(long this_ptr); // void UpdateFailHTLC_set_channel_id(LDKUpdateFailHTLC *this_ptr, LDKThirtyTwoBytes val); - public static native void UpdateFailHTLC_set_channel_id(long this_ptr, long val); + public static native void UpdateFailHTLC_set_channel_id(long this_ptr, byte[] val); // uint64_t UpdateFailHTLC_get_htlc_id(const LDKUpdateFailHTLC *this_ptr); public static native long UpdateFailHTLC_get_htlc_id(long this_ptr); // void UpdateFailHTLC_set_htlc_id(LDKUpdateFailHTLC *this_ptr, uint64_t val); @@ -1454,7 +1454,7 @@ public class bindings { // const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const LDKUpdateFailMalformedHTLC *this_ptr))[32]; public static native byte[] UpdateFailMalformedHTLC_get_channel_id(long this_ptr); // void UpdateFailMalformedHTLC_set_channel_id(LDKUpdateFailMalformedHTLC *this_ptr, LDKThirtyTwoBytes val); - public static native void UpdateFailMalformedHTLC_set_channel_id(long this_ptr, long val); + public static native void UpdateFailMalformedHTLC_set_channel_id(long this_ptr, byte[] val); // uint64_t UpdateFailMalformedHTLC_get_htlc_id(const LDKUpdateFailMalformedHTLC *this_ptr); public static native long UpdateFailMalformedHTLC_get_htlc_id(long this_ptr); // void UpdateFailMalformedHTLC_set_htlc_id(LDKUpdateFailMalformedHTLC *this_ptr, uint64_t val); @@ -1468,7 +1468,7 @@ public class bindings { // const uint8_t (*CommitmentSigned_get_channel_id(const LDKCommitmentSigned *this_ptr))[32]; public static native byte[] CommitmentSigned_get_channel_id(long this_ptr); // void CommitmentSigned_set_channel_id(LDKCommitmentSigned *this_ptr, LDKThirtyTwoBytes val); - public static native void CommitmentSigned_set_channel_id(long this_ptr, long val); + public static native void CommitmentSigned_set_channel_id(long this_ptr, byte[] val); // LDKSignature CommitmentSigned_get_signature(const LDKCommitmentSigned *this_ptr); public static native long CommitmentSigned_get_signature(long this_ptr); // void CommitmentSigned_set_signature(LDKCommitmentSigned *this_ptr, LDKSignature val); @@ -1476,53 +1476,53 @@ public class bindings { // void CommitmentSigned_set_htlc_signatures(LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val); public static native void CommitmentSigned_set_htlc_signatures(long this_ptr, long val); // MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg); - public static native long CommitmentSigned_new(long channel_id_arg, long signature_arg, long htlc_signatures_arg); + public static native long CommitmentSigned_new(byte[] channel_id_arg, long signature_arg, long htlc_signatures_arg); // void RevokeAndACK_free(LDKRevokeAndACK this_ptr); public static native void RevokeAndACK_free(long this_ptr); // const uint8_t (*RevokeAndACK_get_channel_id(const LDKRevokeAndACK *this_ptr))[32]; public static native byte[] RevokeAndACK_get_channel_id(long this_ptr); // void RevokeAndACK_set_channel_id(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val); - public static native void RevokeAndACK_set_channel_id(long this_ptr, long val); + public static native void RevokeAndACK_set_channel_id(long this_ptr, byte[] val); // const uint8_t (*RevokeAndACK_get_per_commitment_secret(const LDKRevokeAndACK *this_ptr))[32]; public static native byte[] RevokeAndACK_get_per_commitment_secret(long this_ptr); // void RevokeAndACK_set_per_commitment_secret(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val); - public static native void RevokeAndACK_set_per_commitment_secret(long this_ptr, long val); + public static native void RevokeAndACK_set_per_commitment_secret(long this_ptr, byte[] val); // LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const LDKRevokeAndACK *this_ptr); public static native long RevokeAndACK_get_next_per_commitment_point(long this_ptr); // void RevokeAndACK_set_next_per_commitment_point(LDKRevokeAndACK *this_ptr, LDKPublicKey val); public static native void RevokeAndACK_set_next_per_commitment_point(long this_ptr, long val); // MUST_USE_RES LDKRevokeAndACK RevokeAndACK_new(LDKThirtyTwoBytes channel_id_arg, LDKThirtyTwoBytes per_commitment_secret_arg, LDKPublicKey next_per_commitment_point_arg); - public static native long RevokeAndACK_new(long channel_id_arg, long per_commitment_secret_arg, long next_per_commitment_point_arg); + public static native long RevokeAndACK_new(byte[] channel_id_arg, byte[] per_commitment_secret_arg, long next_per_commitment_point_arg); // void UpdateFee_free(LDKUpdateFee this_ptr); public static native void UpdateFee_free(long this_ptr); // const uint8_t (*UpdateFee_get_channel_id(const LDKUpdateFee *this_ptr))[32]; public static native byte[] UpdateFee_get_channel_id(long this_ptr); // void UpdateFee_set_channel_id(LDKUpdateFee *this_ptr, LDKThirtyTwoBytes val); - public static native void UpdateFee_set_channel_id(long this_ptr, long val); + public static native void UpdateFee_set_channel_id(long this_ptr, byte[] val); // uint32_t UpdateFee_get_feerate_per_kw(const LDKUpdateFee *this_ptr); public static native int UpdateFee_get_feerate_per_kw(long this_ptr); // void UpdateFee_set_feerate_per_kw(LDKUpdateFee *this_ptr, uint32_t val); public static native void UpdateFee_set_feerate_per_kw(long this_ptr, int val); // MUST_USE_RES LDKUpdateFee UpdateFee_new(LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); - public static native long UpdateFee_new(long channel_id_arg, int feerate_per_kw_arg); + public static native long UpdateFee_new(byte[] channel_id_arg, int feerate_per_kw_arg); // void DataLossProtect_free(LDKDataLossProtect this_ptr); public static native void DataLossProtect_free(long this_ptr); // const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const LDKDataLossProtect *this_ptr))[32]; public static native byte[] DataLossProtect_get_your_last_per_commitment_secret(long this_ptr); // void DataLossProtect_set_your_last_per_commitment_secret(LDKDataLossProtect *this_ptr, LDKThirtyTwoBytes val); - public static native void DataLossProtect_set_your_last_per_commitment_secret(long this_ptr, long val); + public static native void DataLossProtect_set_your_last_per_commitment_secret(long this_ptr, byte[] val); // LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const LDKDataLossProtect *this_ptr); public static native long DataLossProtect_get_my_current_per_commitment_point(long this_ptr); // void DataLossProtect_set_my_current_per_commitment_point(LDKDataLossProtect *this_ptr, LDKPublicKey val); public static native void DataLossProtect_set_my_current_per_commitment_point(long this_ptr, long val); // MUST_USE_RES LDKDataLossProtect DataLossProtect_new(LDKThirtyTwoBytes your_last_per_commitment_secret_arg, LDKPublicKey my_current_per_commitment_point_arg); - public static native long DataLossProtect_new(long your_last_per_commitment_secret_arg, long my_current_per_commitment_point_arg); + public static native long DataLossProtect_new(byte[] your_last_per_commitment_secret_arg, long my_current_per_commitment_point_arg); // void ChannelReestablish_free(LDKChannelReestablish this_ptr); public static native void ChannelReestablish_free(long this_ptr); // const uint8_t (*ChannelReestablish_get_channel_id(const LDKChannelReestablish *this_ptr))[32]; public static native byte[] ChannelReestablish_get_channel_id(long this_ptr); // void ChannelReestablish_set_channel_id(LDKChannelReestablish *this_ptr, LDKThirtyTwoBytes val); - public static native void ChannelReestablish_set_channel_id(long this_ptr, long val); + public static native void ChannelReestablish_set_channel_id(long this_ptr, byte[] val); // uint64_t ChannelReestablish_get_next_local_commitment_number(const LDKChannelReestablish *this_ptr); public static native long ChannelReestablish_get_next_local_commitment_number(long this_ptr); // void ChannelReestablish_set_next_local_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val); @@ -1536,7 +1536,7 @@ public class bindings { // const uint8_t (*AnnouncementSignatures_get_channel_id(const LDKAnnouncementSignatures *this_ptr))[32]; public static native byte[] AnnouncementSignatures_get_channel_id(long this_ptr); // void AnnouncementSignatures_set_channel_id(LDKAnnouncementSignatures *this_ptr, LDKThirtyTwoBytes val); - public static native void AnnouncementSignatures_set_channel_id(long this_ptr, long val); + public static native void AnnouncementSignatures_set_channel_id(long this_ptr, byte[] val); // uint64_t AnnouncementSignatures_get_short_channel_id(const LDKAnnouncementSignatures *this_ptr); public static native long AnnouncementSignatures_get_short_channel_id(long this_ptr); // void AnnouncementSignatures_set_short_channel_id(LDKAnnouncementSignatures *this_ptr, uint64_t val); @@ -1550,7 +1550,7 @@ public class bindings { // void AnnouncementSignatures_set_bitcoin_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val); public static native void AnnouncementSignatures_set_bitcoin_signature(long this_ptr, long val); // MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, LDKSignature node_signature_arg, LDKSignature bitcoin_signature_arg); - public static native long AnnouncementSignatures_new(long channel_id_arg, long short_channel_id_arg, long node_signature_arg, long bitcoin_signature_arg); + public static native long AnnouncementSignatures_new(byte[] channel_id_arg, long short_channel_id_arg, long node_signature_arg, long bitcoin_signature_arg); // void NetAddress_free(LDKNetAddress this_ptr); public static native void NetAddress_free(long this_ptr); // void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr); @@ -1574,7 +1574,7 @@ public class bindings { // const uint8_t (*UnsignedNodeAnnouncement_get_alias(const LDKUnsignedNodeAnnouncement *this_ptr))[32]; public static native byte[] UnsignedNodeAnnouncement_get_alias(long this_ptr); // void UnsignedNodeAnnouncement_set_alias(LDKUnsignedNodeAnnouncement *this_ptr, LDKThirtyTwoBytes val); - public static native void UnsignedNodeAnnouncement_set_alias(long this_ptr, long val); + public static native void UnsignedNodeAnnouncement_set_alias(long this_ptr, byte[] val); // void UnsignedNodeAnnouncement_set_addresses(LDKUnsignedNodeAnnouncement *this_ptr, LDKCVec_NetAddressZ val); public static native void UnsignedNodeAnnouncement_set_addresses(long this_ptr, long val); // void NodeAnnouncement_free(LDKNodeAnnouncement this_ptr); @@ -1598,7 +1598,7 @@ public class bindings { // const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const LDKUnsignedChannelAnnouncement *this_ptr))[32]; public static native byte[] UnsignedChannelAnnouncement_get_chain_hash(long this_ptr); // void UnsignedChannelAnnouncement_set_chain_hash(LDKUnsignedChannelAnnouncement *this_ptr, LDKThirtyTwoBytes val); - public static native void UnsignedChannelAnnouncement_set_chain_hash(long this_ptr, long val); + public static native void UnsignedChannelAnnouncement_set_chain_hash(long this_ptr, byte[] val); // uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const LDKUnsignedChannelAnnouncement *this_ptr); public static native long UnsignedChannelAnnouncement_get_short_channel_id(long this_ptr); // void UnsignedChannelAnnouncement_set_short_channel_id(LDKUnsignedChannelAnnouncement *this_ptr, uint64_t val); @@ -1648,7 +1648,7 @@ public class bindings { // const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const LDKUnsignedChannelUpdate *this_ptr))[32]; public static native byte[] UnsignedChannelUpdate_get_chain_hash(long this_ptr); // void UnsignedChannelUpdate_set_chain_hash(LDKUnsignedChannelUpdate *this_ptr, LDKThirtyTwoBytes val); - public static native void UnsignedChannelUpdate_set_chain_hash(long this_ptr, long val); + public static native void UnsignedChannelUpdate_set_chain_hash(long this_ptr, byte[] val); // uint64_t UnsignedChannelUpdate_get_short_channel_id(const LDKUnsignedChannelUpdate *this_ptr); public static native long UnsignedChannelUpdate_get_short_channel_id(long this_ptr); // void UnsignedChannelUpdate_set_short_channel_id(LDKUnsignedChannelUpdate *this_ptr, uint64_t val); @@ -1694,7 +1694,7 @@ public class bindings { // const uint8_t (*QueryChannelRange_get_chain_hash(const LDKQueryChannelRange *this_ptr))[32]; public static native byte[] QueryChannelRange_get_chain_hash(long this_ptr); // void QueryChannelRange_set_chain_hash(LDKQueryChannelRange *this_ptr, LDKThirtyTwoBytes val); - public static native void QueryChannelRange_set_chain_hash(long this_ptr, long val); + public static native void QueryChannelRange_set_chain_hash(long this_ptr, byte[] val); // uint32_t QueryChannelRange_get_first_blocknum(const LDKQueryChannelRange *this_ptr); public static native int QueryChannelRange_get_first_blocknum(long this_ptr); // void QueryChannelRange_set_first_blocknum(LDKQueryChannelRange *this_ptr, uint32_t val); @@ -1704,13 +1704,13 @@ public class bindings { // void QueryChannelRange_set_number_of_blocks(LDKQueryChannelRange *this_ptr, uint32_t val); public static native void QueryChannelRange_set_number_of_blocks(long this_ptr, int val); // MUST_USE_RES LDKQueryChannelRange QueryChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); - public static native long QueryChannelRange_new(long chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg); + public static native long QueryChannelRange_new(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg); // void ReplyChannelRange_free(LDKReplyChannelRange this_ptr); public static native void ReplyChannelRange_free(long this_ptr); // const uint8_t (*ReplyChannelRange_get_chain_hash(const LDKReplyChannelRange *this_ptr))[32]; public static native byte[] ReplyChannelRange_get_chain_hash(long this_ptr); // void ReplyChannelRange_set_chain_hash(LDKReplyChannelRange *this_ptr, LDKThirtyTwoBytes val); - public static native void ReplyChannelRange_set_chain_hash(long this_ptr, long val); + public static native void ReplyChannelRange_set_chain_hash(long this_ptr, byte[] val); // uint32_t ReplyChannelRange_get_first_blocknum(const LDKReplyChannelRange *this_ptr); public static native int ReplyChannelRange_get_first_blocknum(long this_ptr); // void ReplyChannelRange_set_first_blocknum(LDKReplyChannelRange *this_ptr, uint32_t val); @@ -1726,35 +1726,35 @@ public class bindings { // void ReplyChannelRange_set_short_channel_ids(LDKReplyChannelRange *this_ptr, LDKCVec_u64Z val); public static native void ReplyChannelRange_set_short_channel_ids(long this_ptr, long val); // MUST_USE_RES LDKReplyChannelRange ReplyChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, LDKCVec_u64Z short_channel_ids_arg); - public static native long ReplyChannelRange_new(long chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg, boolean full_information_arg, long short_channel_ids_arg); + public static native long ReplyChannelRange_new(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg, boolean full_information_arg, long short_channel_ids_arg); // void QueryShortChannelIds_free(LDKQueryShortChannelIds this_ptr); public static native void QueryShortChannelIds_free(long this_ptr); // const uint8_t (*QueryShortChannelIds_get_chain_hash(const LDKQueryShortChannelIds *this_ptr))[32]; public static native byte[] QueryShortChannelIds_get_chain_hash(long this_ptr); // void QueryShortChannelIds_set_chain_hash(LDKQueryShortChannelIds *this_ptr, LDKThirtyTwoBytes val); - public static native void QueryShortChannelIds_set_chain_hash(long this_ptr, long val); + public static native void QueryShortChannelIds_set_chain_hash(long this_ptr, byte[] val); // void QueryShortChannelIds_set_short_channel_ids(LDKQueryShortChannelIds *this_ptr, LDKCVec_u64Z val); public static native void QueryShortChannelIds_set_short_channel_ids(long this_ptr, long val); // MUST_USE_RES LDKQueryShortChannelIds QueryShortChannelIds_new(LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg); - public static native long QueryShortChannelIds_new(long chain_hash_arg, long short_channel_ids_arg); + public static native long QueryShortChannelIds_new(byte[] chain_hash_arg, long short_channel_ids_arg); // void ReplyShortChannelIdsEnd_free(LDKReplyShortChannelIdsEnd this_ptr); public static native void ReplyShortChannelIdsEnd_free(long this_ptr); // const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const LDKReplyShortChannelIdsEnd *this_ptr))[32]; public static native byte[] ReplyShortChannelIdsEnd_get_chain_hash(long this_ptr); // void ReplyShortChannelIdsEnd_set_chain_hash(LDKReplyShortChannelIdsEnd *this_ptr, LDKThirtyTwoBytes val); - public static native void ReplyShortChannelIdsEnd_set_chain_hash(long this_ptr, long val); + public static native void ReplyShortChannelIdsEnd_set_chain_hash(long this_ptr, byte[] val); // bool ReplyShortChannelIdsEnd_get_full_information(const LDKReplyShortChannelIdsEnd *this_ptr); public static native boolean ReplyShortChannelIdsEnd_get_full_information(long this_ptr); // void ReplyShortChannelIdsEnd_set_full_information(LDKReplyShortChannelIdsEnd *this_ptr, bool val); public static native void ReplyShortChannelIdsEnd_set_full_information(long this_ptr, boolean val); // MUST_USE_RES LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); - public static native long ReplyShortChannelIdsEnd_new(long chain_hash_arg, boolean full_information_arg); + public static native long ReplyShortChannelIdsEnd_new(byte[] chain_hash_arg, boolean full_information_arg); // void GossipTimestampFilter_free(LDKGossipTimestampFilter this_ptr); public static native void GossipTimestampFilter_free(long this_ptr); // const uint8_t (*GossipTimestampFilter_get_chain_hash(const LDKGossipTimestampFilter *this_ptr))[32]; public static native byte[] GossipTimestampFilter_get_chain_hash(long this_ptr); // void GossipTimestampFilter_set_chain_hash(LDKGossipTimestampFilter *this_ptr, LDKThirtyTwoBytes val); - public static native void GossipTimestampFilter_set_chain_hash(long this_ptr, long val); + public static native void GossipTimestampFilter_set_chain_hash(long this_ptr, byte[] val); // uint32_t GossipTimestampFilter_get_first_timestamp(const LDKGossipTimestampFilter *this_ptr); public static native int GossipTimestampFilter_get_first_timestamp(long this_ptr); // void GossipTimestampFilter_set_first_timestamp(LDKGossipTimestampFilter *this_ptr, uint32_t val); @@ -1764,7 +1764,7 @@ public class bindings { // void GossipTimestampFilter_set_timestamp_range(LDKGossipTimestampFilter *this_ptr, uint32_t val); public static native void GossipTimestampFilter_set_timestamp_range(long this_ptr, int val); // MUST_USE_RES LDKGossipTimestampFilter GossipTimestampFilter_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); - public static native long GossipTimestampFilter_new(long chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg); + public static native long GossipTimestampFilter_new(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg); // void ErrorAction_free(LDKErrorAction this_ptr); public static native void ErrorAction_free(long this_ptr); // void LightningError_free(LDKLightningError this_ptr); @@ -1972,7 +1972,7 @@ public class bindings { // void PeerManager_timer_tick_occured(const LDKPeerManager *this_arg); public static native void PeerManager_timer_tick_occured(long this_arg); // LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); - public static native long build_commitment_secret(byte[] commitment_seed, long idx); + public static native byte[] build_commitment_secret(byte[] commitment_seed, long idx); // LDKCResult_SecretKeySecpErrorZ derive_private_key(LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); public static native long derive_private_key(long per_commitment_point, byte[] base_secret); // LDKCResult_PublicKeySecpErrorZ derive_public_key(LDKPublicKey per_commitment_point, LDKPublicKey base_point); @@ -2066,7 +2066,7 @@ public class bindings { // const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const LDKHTLCOutputInCommitment *this_ptr))[32]; public static native byte[] HTLCOutputInCommitment_get_payment_hash(long this_ptr); // void HTLCOutputInCommitment_set_payment_hash(LDKHTLCOutputInCommitment *this_ptr, LDKThirtyTwoBytes val); - public static native void HTLCOutputInCommitment_set_payment_hash(long this_ptr, long 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); // LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser); @@ -2098,7 +2098,7 @@ public class bindings { // MUST_USE_RES LDKTxCreationKeys HolderCommitmentTransaction_trust_key_derivation(const LDKHolderCommitmentTransaction *this_arg); public static native long HolderCommitmentTransaction_trust_key_derivation(long this_arg); // MUST_USE_RES LDKThirtyTwoBytes HolderCommitmentTransaction_txid(const LDKHolderCommitmentTransaction *this_arg); - public static native long HolderCommitmentTransaction_txid(long this_arg); + public static native byte[] HolderCommitmentTransaction_txid(long this_arg); // MUST_USE_RES LDKSignature HolderCommitmentTransaction_get_holder_sig(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*funding_key)[32], LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); public static native long HolderCommitmentTransaction_get_holder_sig(long this_arg, byte[] funding_key, long funding_redeemscript, long channel_value_satoshis); // 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); @@ -2282,7 +2282,7 @@ public class bindings { // const uint8_t (*NodeAnnouncementInfo_get_alias(const LDKNodeAnnouncementInfo *this_ptr))[32]; public static native byte[] NodeAnnouncementInfo_get_alias(long this_ptr); // void NodeAnnouncementInfo_set_alias(LDKNodeAnnouncementInfo *this_ptr, LDKThirtyTwoBytes val); - public static native void NodeAnnouncementInfo_set_alias(long this_ptr, long val); + public static native void NodeAnnouncementInfo_set_alias(long this_ptr, byte[] val); // void NodeAnnouncementInfo_set_addresses(LDKNodeAnnouncementInfo *this_ptr, LDKCVec_NetAddressZ val); public static native void NodeAnnouncementInfo_set_addresses(long this_ptr, long val); // LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeAnnouncementInfo *this_ptr); @@ -2290,7 +2290,7 @@ public class bindings { // void NodeAnnouncementInfo_set_announcement_message(LDKNodeAnnouncementInfo *this_ptr, LDKNodeAnnouncement val); public static native void NodeAnnouncementInfo_set_announcement_message(long this_ptr, long val); // 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, long rgb_arg, long alias_arg, long addresses_arg, long announcement_message_arg); + public static native long NodeAnnouncementInfo_new(long features_arg, int last_update_arg, long 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); // LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser); diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 0db3084f..6348b72d 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -476,24 +476,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv 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: - return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, - (long)&obj->api_misuse_error.err - ); - case LDKAPIError_FeeRateTooHigh: - return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, - (long)&obj->fee_rate_too_high.err, obj->fee_rate_too_high.feerate - ); - case LDKAPIError_RouteError: - return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, - (long)&obj->route_error.err - ); - case LDKAPIError_ChannelUnavailable: - return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, - (long)&obj->channel_unavailable.err - ); - case LDKAPIError_MonitorUpdateFailed: + case LDKAPIError_APIMisuseError: { + long err_ref = (long)&obj->api_misuse_error.err; + return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref); + } + 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); + } + case LDKAPIError_RouteError: { + long err_ref = (long)&obj->route_error.err; + 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); + } + case LDKAPIError_MonitorUpdateFailed: { return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth); + } default: abort(); } } @@ -578,18 +579,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescrip 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: - return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, - (long)&obj->static_output.outpoint, (long)&obj->static_output.output - ); - case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: - return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, - (long)&obj->dynamic_output_p2wsh.outpoint, (long)&obj->dynamic_output_p2wsh.per_commitment_point, obj->dynamic_output_p2wsh.to_self_delay, (long)&obj->dynamic_output_p2wsh.output, (long)&obj->dynamic_output_p2wsh.key_derivation_params, (long)&obj->dynamic_output_p2wsh.revocation_pubkey - ); - case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: - return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, - (long)&obj->static_output_counterparty_payment.outpoint, (long)&obj->static_output_counterparty_payment.output, (long)&obj->static_output_counterparty_payment.key_derivation_params - ); + case LDKSpendableOutputDescriptor_StaticOutput: { + long outpoint_ref = (long)&obj->static_output.outpoint; + long output_ref = (long)&obj->static_output.output; + return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref); + } + case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: { + long outpoint_ref = (long)&obj->dynamic_output_p2wsh.outpoint; + long per_commitment_point_ref = (long)&obj->dynamic_output_p2wsh.per_commitment_point; + long output_ref = (long)&obj->dynamic_output_p2wsh.output; + long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params; + long revocation_pubkey_ref = (long)&obj->dynamic_output_p2wsh.revocation_pubkey; + return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_ref, obj->dynamic_output_p2wsh.to_self_delay, output_ref, key_derivation_params_ref, revocation_pubkey_ref); + } + case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: { + long outpoint_ref = (long)&obj->static_output_counterparty_payment.outpoint; + 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); + } default: abort(); } } @@ -615,7 +623,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;")); DO_ASSERT(LDKEvent_FundingGenerationReady_class != NULL); - LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "", "(JJJJ)V"); + LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "", "([BJJJ)V"); DO_ASSERT(LDKEvent_FundingGenerationReady_meth != NULL); LDKEvent_FundingBroadcastSafe_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;")); @@ -625,17 +633,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * e LDKEvent_PaymentReceived_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;")); DO_ASSERT(LDKEvent_PaymentReceived_class != NULL); - LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "", "(JJJ)V"); + LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "", "([B[BJ)V"); DO_ASSERT(LDKEvent_PaymentReceived_meth != NULL); LDKEvent_PaymentSent_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;")); DO_ASSERT(LDKEvent_PaymentSent_class != NULL); - LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "(J)V"); + LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B)V"); DO_ASSERT(LDKEvent_PaymentSent_meth != NULL); LDKEvent_PaymentFailed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;")); DO_ASSERT(LDKEvent_PaymentFailed_class != NULL); - LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "", "(JZ)V"); + LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "", "([BZ)V"); DO_ASSERT(LDKEvent_PaymentFailed_meth != NULL); LDKEvent_PendingHTLCsForwardable_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;")); @@ -651,34 +659,40 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * e 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: - return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, - (long)&obj->funding_generation_ready.temporary_channel_id, obj->funding_generation_ready.channel_value_satoshis, (long)&obj->funding_generation_ready.output_script, obj->funding_generation_ready.user_channel_id - ); - case LDKEvent_FundingBroadcastSafe: - return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, - (long)&obj->funding_broadcast_safe.funding_txo, obj->funding_broadcast_safe.user_channel_id - ); - case LDKEvent_PaymentReceived: - return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, - (long)&obj->payment_received.payment_hash, (long)&obj->payment_received.payment_secret, obj->payment_received.amt - ); - case LDKEvent_PaymentSent: - return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, - (long)&obj->payment_sent.payment_preimage - ); - case LDKEvent_PaymentFailed: - return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, - (long)&obj->payment_failed.payment_hash, 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 - ); - case LDKEvent_SpendableOutputs: - return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, - (long)&obj->spendable_outputs.outputs - ); + 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); + } + case LDKEvent_FundingBroadcastSafe: { + long funding_txo_ref = (long)&obj->funding_broadcast_safe.funding_txo; + 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); + } + 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); + } + 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); + } + case LDKEvent_PendingHTLCsForwardable: { + 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); + } default: abort(); } } @@ -773,16 +787,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIE 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: - return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, - (long)&obj->disconnect_peer.msg - ); - case LDKErrorAction_IgnoreError: + case LDKErrorAction_DisconnectPeer: { + long msg_ref = (long)&obj->disconnect_peer.msg; + 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); - case LDKErrorAction_SendErrorMessage: - return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, - (long)&obj->send_error_message.msg - ); + } + case LDKErrorAction_SendErrorMessage: { + long msg_ref = (long)&obj->send_error_message.msg; + return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref); + } default: abort(); } } @@ -812,18 +827,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_ 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: - return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, - (long)&obj->channel_update_message.msg - ); - case LDKHTLCFailChannelUpdate_ChannelClosed: - return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, - obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent - ); - case LDKHTLCFailChannelUpdate_NodeFailure: - return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, - (long)&obj->node_failure.node_id, obj->node_failure.is_permanent - ); + case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: { + long msg_ref = (long)&obj->channel_update_message.msg; + 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); + } + case LDKHTLCFailChannelUpdate_NodeFailure: { + long node_id_ref = (long)&obj->node_failure.node_id; + return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_ref, obj->node_failure.is_permanent); + } default: abort(); } } @@ -944,70 +958,83 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init 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: - return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, - (long)&obj->send_accept_channel.node_id, (long)&obj->send_accept_channel.msg - ); - case LDKMessageSendEvent_SendOpenChannel: - return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, - (long)&obj->send_open_channel.node_id, (long)&obj->send_open_channel.msg - ); - case LDKMessageSendEvent_SendFundingCreated: - return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, - (long)&obj->send_funding_created.node_id, (long)&obj->send_funding_created.msg - ); - case LDKMessageSendEvent_SendFundingSigned: - return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, - (long)&obj->send_funding_signed.node_id, (long)&obj->send_funding_signed.msg - ); - case LDKMessageSendEvent_SendFundingLocked: - return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, - (long)&obj->send_funding_locked.node_id, (long)&obj->send_funding_locked.msg - ); - case LDKMessageSendEvent_SendAnnouncementSignatures: - return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, - (long)&obj->send_announcement_signatures.node_id, (long)&obj->send_announcement_signatures.msg - ); - case LDKMessageSendEvent_UpdateHTLCs: - return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, - (long)&obj->update_htl_cs.node_id, (long)&obj->update_htl_cs.updates - ); - case LDKMessageSendEvent_SendRevokeAndACK: - return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, - (long)&obj->send_revoke_and_ack.node_id, (long)&obj->send_revoke_and_ack.msg - ); - case LDKMessageSendEvent_SendClosingSigned: - return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, - (long)&obj->send_closing_signed.node_id, (long)&obj->send_closing_signed.msg - ); - case LDKMessageSendEvent_SendShutdown: - return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, - (long)&obj->send_shutdown.node_id, (long)&obj->send_shutdown.msg - ); - case LDKMessageSendEvent_SendChannelReestablish: - return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, - (long)&obj->send_channel_reestablish.node_id, (long)&obj->send_channel_reestablish.msg - ); - case LDKMessageSendEvent_BroadcastChannelAnnouncement: - return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, - (long)&obj->broadcast_channel_announcement.msg, (long)&obj->broadcast_channel_announcement.update_msg - ); - case LDKMessageSendEvent_BroadcastNodeAnnouncement: - return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, - (long)&obj->broadcast_node_announcement.msg - ); - case LDKMessageSendEvent_BroadcastChannelUpdate: - return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, - (long)&obj->broadcast_channel_update.msg - ); - case LDKMessageSendEvent_HandleError: - return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, - (long)&obj->handle_error.node_id, (long)&obj->handle_error.action - ); - case LDKMessageSendEvent_PaymentFailureNetworkUpdate: - return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, - (long)&obj->payment_failure_network_update.update - ); + case LDKMessageSendEvent_SendAcceptChannel: { + long node_id_ref = (long)&obj->send_accept_channel.node_id; + long msg_ref = (long)&obj->send_accept_channel.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_SendOpenChannel: { + long node_id_ref = (long)&obj->send_open_channel.node_id; + long msg_ref = (long)&obj->send_open_channel.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_SendFundingCreated: { + long node_id_ref = (long)&obj->send_funding_created.node_id; + long msg_ref = (long)&obj->send_funding_created.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_SendFundingSigned: { + long node_id_ref = (long)&obj->send_funding_signed.node_id; + long msg_ref = (long)&obj->send_funding_signed.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_SendFundingLocked: { + long node_id_ref = (long)&obj->send_funding_locked.node_id; + long msg_ref = (long)&obj->send_funding_locked.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_SendAnnouncementSignatures: { + long node_id_ref = (long)&obj->send_announcement_signatures.node_id; + long msg_ref = (long)&obj->send_announcement_signatures.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_UpdateHTLCs: { + long node_id_ref = (long)&obj->update_htl_cs.node_id; + long updates_ref = (long)&obj->update_htl_cs.updates; + return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_ref, updates_ref); + } + case LDKMessageSendEvent_SendRevokeAndACK: { + long node_id_ref = (long)&obj->send_revoke_and_ack.node_id; + long msg_ref = (long)&obj->send_revoke_and_ack.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_SendClosingSigned: { + long node_id_ref = (long)&obj->send_closing_signed.node_id; + long msg_ref = (long)&obj->send_closing_signed.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_SendShutdown: { + long node_id_ref = (long)&obj->send_shutdown.node_id; + long msg_ref = (long)&obj->send_shutdown.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_SendChannelReestablish: { + long node_id_ref = (long)&obj->send_channel_reestablish.node_id; + long msg_ref = (long)&obj->send_channel_reestablish.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_ref, msg_ref); + } + case LDKMessageSendEvent_BroadcastChannelAnnouncement: { + long msg_ref = (long)&obj->broadcast_channel_announcement.msg; + long update_msg_ref = (long)&obj->broadcast_channel_announcement.update_msg; + return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref); + } + case LDKMessageSendEvent_BroadcastNodeAnnouncement: { + long msg_ref = (long)&obj->broadcast_node_announcement.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref); + } + case LDKMessageSendEvent_BroadcastChannelUpdate: { + long msg_ref = (long)&obj->broadcast_channel_update.msg; + return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref); + } + case LDKMessageSendEvent_HandleError: { + long node_id_ref = (long)&obj->handle_error.node_id; + long action_ref = (long)&obj->handle_error.action; + return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_ref, 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); + } default: abort(); } } @@ -1342,10 +1369,10 @@ LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t 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); - LDKThirtyTwoBytes* ret = (LDKThirtyTwoBytes*)(*env)->CallLongMethod(env, j_calls->o, j_calls->release_commitment_secret_meth, idx); - LDKThirtyTwoBytes res = *ret; - FREE(ret); - return res; + jbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, j_calls->release_commitment_secret_meth, idx); + LDKThirtyTwoBytes ret; + (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data); + return ret; } LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) { LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; @@ -1456,7 +1483,7 @@ static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobje calls->o = (*env)->NewGlobalRef(env, o); calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)J"); DO_ASSERT(calls->get_per_commitment_point_meth != NULL); - calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)J"); + calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B"); DO_ASSERT(calls->release_commitment_secret_meth != NULL); calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J"); DO_ASSERT(calls->key_derivation_params_meth != NULL); @@ -1510,11 +1537,11 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1pe return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong arg, jlong idx) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong arg, jlong idx) { LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; - LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes"); - *ret = (arg_conv->release_commitment_secret)(arg_conv->this_arg, idx); - return (long)ret; + jbyteArray _arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, (arg_conv->release_commitment_secret)(arg_conv->this_arg, idx).data); + return _arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong arg) { @@ -2006,10 +2033,10 @@ 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); - LDKThirtyTwoBytes* ret = (LDKThirtyTwoBytes*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_secure_random_bytes_meth); - LDKThirtyTwoBytes res = *ret; - FREE(ret); - return res; + jbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, j_calls->get_secure_random_bytes_meth); + LDKThirtyTwoBytes ret; + (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data); + return ret; } static void LDKKeysInterface_JCalls_free(void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -2040,7 +2067,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, j DO_ASSERT(calls->get_shutdown_pubkey_meth != NULL); calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J"); DO_ASSERT(calls->get_channel_keys_meth != NULL); - calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()J"); + calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B"); DO_ASSERT(calls->get_secure_random_bytes_meth != NULL); LDKKeysInterface ret = { @@ -2090,11 +2117,11 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1 return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong arg) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong arg) { LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg; - LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes"); - *ret = (arg_conv->get_secure_random_bytes)(arg_conv->this_arg); - return (long)ret; + jbyteArray _arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, (arg_conv->get_secure_random_bytes)(arg_conv->this_arg).data); + return _arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKInMemoryChannelKeys_1optional_1none (JNIEnv * env, jclass _a) { @@ -2158,28 +2185,29 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEn LDKNetAddress_OnionV3_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;")); DO_ASSERT(LDKNetAddress_OnionV3_class != NULL); - LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "", "(JSBS)V"); + LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "", "([BSBS)V"); DO_ASSERT(LDKNetAddress_OnionV3_meth != NULL); } 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: - return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, - (long)&obj->i_pv4.addr, obj->i_pv4.port - ); - case LDKNetAddress_IPv6: - return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, - (long)&obj->i_pv6.addr, obj->i_pv6.port - ); - case LDKNetAddress_OnionV2: - return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, - (long)&obj->onion_v2.addr, obj->onion_v2.port - ); - case LDKNetAddress_OnionV3: - return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, - (long)&obj->onion_v3.ed25519_pubkey, obj->onion_v3.checksum, obj->onion_v3.version, obj->onion_v3.port - ); + 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); + } + 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); + } + 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); + } + 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); + } default: abort(); } } @@ -3702,13 +3730,13 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) { - LDKThirtyTwoBytes a_conv = *(LDKThirtyTwoBytes*)a; - FREE((void*)a); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) { + LDKThirtyTwoBytes a_ref; + (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data); LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b; FREE((void*)b); LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ"); - *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_conv, b_conv); + *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv); return (long)ret; } @@ -4439,11 +4467,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIE return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return OutPoint_set_txid(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return OutPoint_set_txid(this_ptr_conv, val_ref); } JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -4456,21 +4484,21 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * return OutPoint_set_index(this_ptr_conv, val); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jlong txid_arg, jshort index_arg) { - LDKThirtyTwoBytes txid_arg_conv = *(LDKThirtyTwoBytes*)txid_arg; - FREE((void*)txid_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) { + LDKThirtyTwoBytes txid_arg_ref; + (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data); LDKOutPoint* ret = MALLOC(sizeof(LDKOutPoint), "LDKOutPoint"); - *ret = OutPoint_new(txid_arg_conv, index_arg); + *ret = OutPoint_new(txid_arg_ref, index_arg); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) { LDKOutPoint* this_arg_conv = (LDKOutPoint*)this_arg; - LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes"); - *ret = OutPoint_to_channel_id(this_arg_conv); - return (long)ret; + jbyteArray _arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, OutPoint_to_channel_id(this_arg_conv).data); + return _arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) { @@ -4591,14 +4619,14 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return InMemoryChannelKeys_set_commitment_seed(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return InMemoryChannelKeys_set_commitment_seed(this_ptr_conv, val_ref); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jlong funding_key, jlong revocation_base_key, jlong payment_key, jlong delayed_payment_base_key, jlong htlc_base_key, jlong commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) { +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jlong funding_key, jlong revocation_base_key, jlong payment_key, jlong delayed_payment_base_key, jlong htlc_base_key, jbyteArray commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) { LDKSecretKey funding_key_conv = *(LDKSecretKey*)funding_key; FREE((void*)funding_key); LDKSecretKey revocation_base_key_conv = *(LDKSecretKey*)revocation_base_key; @@ -4609,12 +4637,12 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIE FREE((void*)delayed_payment_base_key); LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key; FREE((void*)htlc_base_key); - LDKThirtyTwoBytes commitment_seed_conv = *(LDKThirtyTwoBytes*)commitment_seed; - FREE((void*)commitment_seed); + LDKThirtyTwoBytes commitment_seed_ref; + (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data); LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params; FREE((void*)key_derivation_params); LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys"); - *ret = InMemoryChannelKeys_new(funding_key_conv, revocation_base_key_conv, payment_key_conv, delayed_payment_base_key_conv, htlc_base_key_conv, commitment_seed_conv, channel_value_satoshis, key_derivation_params_conv); + *ret = InMemoryChannelKeys_new(funding_key_conv, revocation_base_key_conv, payment_key_conv, delayed_payment_base_key_conv, htlc_base_key_conv, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -4718,11 +4746,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1cha return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return ChannelDetails_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return ChannelDetails_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -4899,15 +4927,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1 return ChannelManager_force_close_all_channels(this_arg_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv * _env, jclass _b, jlong this_arg, jlong route, jlong payment_hash, jlong payment_secret) { +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv * _env, jclass _b, jlong this_arg, jlong route, jbyteArray payment_hash, jbyteArray payment_secret) { LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg; LDKRoute* route_conv = (LDKRoute*)route; - LDKThirtyTwoBytes payment_hash_conv = *(LDKThirtyTwoBytes*)payment_hash; - FREE((void*)payment_hash); - LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret; - FREE((void*)payment_secret); + LDKThirtyTwoBytes payment_hash_ref; + (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data); LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret = ChannelManager_send_payment(this_arg_conv, route_conv, payment_hash_conv, payment_secret_conv); + *ret = ChannelManager_send_payment(this_arg_conv, route_conv, payment_hash_ref, payment_secret_ref); return (long)ret; } @@ -4922,15 +4950,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1trans return ChannelManager_funding_transaction_generated(this_arg_conv, temporary_channel_id_ref, funding_txo_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong rgb, jlong alias, jlong addresses) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong rgb, jbyteArray alias, jlong addresses) { LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg; LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb; FREE((void*)rgb); - LDKThirtyTwoBytes alias_conv = *(LDKThirtyTwoBytes*)alias; - FREE((void*)alias); + LDKThirtyTwoBytes alias_ref; + (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data); LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses; FREE((void*)addresses); - return ChannelManager_broadcast_node_announcement(this_arg_conv, rgb_conv, alias_conv, addresses_conv); + return ChannelManager_broadcast_node_announcement(this_arg_conv, rgb_conv, alias_ref, addresses_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) { @@ -4943,23 +4971,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1f return ChannelManager_timer_chan_freshness_every_min(this_arg_conv); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_hash, jlong payment_secret) { +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_hash, jbyteArray payment_secret) { LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg; unsigned char payment_hash_arr[32]; (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr); unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; - LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret; - FREE((void*)payment_secret); - return ChannelManager_fail_htlc_backwards(this_arg_conv, payment_hash_ref, payment_secret_conv); + LDKThirtyTwoBytes payment_secret_ref; + (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data); + return ChannelManager_fail_htlc_backwards(this_arg_conv, payment_hash_ref, payment_secret_ref); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv * _env, jclass _b, jlong this_arg, jlong payment_preimage, jlong payment_secret, jlong expected_amount) { +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_preimage, jbyteArray payment_secret, jlong expected_amount) { LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg; - LDKThirtyTwoBytes payment_preimage_conv = *(LDKThirtyTwoBytes*)payment_preimage; - FREE((void*)payment_preimage); - LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret; - FREE((void*)payment_secret); - return ChannelManager_claim_funds(this_arg_conv, payment_preimage_conv, payment_secret_conv, expected_amount); + LDKThirtyTwoBytes payment_preimage_ref; + (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data); + return ChannelManager_claim_funds(this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) { @@ -5184,11 +5212,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1chann return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return ErrorMessage_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return ErrorMessage_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5205,13 +5233,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv return ErrorMessage_set_data(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong data_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_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 = MALLOC(sizeof(LDKErrorMessage), "LDKErrorMessage"); - *ret = ErrorMessage_new(channel_id_arg_conv, data_arg_conv); + *ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -5291,11 +5319,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_ return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return OpenChannel_set_chain_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return OpenChannel_set_chain_hash(this_ptr_conv, val_ref); } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5305,11 +5333,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1tempor return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return OpenChannel_set_temporary_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return OpenChannel_set_temporary_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5510,11 +5538,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temp return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return AcceptChannel_set_temporary_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return AcceptChannel_set_temporary_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5685,11 +5713,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1tem return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return FundingCreated_set_temporary_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return FundingCreated_set_temporary_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5699,11 +5727,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1fun return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return FundingCreated_set_funding_txid(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return FundingCreated_set_funding_txid(this_ptr_conv, val_ref); } JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5730,15 +5758,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature return FundingCreated_set_signature(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jlong temporary_channel_id_arg, jlong funding_txid_arg, jshort funding_output_index_arg, jlong signature_arg) { - LDKThirtyTwoBytes temporary_channel_id_arg_conv = *(LDKThirtyTwoBytes*)temporary_channel_id_arg; - FREE((void*)temporary_channel_id_arg); - LDKThirtyTwoBytes funding_txid_arg_conv = *(LDKThirtyTwoBytes*)funding_txid_arg; - FREE((void*)funding_txid_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jbyteArray temporary_channel_id_arg, jbyteArray funding_txid_arg, jshort funding_output_index_arg, jlong signature_arg) { + LDKThirtyTwoBytes temporary_channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data); + LDKThirtyTwoBytes funding_txid_arg_ref; + (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data); LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg; FREE((void*)signature_arg); LDKFundingCreated* ret = MALLOC(sizeof(LDKFundingCreated), "LDKFundingCreated"); - *ret = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_conv, funding_output_index_arg, signature_arg_conv); + *ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -5758,11 +5786,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1chan return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return FundingSigned_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return FundingSigned_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5779,13 +5807,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature( return FundingSigned_set_signature(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong signature_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg; FREE((void*)signature_arg); LDKFundingSigned* ret = MALLOC(sizeof(LDKFundingSigned), "LDKFundingSigned"); - *ret = FundingSigned_new(channel_id_arg_conv, signature_arg_conv); + *ret = FundingSigned_new(channel_id_arg_ref, signature_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -5805,11 +5833,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1chan return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return FundingLocked_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return FundingLocked_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5826,13 +5854,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_ return FundingLocked_set_next_per_commitment_point(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong next_per_commitment_point_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong next_per_commitment_point_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg; FREE((void*)next_per_commitment_point_arg); LDKFundingLocked* ret = MALLOC(sizeof(LDKFundingLocked), "LDKFundingLocked"); - *ret = FundingLocked_new(channel_id_arg_conv, next_per_commitment_point_arg_conv); + *ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -5852,11 +5880,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1 return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return Shutdown_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return Shutdown_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5873,13 +5901,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JN return Shutdown_set_scriptpubkey(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong scriptpubkey_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_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 = MALLOC(sizeof(LDKShutdown), "LDKShutdown"); - *ret = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_conv); + *ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -5899,11 +5927,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1chan return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return ClosingSigned_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return ClosingSigned_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5930,13 +5958,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature( return ClosingSigned_set_signature(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong fee_satoshis_arg, jlong signature_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong fee_satoshis_arg, jlong signature_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg; FREE((void*)signature_arg); LDKClosingSigned* ret = MALLOC(sizeof(LDKClosingSigned), "LDKClosingSigned"); - *ret = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_conv); + *ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -5956,11 +5984,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1chan return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UpdateAddHTLC_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UpdateAddHTLC_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5990,11 +6018,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1paym return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UpdateAddHTLC_set_payment_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UpdateAddHTLC_set_payment_hash(this_ptr_conv, val_ref); } JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6021,11 +6049,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1 return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UpdateFulfillHTLC_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UpdateFulfillHTLC_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6045,20 +6073,20 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1 return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UpdateFulfillHTLC_set_payment_preimage(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UpdateFulfillHTLC_set_payment_preimage(this_ptr_conv, val_ref); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong htlc_id_arg, jlong payment_preimage_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); - LDKThirtyTwoBytes payment_preimage_arg_conv = *(LDKThirtyTwoBytes*)payment_preimage_arg; - FREE((void*)payment_preimage_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong htlc_id_arg, jbyteArray payment_preimage_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data); + LDKThirtyTwoBytes payment_preimage_arg_ref; + (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data); LDKUpdateFulfillHTLC* ret = MALLOC(sizeof(LDKUpdateFulfillHTLC), "LDKUpdateFulfillHTLC"); - *ret = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_conv); + *ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -6078,11 +6106,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1cha return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UpdateFailHTLC_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UpdateFailHTLC_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6109,11 +6137,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_ return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UpdateFailMalformedHTLC_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UpdateFailMalformedHTLC_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6150,11 +6178,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1c return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return CommitmentSigned_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return CommitmentSigned_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6178,15 +6206,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1s return CommitmentSigned_set_htlc_signatures(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong signature_arg, jlong htlc_signatures_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg, jlong htlc_signatures_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg; FREE((void*)signature_arg); LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg; FREE((void*)htlc_signatures_arg); LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned"); - *ret = CommitmentSigned_new(channel_id_arg_conv, signature_arg_conv, htlc_signatures_arg_conv); + *ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_conv, htlc_signatures_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -6206,11 +6234,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1chann return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return RevokeAndACK_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return RevokeAndACK_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6220,11 +6248,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1 return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return RevokeAndACK_set_per_commitment_secret(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return RevokeAndACK_set_per_commitment_secret(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6241,15 +6269,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1 return RevokeAndACK_set_next_per_commitment_point(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong per_commitment_secret_arg, jlong next_per_commitment_point_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); - LDKThirtyTwoBytes per_commitment_secret_arg_conv = *(LDKThirtyTwoBytes*)per_commitment_secret_arg; - FREE((void*)per_commitment_secret_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray per_commitment_secret_arg, jlong next_per_commitment_point_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data); + LDKThirtyTwoBytes per_commitment_secret_arg_ref; + (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data); LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg; FREE((void*)next_per_commitment_point_arg); LDKRevokeAndACK* ret = MALLOC(sizeof(LDKRevokeAndACK), "LDKRevokeAndACK"); - *ret = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_conv, next_per_commitment_point_arg_conv); + *ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -6269,11 +6297,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_ return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UpdateFee_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UpdateFee_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6286,11 +6314,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1 return UpdateFee_set_feerate_per_kw(this_ptr_conv, val); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jint feerate_per_kw_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee"); - *ret = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg); + *ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -6310,11 +6338,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1yo return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return DataLossProtect_set_your_last_per_commitment_secret(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return DataLossProtect_set_your_last_per_commitment_secret(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6331,13 +6359,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1curr return DataLossProtect_set_my_current_per_commitment_point(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv * _env, jclass _b, jlong your_last_per_commitment_secret_arg, jlong my_current_per_commitment_point_arg) { - LDKThirtyTwoBytes your_last_per_commitment_secret_arg_conv = *(LDKThirtyTwoBytes*)your_last_per_commitment_secret_arg; - FREE((void*)your_last_per_commitment_secret_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv * _env, jclass _b, jbyteArray your_last_per_commitment_secret_arg, jlong my_current_per_commitment_point_arg) { + LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref; + (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data); LDKPublicKey my_current_per_commitment_point_arg_conv = *(LDKPublicKey*)my_current_per_commitment_point_arg; FREE((void*)my_current_per_commitment_point_arg); LDKDataLossProtect* ret = MALLOC(sizeof(LDKDataLossProtect), "LDKDataLossProtect"); - *ret = DataLossProtect_new(your_last_per_commitment_secret_arg_conv, my_current_per_commitment_point_arg_conv); + *ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -6357,11 +6385,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_ return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return ChannelReestablish_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return ChannelReestablish_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6398,11 +6426,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1 return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return AnnouncementSignatures_set_channel_id(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return AnnouncementSignatures_set_channel_id(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6443,15 +6471,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1b return AnnouncementSignatures_set_bitcoin_signature(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong short_channel_id_arg, jlong node_signature_arg, jlong bitcoin_signature_arg) { - LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg; - FREE((void*)channel_id_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong short_channel_id_arg, jlong node_signature_arg, jlong bitcoin_signature_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKSignature node_signature_arg_conv = *(LDKSignature*)node_signature_arg; FREE((void*)node_signature_arg); LDKSignature bitcoin_signature_arg_conv = *(LDKSignature*)bitcoin_signature_arg; FREE((void*)bitcoin_signature_arg); LDKAnnouncementSignatures* ret = MALLOC(sizeof(LDKAnnouncementSignatures), "LDKAnnouncementSignatures"); - *ret = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv); + *ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -6532,11 +6560,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UnsignedNodeAnnouncement_set_alias(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UnsignedNodeAnnouncement_set_alias(this_ptr_conv, val_ref); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { @@ -6628,11 +6656,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncem return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UnsignedChannelAnnouncement_set_chain_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UnsignedChannelAnnouncement_set_chain_hash(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6814,11 +6842,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1g return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return UnsignedChannelUpdate_set_chain_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return UnsignedChannelUpdate_set_chain_hash(this_ptr_conv, val_ref); } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6956,11 +6984,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1 return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKQueryChannelRange* this_ptr_conv = (LDKQueryChannelRange*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return QueryChannelRange_set_chain_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return QueryChannelRange_set_chain_hash(this_ptr_conv, val_ref); } JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -6983,11 +7011,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number return QueryChannelRange_set_number_of_blocks(this_ptr_conv, val); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg) { - LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg; - FREE((void*)chain_hash_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg) { + LDKThirtyTwoBytes chain_hash_arg_ref; + (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); LDKQueryChannelRange* ret = MALLOC(sizeof(LDKQueryChannelRange), "LDKQueryChannelRange"); - *ret = QueryChannelRange_new(chain_hash_arg_conv, first_blocknum_arg, number_of_blocks_arg); + *ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -7007,11 +7035,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1 return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return ReplyChannelRange_set_chain_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return ReplyChannelRange_set_chain_hash(this_ptr_conv, val_ref); } JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -7051,13 +7079,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_ return ReplyChannelRange_set_short_channel_ids(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg, jboolean full_information_arg, jlong short_channel_ids_arg) { - LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg; - FREE((void*)chain_hash_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg, jboolean full_information_arg, jlong short_channel_ids_arg) { + LDKThirtyTwoBytes chain_hash_arg_ref; + (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg; FREE((void*)short_channel_ids_arg); LDKReplyChannelRange* ret = MALLOC(sizeof(LDKReplyChannelRange), "LDKReplyChannelRange"); - *ret = ReplyChannelRange_new(chain_hash_arg_conv, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv); + *ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -7077,11 +7105,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1ge return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKQueryShortChannelIds* this_ptr_conv = (LDKQueryShortChannelIds*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return QueryShortChannelIds_set_chain_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return QueryShortChannelIds_set_chain_hash(this_ptr_conv, val_ref); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { @@ -7091,13 +7119,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1sho return QueryShortChannelIds_set_short_channel_ids(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jlong short_channel_ids_arg) { - LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg; - FREE((void*)chain_hash_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) { + LDKThirtyTwoBytes chain_hash_arg_ref; + (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg; FREE((void*)short_channel_ids_arg); LDKQueryShortChannelIds* ret = MALLOC(sizeof(LDKQueryShortChannelIds), "LDKQueryShortChannelIds"); - *ret = QueryShortChannelIds_new(chain_hash_arg_conv, short_channel_ids_arg_conv); + *ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -7117,11 +7145,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_ return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKReplyShortChannelIdsEnd* this_ptr_conv = (LDKReplyShortChannelIdsEnd*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return ReplyShortChannelIdsEnd_set_chain_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return ReplyShortChannelIdsEnd_set_chain_hash(this_ptr_conv, val_ref); } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -7134,11 +7162,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1 return ReplyShortChannelIdsEnd_set_full_information(this_ptr_conv, val); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jboolean full_information_arg) { - LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg; - FREE((void*)chain_hash_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) { + LDKThirtyTwoBytes chain_hash_arg_ref; + (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); LDKReplyShortChannelIdsEnd* ret = MALLOC(sizeof(LDKReplyShortChannelIdsEnd), "LDKReplyShortChannelIdsEnd"); - *ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_conv, full_information_arg); + *ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -7158,11 +7186,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1g return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKGossipTimestampFilter* this_ptr_conv = (LDKGossipTimestampFilter*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return GossipTimestampFilter_set_chain_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return GossipTimestampFilter_set_chain_hash(this_ptr_conv, val_ref); } JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -7185,11 +7213,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1ti return GossipTimestampFilter_set_timestamp_range(this_ptr_conv, val); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jint first_timestamp_arg, jint timestamp_range_arg) { - LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg; - FREE((void*)chain_hash_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_timestamp_arg, jint timestamp_range_arg) { + LDKThirtyTwoBytes chain_hash_arg_ref; + (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); LDKGossipTimestampFilter* ret = MALLOC(sizeof(LDKGossipTimestampFilter), "LDKGossipTimestampFilter"); - *ret = GossipTimestampFilter_new(chain_hash_arg_conv, first_timestamp_arg, timestamp_range_arg); + *ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; @@ -8035,13 +8063,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occu return PeerManager_timer_tick_occured(this_arg_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) { unsigned char commitment_seed_arr[32]; (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr); unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr; - LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes"); - *ret = build_commitment_secret(commitment_seed_ref, idx); - return (long)ret; + jbyteArray _arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data); + return _arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jlong per_commitment_point, jbyteArray base_secret) { @@ -8413,11 +8441,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1 return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return HTLCOutputInCommitment_set_payment_hash(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return 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) { @@ -8550,11 +8578,11 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1 return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) { +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) { LDKHolderCommitmentTransaction* this_arg_conv = (LDKHolderCommitmentTransaction*)this_arg; - LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes"); - *ret = HolderCommitmentTransaction_txid(this_arg_conv); - return (long)ret; + jbyteArray _arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, HolderCommitmentTransaction_txid(this_arg_conv).data); + return _arr; } JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1holder_1sig(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jlong funding_redeemscript, jlong channel_value_satoshis) { @@ -9238,11 +9266,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1ge return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr; - LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val; - FREE((void*)val); - return NodeAnnouncementInfo_set_alias(this_ptr_conv, val_conv); + LDKThirtyTwoBytes val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data); + return NodeAnnouncementInfo_set_alias(this_ptr_conv, val_ref); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { @@ -9269,21 +9297,21 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1ann return NodeAnnouncementInfo_set_announcement_message(this_ptr_conv, val_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv * _env, jclass _b, jlong features_arg, jint last_update_arg, jlong rgb_arg, jlong alias_arg, jlong addresses_arg, jlong announcement_message_arg) { +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv * _env, jclass _b, jlong features_arg, jint last_update_arg, jlong rgb_arg, jbyteArray alias_arg, jlong addresses_arg, jlong announcement_message_arg) { LDKNodeFeatures features_arg_conv = *(LDKNodeFeatures*)features_arg; FREE((void*)features_arg); features_arg_conv.is_owned = true; LDKThreeBytes rgb_arg_conv = *(LDKThreeBytes*)rgb_arg; FREE((void*)rgb_arg); - LDKThirtyTwoBytes alias_arg_conv = *(LDKThirtyTwoBytes*)alias_arg; - FREE((void*)alias_arg); + LDKThirtyTwoBytes alias_arg_ref; + (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data); LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg; FREE((void*)addresses_arg); LDKNodeAnnouncement announcement_message_arg_conv = *(LDKNodeAnnouncement*)announcement_message_arg; FREE((void*)announcement_message_arg); announcement_message_arg_conv.is_owned = true; LDKNodeAnnouncementInfo* ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo"); - *ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_conv, addresses_arg_conv, announcement_message_arg_conv); + *ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv); DO_ASSERT(ret->is_owned); ret->is_owned = false; return (long)ret; diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index c300ce5f..951b34b9 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -674,9 +674,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1pe /* * Class: org_ldk_impl_bindings * Method: LDKChannelKeys_call_release_commitment_secret - * Signature: (JJ)J + * Signature: (JJ)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret (JNIEnv *, jclass, jlong, jlong); /* @@ -994,9 +994,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1 /* * Class: org_ldk_impl_bindings * Method: LDKKeysInterface_call_get_secure_random_bytes - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes (JNIEnv *, jclass, jlong); /* @@ -2482,10 +2482,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new /* * Class: org_ldk_impl_bindings * Method: C2Tuple_TxidCVec_TxOutZZ_new - * Signature: (JJ)J + * Signature: ([BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -3298,10 +3298,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid /* * Class: org_ldk_impl_bindings * Method: OutPoint_set_txid - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3322,17 +3322,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index /* * Class: org_ldk_impl_bindings * Method: OutPoint_new - * Signature: (JS)J + * Signature: ([BS)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new - (JNIEnv *, jclass, jlong, jshort); + (JNIEnv *, jclass, jbyteArray, jshort); /* * Class: org_ldk_impl_bindings * Method: OutPoint_to_channel_id - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id (JNIEnv *, jclass, jlong); /* @@ -3474,18 +3474,18 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_set_commitment_seed - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_new - * Signature: (JJJJJJJJ)J + * Signature: (JJJJJ[BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -3594,10 +3594,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1cha /* * Class: org_ldk_impl_bindings * Method: ChannelDetails_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3778,10 +3778,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1 /* * Class: org_ldk_impl_bindings * Method: ChannelManager_send_payment - * Signature: (JJJJ)J + * Signature: (JJ[B[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment - (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3794,10 +3794,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1trans /* * Class: org_ldk_impl_bindings * Method: ChannelManager_broadcast_node_announcement - * Signature: (JJJJ)V + * Signature: (JJ[BJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement - (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -3818,18 +3818,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1f /* * Class: org_ldk_impl_bindings * Method: ChannelManager_fail_htlc_backwards - * Signature: (J[BJ)Z + * Signature: (J[B[B)Z */ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards - (JNIEnv *, jclass, jlong, jbyteArray, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings * Method: ChannelManager_claim_funds - * Signature: (JJJJ)Z + * Signature: (J[B[BJ)Z */ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds - (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -4034,10 +4034,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1chann /* * Class: org_ldk_impl_bindings * Method: ErrorMessage_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4058,10 +4058,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data /* * Class: org_ldk_impl_bindings * Method: ErrorMessage_new - * Signature: (JJ)J + * Signature: ([BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -4162,10 +4162,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_ /* * Class: org_ldk_impl_bindings * Method: OpenChannel_set_chain_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4178,10 +4178,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1tempor /* * Class: org_ldk_impl_bindings * Method: OpenChannel_set_temporary_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4458,10 +4458,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temp /* * Class: org_ldk_impl_bindings * Method: AcceptChannel_set_temporary_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4690,10 +4690,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1tem /* * Class: org_ldk_impl_bindings * Method: FundingCreated_set_temporary_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4706,10 +4706,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1fun /* * Class: org_ldk_impl_bindings * Method: FundingCreated_set_funding_txid - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4746,10 +4746,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature /* * Class: org_ldk_impl_bindings * Method: FundingCreated_new - * Signature: (JJSJ)J + * Signature: ([B[BSJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new - (JNIEnv *, jclass, jlong, jlong, jshort, jlong); + (JNIEnv *, jclass, jbyteArray, jbyteArray, jshort, jlong); /* * Class: org_ldk_impl_bindings @@ -4770,10 +4770,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1chan /* * Class: org_ldk_impl_bindings * Method: FundingSigned_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4794,10 +4794,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature /* * Class: org_ldk_impl_bindings * Method: FundingSigned_new - * Signature: (JJ)J + * Signature: ([BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -4818,10 +4818,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1chan /* * Class: org_ldk_impl_bindings * Method: FundingLocked_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4842,10 +4842,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_ /* * Class: org_ldk_impl_bindings * Method: FundingLocked_new - * Signature: (JJ)J + * Signature: ([BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -4866,10 +4866,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1 /* * Class: org_ldk_impl_bindings * Method: Shutdown_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4890,10 +4890,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey /* * Class: org_ldk_impl_bindings * Method: Shutdown_new - * Signature: (JJ)J + * Signature: ([BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -4914,10 +4914,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1chan /* * Class: org_ldk_impl_bindings * Method: ClosingSigned_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4954,10 +4954,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature /* * Class: org_ldk_impl_bindings * Method: ClosingSigned_new - * Signature: (JJJ)J + * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new - (JNIEnv *, jclass, jlong, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -4978,10 +4978,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1chan /* * Class: org_ldk_impl_bindings * Method: UpdateAddHTLC_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5026,10 +5026,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1paym /* * Class: org_ldk_impl_bindings * Method: UpdateAddHTLC_set_payment_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5066,10 +5066,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1 /* * Class: org_ldk_impl_bindings * Method: UpdateFulfillHTLC_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5098,18 +5098,18 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1 /* * Class: org_ldk_impl_bindings * Method: UpdateFulfillHTLC_set_payment_preimage - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings * Method: UpdateFulfillHTLC_new - * Signature: (JJJ)J + * Signature: ([BJ[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new - (JNIEnv *, jclass, jlong, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5130,10 +5130,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1cha /* * Class: org_ldk_impl_bindings * Method: UpdateFailHTLC_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5170,10 +5170,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_ /* * Class: org_ldk_impl_bindings * Method: UpdateFailMalformedHTLC_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5226,10 +5226,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1c /* * Class: org_ldk_impl_bindings * Method: CommitmentSigned_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5258,10 +5258,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1s /* * Class: org_ldk_impl_bindings * Method: CommitmentSigned_new - * Signature: (JJJ)J + * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new - (JNIEnv *, jclass, jlong, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -5282,10 +5282,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1chann /* * Class: org_ldk_impl_bindings * Method: RevokeAndACK_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5298,10 +5298,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1 /* * Class: org_ldk_impl_bindings * Method: RevokeAndACK_set_per_commitment_secret - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5322,10 +5322,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1 /* * Class: org_ldk_impl_bindings * Method: RevokeAndACK_new - * Signature: (JJJ)J + * Signature: ([B[BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new - (JNIEnv *, jclass, jlong, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -5346,10 +5346,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_ /* * Class: org_ldk_impl_bindings * Method: UpdateFee_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5370,10 +5370,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1 /* * Class: org_ldk_impl_bindings * Method: UpdateFee_new - * Signature: (JI)J + * Signature: ([BI)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new - (JNIEnv *, jclass, jlong, jint); + (JNIEnv *, jclass, jbyteArray, jint); /* * Class: org_ldk_impl_bindings @@ -5394,10 +5394,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1yo /* * Class: org_ldk_impl_bindings * Method: DataLossProtect_set_your_last_per_commitment_secret - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5418,10 +5418,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1curr /* * Class: org_ldk_impl_bindings * Method: DataLossProtect_new - * Signature: (JJ)J + * Signature: ([BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -5442,10 +5442,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_ /* * Class: org_ldk_impl_bindings * Method: ChannelReestablish_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5498,10 +5498,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1 /* * Class: org_ldk_impl_bindings * Method: AnnouncementSignatures_set_channel_id - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5554,10 +5554,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1b /* * Class: org_ldk_impl_bindings * Method: AnnouncementSignatures_new - * Signature: (JJJJ)J + * Signature: ([BJJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -5650,10 +5650,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement /* * Class: org_ldk_impl_bindings * Method: UnsignedNodeAnnouncement_set_alias - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5746,10 +5746,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncem /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_set_chain_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -5946,10 +5946,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1g /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelUpdate_set_chain_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -6130,10 +6130,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1 /* * Class: org_ldk_impl_bindings * Method: QueryChannelRange_set_chain_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -6170,10 +6170,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number /* * Class: org_ldk_impl_bindings * Method: QueryChannelRange_new - * Signature: (JII)J + * Signature: ([BII)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new - (JNIEnv *, jclass, jlong, jint, jint); + (JNIEnv *, jclass, jbyteArray, jint, jint); /* * Class: org_ldk_impl_bindings @@ -6194,10 +6194,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1 /* * Class: org_ldk_impl_bindings * Method: ReplyChannelRange_set_chain_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -6258,10 +6258,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_ /* * Class: org_ldk_impl_bindings * Method: ReplyChannelRange_new - * Signature: (JIIZJ)J + * Signature: ([BIIZJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new - (JNIEnv *, jclass, jlong, jint, jint, jboolean, jlong); + (JNIEnv *, jclass, jbyteArray, jint, jint, jboolean, jlong); /* * Class: org_ldk_impl_bindings @@ -6282,10 +6282,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1ge /* * Class: org_ldk_impl_bindings * Method: QueryShortChannelIds_set_chain_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -6298,10 +6298,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1sho /* * Class: org_ldk_impl_bindings * Method: QueryShortChannelIds_new - * Signature: (JJ)J + * Signature: ([BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -6322,10 +6322,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_ /* * Class: org_ldk_impl_bindings * Method: ReplyShortChannelIdsEnd_set_chain_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -6346,10 +6346,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1 /* * Class: org_ldk_impl_bindings * Method: ReplyShortChannelIdsEnd_new - * Signature: (JZ)J + * Signature: ([BZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new - (JNIEnv *, jclass, jlong, jboolean); + (JNIEnv *, jclass, jbyteArray, jboolean); /* * Class: org_ldk_impl_bindings @@ -6370,10 +6370,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1g /* * Class: org_ldk_impl_bindings * Method: GossipTimestampFilter_set_chain_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -6410,10 +6410,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1ti /* * Class: org_ldk_impl_bindings * Method: GossipTimestampFilter_new - * Signature: (JII)J + * Signature: ([BII)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new - (JNIEnv *, jclass, jlong, jint, jint); + (JNIEnv *, jclass, jbyteArray, jint, jint); /* * Class: org_ldk_impl_bindings @@ -7242,9 +7242,9 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occu /* * Class: org_ldk_impl_bindings * Method: build_commitment_secret - * Signature: ([BJ)J + * Signature: ([BJ)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret (JNIEnv *, jclass, jbyteArray, jlong); /* @@ -7618,10 +7618,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1 /* * Class: org_ldk_impl_bindings * Method: HTLCOutputInCommitment_set_payment_hash - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -7746,9 +7746,9 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1 /* * Class: org_ldk_impl_bindings * Method: HolderCommitmentTransaction_txid - * Signature: (J)J + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid (JNIEnv *, jclass, jlong); /* @@ -8482,10 +8482,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1ge /* * Class: org_ldk_impl_bindings * Method: NodeAnnouncementInfo_set_alias - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -8514,10 +8514,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1ann /* * Class: org_ldk_impl_bindings * Method: NodeAnnouncementInfo_new - * Signature: (JIJJJJ)J + * Signature: (JIJ[BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new - (JNIEnv *, jclass, jlong, jint, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jint, jlong, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings diff --git a/src/test/java/org/ldk/PeerTest.java b/src/test/java/org/ldk/PeerTest.java index 17f3cf2a..e812efaa 100644 --- a/src/test/java/org/ldk/PeerTest.java +++ b/src/test/java/org/ldk/PeerTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test; import org.ldk.impl.bindings; import org.ldk.enums.*; +import java.util.Arrays; import java.util.concurrent.ConcurrentLinkedQueue; public class PeerTest { @@ -156,16 +157,22 @@ 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; - assert bindings.get_u8_slice_bytes(((bindings.LDKEvent.FundingGenerationReady)event).output_script).length == 34; - byte[] chan_id = bindings.read_bytes(((bindings.LDKEvent.FundingGenerationReady)event).temporary_channel_id, 32); + byte[] funding_spk = bindings.get_u8_slice_bytes(((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); + //bindings.ChannelManager_funding_transaction_generated(peer1.chan_manager, chan_id, bindings.OutPoint); + long peer1_chans = bindings.ChannelManager_list_channels(peer1.chan_manager); long peer2_chans = bindings.ChannelManager_list_channels(peer2.chan_manager); assert bindings.vec_slice_len(peer1_chans) == 1; assert bindings.vec_slice_len(peer2_chans) == 1; - assert java.util.Arrays.equals(bindings.ChannelDetails_get_channel_id(bindings.LDKCVecTempl_ChannelDetails_arr_info(peer1_chans).dataptr), chan_id); - assert java.util.Arrays.equals(bindings.ChannelDetails_get_channel_id(bindings.LDKCVecTempl_ChannelDetails_arr_info(peer2_chans).dataptr), chan_id); + long peer_1_chan_info_ptr = bindings.LDKCVecTempl_ChannelDetails_arr_info(peer1_chans).dataptr; + assert bindings.ChannelDetails_get_channel_value_satoshis(peer_1_chan_info_ptr) == 10000; + assert !bindings.ChannelDetails_get_is_live(peer_1_chan_info_ptr); + assert Arrays.equals(bindings.ChannelDetails_get_channel_id(peer_1_chan_info_ptr), chan_id); + assert Arrays.equals(bindings.ChannelDetails_get_channel_id(bindings.LDKCVecTempl_ChannelDetails_arr_info(peer2_chans).dataptr), chan_id); bindings.CVec_ChannelDetailsZ_free(peer1_chans); bindings.CVec_ChannelDetailsZ_free(peer2_chans); -- 2.39.5