From 3edd3abdcfed2f4cffbb96723d7aefc647c03707 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 12 Oct 2020 17:20:23 -0400 Subject: [PATCH] Expose SecretKey as byte[32], expose trait call fns in human structs --- genbindings.py | 31 +- src/main/java/org/ldk/impl/bindings.java | 240 +++++----- src/main/java/org/ldk/structs/Access.java | 3 + .../org/ldk/structs/BroadcasterInterface.java | 3 + .../java/org/ldk/structs/ChannelKeys.java | 25 + .../ldk/structs/ChannelMessageHandler.java | 98 ++++ .../java/org/ldk/structs/EventsProvider.java | 3 + .../java/org/ldk/structs/FeeEstimator.java | 7 + src/main/java/org/ldk/structs/Filter.java | 4 + .../org/ldk/structs/InMemoryChannelKeys.java | 30 +- .../java/org/ldk/structs/KeysInterface.java | 24 + src/main/java/org/ldk/structs/Logger.java | 2 + .../structs/MessageSendEventsProvider.java | 3 + .../java/org/ldk/structs/PeerManager.java | 7 +- .../ldk/structs/RoutingMessageHandler.java | 13 + .../org/ldk/structs/SocketDescriptor.java | 12 + src/main/java/org/ldk/structs/Watch.java | 5 + src/main/jni/bindings.c | 428 +++++++++--------- src/main/jni/org_ldk_impl_bindings.h | 262 ++++++----- .../java/org/ldk/HumanObjectPeerTest.java | 22 +- .../org/ldk/ManualMsgHandlingPeerTest.java | 4 +- src/test/java/org/ldk/PeerTest.java | 12 +- 22 files changed, 725 insertions(+), 513 deletions(-) diff --git a/genbindings.py b/genbindings.py index 5ba69e6d..d7bc07b6 100755 --- a/genbindings.py +++ b/genbindings.py @@ -118,6 +118,11 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg assert var_is_arr_regex.match(fn_arg[8:]) rust_obj = "LDKPublicKey" arr_access = "compressed_form" + if fn_arg.startswith("LDKSecretKey"): + fn_arg = "uint8_t (*" + fn_arg[13:] + ")[32]" + assert var_is_arr_regex.match(fn_arg[8:]) + rust_obj = "LDKSecretKey" + arr_access = "bytes" #if fn_arg.startswith("LDKSignature"): # fn_arg = "uint8_t (*" + fn_arg[13:] + ")[64]" # assert var_is_arr_regex.match(fn_arg[8:]) @@ -380,7 +385,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg arg_names.append(arg_conv_info) out_java_struct = None - if "LDK" + struct_meth in opaque_structs and not is_free: + if ("LDK" + struct_meth in opaque_structs or "LDK" + struct_meth in trait_structs) and not is_free: out_java_struct = open(sys.argv[3] + "/structs/" + struct_meth + ".java", "a") if not args_known: out_java_struct.write("\t// Skipped " + re_match.group(2) + "\n") @@ -630,6 +635,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_java_trait.write("package org.ldk.structs;\n\n") out_java_trait.write("import org.ldk.impl.bindings;\n\n") + out_java_trait.write("import org.ldk.enums.*;\n\n") out_java_trait.write("public class " + struct_name.replace("LDK","") + " extends CommonBase {\n") out_java_trait.write("\t" + struct_name.replace("LDK", "") + "(Object _dummy, long ptr) { super(ptr); }\n") out_java_trait.write("\tpublic " + struct_name.replace("LDK", "") + "(bindings." + struct_name + " arg") @@ -648,7 +654,6 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_java_trait.write("\tprotected void finalize() throws Throwable {\n") out_java_trait.write("\t\tbindings." + struct_name.replace("LDK","") + "_free(ptr); super.finalize();\n") out_java_trait.write("\t}\n\n") - out_java_trait.write("}\n") out_java.write("\tpublic interface " + struct_name + " {\n") java_meths = [] @@ -798,12 +803,12 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_c.write("\treturn ret;\n") out_c.write("}\n") - for fn_line in trait_fn_lines: - # For now, just disable enabling the _call_log - we don't know how to inverse-map String - is_log = fn_line.group(2) == "log" and struct_name == "LDKLogger" - if fn_line.group(2) != "free" and fn_line.group(2) != "clone" and fn_line.group(2) != "eq" and not is_log: - dummy_line = fn_line.group(1) + struct_name + "_call_" + fn_line.group(2) + " " + struct_name + "* arg" + fn_line.group(4) + "\n" - map_fn(dummy_line, re.compile("([A-Za-z_0-9]*) *([A-Za-z_0-9]*) *(.*)").match(dummy_line), None, "(arg_conv->" + fn_line.group(2) + ")(arg_conv->this_arg") + for fn_line in trait_fn_lines: + # For now, just disable enabling the _call_log - we don't know how to inverse-map String + is_log = fn_line.group(2) == "log" and struct_name == "LDKLogger" + if fn_line.group(2) != "free" and fn_line.group(2) != "clone" and fn_line.group(2) != "eq" and not is_log: + dummy_line = fn_line.group(1) + struct_name.replace("LDK", "") + "_call_" + fn_line.group(2) + " " + struct_name + "* this_arg" + fn_line.group(4) + "\n" + map_fn(dummy_line, re.compile("([A-Za-z_0-9]*) *([A-Za-z_0-9]*) *(.*)").match(dummy_line), None, "(this_arg_conv->" + fn_line.group(2) + ")(this_arg_conv->this_arg") out_c.write("""#include \"org_ldk_impl_bindings.h\" #include @@ -1028,13 +1033,6 @@ class CommonBase { } """) - # XXX: Temporarily write out a manual SecretKey_new() for testing, we should auto-gen this kind of thing - out_java.write("\tpublic static native long LDKSecretKey_new();\n\n") # TODO: rm me - out_c.write("JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new(JNIEnv * _env, jclass _b) {\n") # TODO: rm me - out_c.write("\tLDKSecretKey* key = (LDKSecretKey*)MALLOC(sizeof(LDKSecretKey), \"LDKSecretKey\");\n") # TODO: rm me - out_c.write("\treturn (long)key;\n") # TODO: rm me - out_c.write("}\n") # TODO: rm me - in_block_comment = False cur_block_obj = None @@ -1286,3 +1284,6 @@ class CommonBase { for struct_name in opaque_structs: with open(sys.argv[3] + "/structs/" + struct_name.replace("LDK","") + ".java", "a") as out_java_struct: out_java_struct.write("}\n") + for struct_name in trait_structs: + with open(sys.argv[3] + "/structs/" + struct_name.replace("LDK","") + ".java", "a") as out_java_struct: + out_java_struct.write("}\n") diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 46a0f028..a02f4226 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -26,8 +26,6 @@ public class bindings { public static native long vec_slice_len(long vec); public static native long new_empty_slice_vec(); - public static native long LDKSecretKey_new(); - static { LDKAccessError.values(); /* Force enum statics to run */ } static { LDKChannelMonitorUpdateErr.values(); /* Force enum statics to run */ } static { LDKConfirmationTarget.values(); /* Force enum statics to run */ } @@ -283,8 +281,8 @@ public class bindings { } public static native long LDKMessageSendEventsProvider_new(LDKMessageSendEventsProvider impl); public static native LDKMessageSendEventsProvider LDKMessageSendEventsProvider_get_obj_from_jcalls(long val); - // LDKCVec_MessageSendEventZ LDKMessageSendEventsProvider_call_get_and_clear_pending_msg_events LDKMessageSendEventsProvider* arg - public static native long LDKMessageSendEventsProvider_call_get_and_clear_pending_msg_events(long arg); + // LDKCVec_MessageSendEventZ MessageSendEventsProvider_call_get_and_clear_pending_msg_events LDKMessageSendEventsProvider* this_arg + public static native long MessageSendEventsProvider_call_get_and_clear_pending_msg_events(long this_arg); public static native VecOrSliceDef LDKCVecTempl_Event_arr_info(long vec_ptr); public static native long LDKCVecTempl_Event_new(long[] elems); public interface LDKEventsProvider { @@ -292,8 +290,8 @@ public class bindings { } public static native long LDKEventsProvider_new(LDKEventsProvider impl); public static native LDKEventsProvider LDKEventsProvider_get_obj_from_jcalls(long val); - // LDKCVec_EventZ LDKEventsProvider_call_get_and_clear_pending_events LDKEventsProvider* arg - public static native long LDKEventsProvider_call_get_and_clear_pending_events(long arg); + // LDKCVec_EventZ EventsProvider_call_get_and_clear_pending_events LDKEventsProvider* this_arg + public static native long EventsProvider_call_get_and_clear_pending_events(long this_arg); public interface LDKLogger { void log(String record); } @@ -306,8 +304,8 @@ public class bindings { } public static native long LDKAccess_new(LDKAccess impl); public static native LDKAccess LDKAccess_get_obj_from_jcalls(long val); - // LDKCResult_TxOutAccessErrorZ LDKAccess_call_get_utxo LDKAccess* arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id - public static native long LDKAccess_call_get_utxo(long arg, byte[] genesis_hash, long short_channel_id); + // LDKCResult_TxOutAccessErrorZ Access_call_get_utxo LDKAccess* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id + public static native long Access_call_get_utxo(long this_arg, byte[] genesis_hash, long short_channel_id); public static native long[] LDKCVecTempl_HTLCOutputInCommitment_arr_info(long vec_ptr); public static native long LDKCVecTempl_HTLCOutputInCommitment_new(long[] elems); public interface LDKChannelKeys { @@ -325,28 +323,28 @@ public class bindings { } public static native long LDKChannelKeys_new(LDKChannelKeys impl); public static native LDKChannelKeys LDKChannelKeys_get_obj_from_jcalls(long val); - // LDKPublicKey LDKChannelKeys_call_get_per_commitment_point LDKChannelKeys* arg, uint64_t idx - public static native byte[] LDKChannelKeys_call_get_per_commitment_point(long arg, long idx); - // LDKThirtyTwoBytes LDKChannelKeys_call_release_commitment_secret LDKChannelKeys* arg, uint64_t 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 - public static native long LDKChannelKeys_call_sign_counterparty_commitment(long arg, int feerate_per_kw, long commitment_tx, long keys, long htlcs); - // LDKCResult_SignatureNoneZ LDKChannelKeys_call_sign_holder_commitment LDKChannelKeys* arg, const LDKHolderCommitmentTransaction *holder_commitment_tx - public static native long LDKChannelKeys_call_sign_holder_commitment(long arg, long holder_commitment_tx); - // LDKCResult_CVec_SignatureZNoneZ LDKChannelKeys_call_sign_holder_commitment_htlc_transactions LDKChannelKeys* arg, const LDKHolderCommitmentTransaction *holder_commitment_tx - public static native long LDKChannelKeys_call_sign_holder_commitment_htlc_transactions(long arg, long holder_commitment_tx); - // LDKCResult_SignatureNoneZ LDKChannelKeys_call_sign_justice_transaction LDKChannelKeys* arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc - public static native long LDKChannelKeys_call_sign_justice_transaction(long arg, long justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); - // LDKCResult_SignatureNoneZ LDKChannelKeys_call_sign_counterparty_htlc_transaction LDKChannelKeys* arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc - public static native long LDKChannelKeys_call_sign_counterparty_htlc_transaction(long arg, long htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc); - // LDKCResult_SignatureNoneZ LDKChannelKeys_call_sign_closing_transaction LDKChannelKeys* arg, LDKTransaction closing_tx - public static native long LDKChannelKeys_call_sign_closing_transaction(long arg, long closing_tx); - // LDKCResult_SignatureNoneZ LDKChannelKeys_call_sign_channel_announcement LDKChannelKeys* arg, const LDKUnsignedChannelAnnouncement *msg - public static native long LDKChannelKeys_call_sign_channel_announcement(long arg, long msg); - // void LDKChannelKeys_call_on_accept LDKChannelKeys* arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay - public static native void LDKChannelKeys_call_on_accept(long arg, long channel_points, short counterparty_selected_contest_delay, short holder_selected_contest_delay); + // LDKPublicKey ChannelKeys_call_get_per_commitment_point LDKChannelKeys* this_arg, uint64_t idx + public static native byte[] ChannelKeys_call_get_per_commitment_point(long this_arg, long idx); + // LDKThirtyTwoBytes ChannelKeys_call_release_commitment_secret LDKChannelKeys* this_arg, uint64_t idx + public static native byte[] ChannelKeys_call_release_commitment_secret(long this_arg, long idx); + // LDKC2Tuple_u64u64Z ChannelKeys_call_key_derivation_params LDKChannelKeys* this_arg + public static native long ChannelKeys_call_key_derivation_params(long this_arg); + // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ChannelKeys_call_sign_counterparty_commitment LDKChannelKeys* this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs + public static native long ChannelKeys_call_sign_counterparty_commitment(long this_arg, int feerate_per_kw, long commitment_tx, long keys, long htlcs); + // LDKCResult_SignatureNoneZ ChannelKeys_call_sign_holder_commitment LDKChannelKeys* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx + public static native long ChannelKeys_call_sign_holder_commitment(long this_arg, long holder_commitment_tx); + // LDKCResult_CVec_SignatureZNoneZ ChannelKeys_call_sign_holder_commitment_htlc_transactions LDKChannelKeys* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx + public static native long ChannelKeys_call_sign_holder_commitment_htlc_transactions(long this_arg, long holder_commitment_tx); + // LDKCResult_SignatureNoneZ ChannelKeys_call_sign_justice_transaction LDKChannelKeys* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc + public static native long ChannelKeys_call_sign_justice_transaction(long this_arg, long justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); + // LDKCResult_SignatureNoneZ ChannelKeys_call_sign_counterparty_htlc_transaction LDKChannelKeys* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc + public static native long ChannelKeys_call_sign_counterparty_htlc_transaction(long this_arg, long htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc); + // LDKCResult_SignatureNoneZ ChannelKeys_call_sign_closing_transaction LDKChannelKeys* this_arg, LDKTransaction closing_tx + public static native long ChannelKeys_call_sign_closing_transaction(long this_arg, long closing_tx); + // LDKCResult_SignatureNoneZ ChannelKeys_call_sign_channel_announcement LDKChannelKeys* this_arg, const LDKUnsignedChannelAnnouncement *msg + public static native long ChannelKeys_call_sign_channel_announcement(long this_arg, long msg); + // void ChannelKeys_call_on_accept LDKChannelKeys* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay + public static native void ChannelKeys_call_on_accept(long this_arg, long channel_points, short counterparty_selected_contest_delay, short holder_selected_contest_delay); public static native long[] LDKCVecTempl_MonitorEvent_arr_info(long vec_ptr); public static native long LDKCVecTempl_MonitorEvent_new(long[] elems); public interface LDKWatch { @@ -356,36 +354,36 @@ public class bindings { } public static native long LDKWatch_new(LDKWatch impl); public static native LDKWatch LDKWatch_get_obj_from_jcalls(long val); - // LDKCResult_NoneChannelMonitorUpdateErrZ LDKWatch_call_watch_channel LDKWatch* arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor - public static native long LDKWatch_call_watch_channel(long arg, long funding_txo, long monitor); - // LDKCResult_NoneChannelMonitorUpdateErrZ LDKWatch_call_update_channel LDKWatch* arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update - public static native long LDKWatch_call_update_channel(long arg, long funding_txo, long update); - // LDKCVec_MonitorEventZ LDKWatch_call_release_pending_monitor_events LDKWatch* arg - public static native long LDKWatch_call_release_pending_monitor_events(long arg); + // LDKCResult_NoneChannelMonitorUpdateErrZ Watch_call_watch_channel LDKWatch* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor + public static native long Watch_call_watch_channel(long this_arg, long funding_txo, long monitor); + // LDKCResult_NoneChannelMonitorUpdateErrZ Watch_call_update_channel LDKWatch* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update + public static native long Watch_call_update_channel(long this_arg, long funding_txo, long update); + // LDKCVec_MonitorEventZ Watch_call_release_pending_monitor_events LDKWatch* this_arg + public static native long Watch_call_release_pending_monitor_events(long this_arg); public interface LDKFilter { void register_tx(byte[] txid, long script_pubkey); void register_output(long outpoint, long script_pubkey); } public static native long LDKFilter_new(LDKFilter impl); public static native LDKFilter LDKFilter_get_obj_from_jcalls(long val); - // void LDKFilter_call_register_tx LDKFilter* arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey - public static native void LDKFilter_call_register_tx(long arg, byte[] txid, long script_pubkey); - // void LDKFilter_call_register_output LDKFilter* arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey - public static native void LDKFilter_call_register_output(long arg, long outpoint, long script_pubkey); + // void Filter_call_register_tx LDKFilter* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey + public static native void Filter_call_register_tx(long this_arg, byte[] txid, long script_pubkey); + // void Filter_call_register_output LDKFilter* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey + public static native void Filter_call_register_output(long this_arg, long outpoint, long script_pubkey); public interface LDKBroadcasterInterface { void broadcast_transaction(long tx); } public static native long LDKBroadcasterInterface_new(LDKBroadcasterInterface impl); public static native LDKBroadcasterInterface LDKBroadcasterInterface_get_obj_from_jcalls(long val); - // void LDKBroadcasterInterface_call_broadcast_transaction LDKBroadcasterInterface* arg, LDKTransaction tx - public static native void LDKBroadcasterInterface_call_broadcast_transaction(long arg, long tx); + // void BroadcasterInterface_call_broadcast_transaction LDKBroadcasterInterface* this_arg, LDKTransaction tx + public static native void BroadcasterInterface_call_broadcast_transaction(long this_arg, long tx); public interface LDKFeeEstimator { int get_est_sat_per_1000_weight(LDKConfirmationTarget confirmation_target); } public static native long LDKFeeEstimator_new(LDKFeeEstimator impl); public static native LDKFeeEstimator LDKFeeEstimator_get_obj_from_jcalls(long val); - // uint32_t LDKFeeEstimator_call_get_est_sat_per_1000_weight LDKFeeEstimator* arg, LDKConfirmationTarget confirmation_target - public static native int LDKFeeEstimator_call_get_est_sat_per_1000_weight(long arg, LDKConfirmationTarget confirmation_target); + // uint32_t FeeEstimator_call_get_est_sat_per_1000_weight LDKFeeEstimator* this_arg, LDKConfirmationTarget confirmation_target + public static native int FeeEstimator_call_get_est_sat_per_1000_weight(long this_arg, LDKConfirmationTarget confirmation_target); public static native VecOrSliceDef LDKCVecTempl_C2TupleTempl_usize__Transaction_arr_info(long vec_ptr); public static native long LDKCVecTempl_C2TupleTempl_usize__Transaction_new(long[] elems); public static native VecOrSliceDef LDKCVecTempl_Transaction_arr_info(long vec_ptr); @@ -393,7 +391,7 @@ public class bindings { public static native VecOrSliceDef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut_arr_info(long vec_ptr); public static native long LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut_new(long[] elems); public interface LDKKeysInterface { - long get_node_secret(); + byte[] get_node_secret(); long get_destination_script(); byte[] get_shutdown_pubkey(); long get_channel_keys(boolean inbound, long channel_value_satoshis); @@ -401,16 +399,16 @@ public class bindings { } public static native long LDKKeysInterface_new(LDKKeysInterface impl); public static native LDKKeysInterface LDKKeysInterface_get_obj_from_jcalls(long val); - // LDKSecretKey LDKKeysInterface_call_get_node_secret LDKKeysInterface* arg - public static native long LDKKeysInterface_call_get_node_secret(long arg); - // LDKCVec_u8Z LDKKeysInterface_call_get_destination_script LDKKeysInterface* arg - public static native long LDKKeysInterface_call_get_destination_script(long arg); - // LDKPublicKey LDKKeysInterface_call_get_shutdown_pubkey LDKKeysInterface* arg - public static native byte[] LDKKeysInterface_call_get_shutdown_pubkey(long arg); - // 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 byte[] LDKKeysInterface_call_get_secure_random_bytes(long arg); + // LDKSecretKey KeysInterface_call_get_node_secret LDKKeysInterface* this_arg + public static native byte[] KeysInterface_call_get_node_secret(long this_arg); + // LDKCVec_u8Z KeysInterface_call_get_destination_script LDKKeysInterface* this_arg + public static native long KeysInterface_call_get_destination_script(long this_arg); + // LDKPublicKey KeysInterface_call_get_shutdown_pubkey LDKKeysInterface* this_arg + public static native byte[] KeysInterface_call_get_shutdown_pubkey(long this_arg); + // LDKChannelKeys KeysInterface_call_get_channel_keys LDKKeysInterface* this_arg, bool inbound, uint64_t channel_value_satoshis + public static native long KeysInterface_call_get_channel_keys(long this_arg, boolean inbound, long channel_value_satoshis); + // LDKThirtyTwoBytes KeysInterface_call_get_secure_random_bytes LDKKeysInterface* this_arg + public static native byte[] KeysInterface_call_get_secure_random_bytes(long this_arg); public static native long[] LDKCVecTempl_ChannelDetails_arr_info(long vec_ptr); public static native long LDKCVecTempl_ChannelDetails_new(long[] elems); public static class LDKNetAddress { @@ -466,44 +464,44 @@ public class bindings { } public static native long LDKChannelMessageHandler_new(LDKChannelMessageHandler impl, LDKMessageSendEventsProvider MessageSendEventsProvider); public static native LDKChannelMessageHandler LDKChannelMessageHandler_get_obj_from_jcalls(long val); - // void LDKChannelMessageHandler_call_handle_open_channel LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg - public static native void LDKChannelMessageHandler_call_handle_open_channel(long arg, byte[] their_node_id, long their_features, long msg); - // void LDKChannelMessageHandler_call_handle_accept_channel LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg - public static native void LDKChannelMessageHandler_call_handle_accept_channel(long arg, byte[] their_node_id, long their_features, long msg); - // void LDKChannelMessageHandler_call_handle_funding_created LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg - public static native void LDKChannelMessageHandler_call_handle_funding_created(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_funding_signed LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg - public static native void LDKChannelMessageHandler_call_handle_funding_signed(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_funding_locked LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg - public static native void LDKChannelMessageHandler_call_handle_funding_locked(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_shutdown LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKShutdown *msg - public static native void LDKChannelMessageHandler_call_handle_shutdown(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_closing_signed LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg - public static native void LDKChannelMessageHandler_call_handle_closing_signed(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_update_add_htlc LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg - public static native void LDKChannelMessageHandler_call_handle_update_add_htlc(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_update_fulfill_htlc LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg - public static native void LDKChannelMessageHandler_call_handle_update_fulfill_htlc(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_update_fail_htlc LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg - public static native void LDKChannelMessageHandler_call_handle_update_fail_htlc(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_update_fail_malformed_htlc LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg - public static native void LDKChannelMessageHandler_call_handle_update_fail_malformed_htlc(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_commitment_signed LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg - public static native void LDKChannelMessageHandler_call_handle_commitment_signed(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_revoke_and_ack LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg - public static native void LDKChannelMessageHandler_call_handle_revoke_and_ack(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_update_fee LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg - public static native void LDKChannelMessageHandler_call_handle_update_fee(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_announcement_signatures LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg - public static native void LDKChannelMessageHandler_call_handle_announcement_signatures(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_peer_disconnected LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, bool no_connection_possible - public static native void LDKChannelMessageHandler_call_peer_disconnected(long arg, byte[] their_node_id, boolean no_connection_possible); - // void LDKChannelMessageHandler_call_peer_connected LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKInit *msg - public static native void LDKChannelMessageHandler_call_peer_connected(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_channel_reestablish LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg - public static native void LDKChannelMessageHandler_call_handle_channel_reestablish(long arg, byte[] their_node_id, long msg); - // void LDKChannelMessageHandler_call_handle_error LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg - public static native void LDKChannelMessageHandler_call_handle_error(long arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_open_channel LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg + public static native void ChannelMessageHandler_call_handle_open_channel(long this_arg, byte[] their_node_id, long their_features, long msg); + // void ChannelMessageHandler_call_handle_accept_channel LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg + public static native void ChannelMessageHandler_call_handle_accept_channel(long this_arg, byte[] their_node_id, long their_features, long msg); + // void ChannelMessageHandler_call_handle_funding_created LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg + public static native void ChannelMessageHandler_call_handle_funding_created(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_funding_signed LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg + public static native void ChannelMessageHandler_call_handle_funding_signed(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_funding_locked LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg + public static native void ChannelMessageHandler_call_handle_funding_locked(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_shutdown LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg + public static native void ChannelMessageHandler_call_handle_shutdown(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_closing_signed LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg + public static native void ChannelMessageHandler_call_handle_closing_signed(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_update_add_htlc LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg + public static native void ChannelMessageHandler_call_handle_update_add_htlc(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_update_fulfill_htlc LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg + public static native void ChannelMessageHandler_call_handle_update_fulfill_htlc(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_update_fail_htlc LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg + public static native void ChannelMessageHandler_call_handle_update_fail_htlc(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_update_fail_malformed_htlc LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg + public static native void ChannelMessageHandler_call_handle_update_fail_malformed_htlc(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_commitment_signed LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg + public static native void ChannelMessageHandler_call_handle_commitment_signed(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_revoke_and_ack LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg + public static native void ChannelMessageHandler_call_handle_revoke_and_ack(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_update_fee LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg + public static native void ChannelMessageHandler_call_handle_update_fee(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_announcement_signatures LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg + public static native void ChannelMessageHandler_call_handle_announcement_signatures(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_peer_disconnected LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, bool no_connection_possible + public static native void ChannelMessageHandler_call_peer_disconnected(long this_arg, byte[] their_node_id, boolean no_connection_possible); + // void ChannelMessageHandler_call_peer_connected LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKInit *msg + public static native void ChannelMessageHandler_call_peer_connected(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_channel_reestablish LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg + public static native void ChannelMessageHandler_call_handle_channel_reestablish(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_call_handle_error LDKChannelMessageHandler* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg + public static native void ChannelMessageHandler_call_handle_error(long this_arg, byte[] their_node_id, long msg); public static native long[] LDKCVecTempl_ChannelMonitor_arr_info(long vec_ptr); public static native long LDKCVecTempl_ChannelMonitor_new(long[] elems); public static native VecOrSliceDef LDKCVecTempl_u64_arr_info(long vec_ptr); @@ -533,20 +531,20 @@ public class bindings { } public static native long LDKRoutingMessageHandler_new(LDKRoutingMessageHandler impl); public static native LDKRoutingMessageHandler LDKRoutingMessageHandler_get_obj_from_jcalls(long val); - // LDKCResult_boolLightningErrorZ LDKRoutingMessageHandler_call_handle_node_announcement LDKRoutingMessageHandler* arg, const LDKNodeAnnouncement *msg - public static native long LDKRoutingMessageHandler_call_handle_node_announcement(long arg, long msg); - // LDKCResult_boolLightningErrorZ LDKRoutingMessageHandler_call_handle_channel_announcement LDKRoutingMessageHandler* arg, const LDKChannelAnnouncement *msg - public static native long LDKRoutingMessageHandler_call_handle_channel_announcement(long arg, long msg); - // LDKCResult_boolLightningErrorZ LDKRoutingMessageHandler_call_handle_channel_update LDKRoutingMessageHandler* arg, const LDKChannelUpdate *msg - public static native long LDKRoutingMessageHandler_call_handle_channel_update(long arg, long msg); - // void LDKRoutingMessageHandler_call_handle_htlc_fail_channel_update LDKRoutingMessageHandler* arg, const LDKHTLCFailChannelUpdate *update - public static native void LDKRoutingMessageHandler_call_handle_htlc_fail_channel_update(long arg, long update); - // LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ LDKRoutingMessageHandler_call_get_next_channel_announcements LDKRoutingMessageHandler* arg, uint64_t starting_point, uint8_t batch_amount - public static native long LDKRoutingMessageHandler_call_get_next_channel_announcements(long arg, long starting_point, byte batch_amount); - // LDKCVec_NodeAnnouncementZ LDKRoutingMessageHandler_call_get_next_node_announcements LDKRoutingMessageHandler* arg, LDKPublicKey starting_point, uint8_t batch_amount - public static native long LDKRoutingMessageHandler_call_get_next_node_announcements(long arg, byte[] starting_point, byte batch_amount); - // bool LDKRoutingMessageHandler_call_should_request_full_sync LDKRoutingMessageHandler* arg, LDKPublicKey node_id - public static native boolean LDKRoutingMessageHandler_call_should_request_full_sync(long arg, byte[] node_id); + // LDKCResult_boolLightningErrorZ RoutingMessageHandler_call_handle_node_announcement LDKRoutingMessageHandler* this_arg, const LDKNodeAnnouncement *msg + public static native long RoutingMessageHandler_call_handle_node_announcement(long this_arg, long msg); + // LDKCResult_boolLightningErrorZ RoutingMessageHandler_call_handle_channel_announcement LDKRoutingMessageHandler* this_arg, const LDKChannelAnnouncement *msg + public static native long RoutingMessageHandler_call_handle_channel_announcement(long this_arg, long msg); + // LDKCResult_boolLightningErrorZ RoutingMessageHandler_call_handle_channel_update LDKRoutingMessageHandler* this_arg, const LDKChannelUpdate *msg + public static native long RoutingMessageHandler_call_handle_channel_update(long this_arg, long msg); + // void RoutingMessageHandler_call_handle_htlc_fail_channel_update LDKRoutingMessageHandler* this_arg, const LDKHTLCFailChannelUpdate *update + public static native void RoutingMessageHandler_call_handle_htlc_fail_channel_update(long this_arg, long update); + // LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ RoutingMessageHandler_call_get_next_channel_announcements LDKRoutingMessageHandler* this_arg, uint64_t starting_point, uint8_t batch_amount + public static native long RoutingMessageHandler_call_get_next_channel_announcements(long this_arg, long starting_point, byte batch_amount); + // LDKCVec_NodeAnnouncementZ RoutingMessageHandler_call_get_next_node_announcements LDKRoutingMessageHandler* this_arg, LDKPublicKey starting_point, uint8_t batch_amount + public static native long RoutingMessageHandler_call_get_next_node_announcements(long this_arg, byte[] starting_point, byte batch_amount); + // bool RoutingMessageHandler_call_should_request_full_sync LDKRoutingMessageHandler* this_arg, LDKPublicKey node_id + public static native boolean RoutingMessageHandler_call_should_request_full_sync(long this_arg, byte[] node_id); public interface LDKSocketDescriptor { long send_data(long data, boolean resume_read); void disconnect_socket(); @@ -555,12 +553,12 @@ public class bindings { } public static native long LDKSocketDescriptor_new(LDKSocketDescriptor impl); public static native LDKSocketDescriptor LDKSocketDescriptor_get_obj_from_jcalls(long val); - // uintptr_t LDKSocketDescriptor_call_send_data LDKSocketDescriptor* arg, LDKu8slice data, bool resume_read - public static native long LDKSocketDescriptor_call_send_data(long arg, long data, boolean resume_read); - // void LDKSocketDescriptor_call_disconnect_socket LDKSocketDescriptor* arg - public static native void LDKSocketDescriptor_call_disconnect_socket(long arg); - // uint64_t LDKSocketDescriptor_call_hash LDKSocketDescriptor* arg - public static native long LDKSocketDescriptor_call_hash(long arg); + // uintptr_t SocketDescriptor_call_send_data LDKSocketDescriptor* this_arg, LDKu8slice data, bool resume_read + public static native long SocketDescriptor_call_send_data(long this_arg, long data, boolean resume_read); + // void SocketDescriptor_call_disconnect_socket LDKSocketDescriptor* this_arg + public static native void SocketDescriptor_call_disconnect_socket(long this_arg); + // uint64_t SocketDescriptor_call_hash LDKSocketDescriptor* this_arg + public static native long SocketDescriptor_call_hash(long this_arg); public static native VecOrSliceDef LDKCVecTempl_PublicKey_arr_info(long vec_ptr); public static native boolean LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(long arg); public static native long LDKCResult_CVec_u8ZPeerHandleErrorZ_get_inner(long arg); @@ -647,7 +645,7 @@ public class bindings { // extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ); public static native void CResult_SecretKeySecpErrorZ_free(long arg); // extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(LDKSecretKey); - public static native long CResult_SecretKeySecpErrorZ_ok(long arg); + public static native long CResult_SecretKeySecpErrorZ_ok(byte[] arg); // extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ); public static native void CResult_SignatureNoneZ_free(long arg); // extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(LDKSignature); @@ -985,29 +983,29 @@ public class bindings { // const uint8_t (*InMemoryChannelKeys_get_funding_key(const LDKInMemoryChannelKeys *this_ptr))[32]; public static native byte[] InMemoryChannelKeys_get_funding_key(long this_ptr); // void InMemoryChannelKeys_set_funding_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); - public static native void InMemoryChannelKeys_set_funding_key(long this_ptr, long val); + public static native void InMemoryChannelKeys_set_funding_key(long this_ptr, byte[] val); // const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const LDKInMemoryChannelKeys *this_ptr))[32]; public static native byte[] InMemoryChannelKeys_get_revocation_base_key(long this_ptr); // void InMemoryChannelKeys_set_revocation_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); - public static native void InMemoryChannelKeys_set_revocation_base_key(long this_ptr, long val); + public static native void InMemoryChannelKeys_set_revocation_base_key(long this_ptr, byte[] val); // const uint8_t (*InMemoryChannelKeys_get_payment_key(const LDKInMemoryChannelKeys *this_ptr))[32]; public static native byte[] InMemoryChannelKeys_get_payment_key(long this_ptr); // void InMemoryChannelKeys_set_payment_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); - public static native void InMemoryChannelKeys_set_payment_key(long this_ptr, long val); + public static native void InMemoryChannelKeys_set_payment_key(long this_ptr, byte[] val); // const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const LDKInMemoryChannelKeys *this_ptr))[32]; public static native byte[] InMemoryChannelKeys_get_delayed_payment_base_key(long this_ptr); // void InMemoryChannelKeys_set_delayed_payment_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); - public static native void InMemoryChannelKeys_set_delayed_payment_base_key(long this_ptr, long val); + public static native void InMemoryChannelKeys_set_delayed_payment_base_key(long this_ptr, byte[] val); // const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const LDKInMemoryChannelKeys *this_ptr))[32]; public static native byte[] InMemoryChannelKeys_get_htlc_base_key(long this_ptr); // void InMemoryChannelKeys_set_htlc_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val); - public static native void InMemoryChannelKeys_set_htlc_base_key(long this_ptr, long val); + public static native void InMemoryChannelKeys_set_htlc_base_key(long this_ptr, byte[] val); // 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, 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, byte[] commitment_seed, long channel_value_satoshis, long key_derivation_params); + public static native long InMemoryChannelKeys_new(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] 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); @@ -1989,7 +1987,7 @@ public class bindings { // void PeerManager_free(LDKPeerManager this_ptr); public static native void PeerManager_free(long this_ptr); // MUST_USE_RES LDKPeerManager PeerManager_new(LDKMessageHandler message_handler, LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], LDKLogger logger); - public static native long PeerManager_new(long message_handler, long our_node_secret, byte[] ephemeral_random_data, long logger); + public static native long PeerManager_new(long message_handler, byte[] our_node_secret, byte[] ephemeral_random_data, long logger); // MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const LDKPeerManager *this_arg); public static native long PeerManager_get_peer_node_ids(long this_arg); // MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const LDKPeerManager *this_arg, LDKPublicKey their_node_id, LDKSocketDescriptor descriptor); diff --git a/src/main/java/org/ldk/structs/Access.java b/src/main/java/org/ldk/structs/Access.java index 5dc9ef8c..afb6db35 100644 --- a/src/main/java/org/ldk/structs/Access.java +++ b/src/main/java/org/ldk/structs/Access.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class Access extends CommonBase { Access(Object _dummy, long ptr) { super(ptr); } public Access(bindings.LDKAccess arg) { @@ -13,4 +15,5 @@ public class Access extends CommonBase { bindings.Access_free(ptr); super.finalize(); } + // Skipped Access_call_get_utxo } diff --git a/src/main/java/org/ldk/structs/BroadcasterInterface.java b/src/main/java/org/ldk/structs/BroadcasterInterface.java index 4193e907..92c48c18 100644 --- a/src/main/java/org/ldk/structs/BroadcasterInterface.java +++ b/src/main/java/org/ldk/structs/BroadcasterInterface.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class BroadcasterInterface extends CommonBase { BroadcasterInterface(Object _dummy, long ptr) { super(ptr); } public BroadcasterInterface(bindings.LDKBroadcasterInterface arg) { @@ -13,4 +15,5 @@ public class BroadcasterInterface extends CommonBase { bindings.BroadcasterInterface_free(ptr); super.finalize(); } + // Skipped BroadcasterInterface_call_broadcast_transaction } diff --git a/src/main/java/org/ldk/structs/ChannelKeys.java b/src/main/java/org/ldk/structs/ChannelKeys.java index 014c2ff6..dc0a0cd0 100644 --- a/src/main/java/org/ldk/structs/ChannelKeys.java +++ b/src/main/java/org/ldk/structs/ChannelKeys.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class ChannelKeys extends CommonBase { ChannelKeys(Object _dummy, long ptr) { super(ptr); } public ChannelKeys(bindings.LDKChannelKeys arg) { @@ -13,4 +15,27 @@ public class ChannelKeys extends CommonBase { bindings.ChannelKeys_free(ptr); super.finalize(); } + public byte[] call_get_per_commitment_point(long idx) { + byte[] ret = bindings.ChannelKeys_call_get_per_commitment_point(this.ptr, idx); + return ret; + } + + public byte[] call_release_commitment_secret(long idx) { + byte[] ret = bindings.ChannelKeys_call_release_commitment_secret(this.ptr, idx); + return ret; + } + + // Skipped ChannelKeys_call_key_derivation_params + // Skipped ChannelKeys_call_sign_counterparty_commitment + // Skipped ChannelKeys_call_sign_holder_commitment + // Skipped ChannelKeys_call_sign_holder_commitment_htlc_transactions + // Skipped ChannelKeys_call_sign_justice_transaction + // Skipped ChannelKeys_call_sign_counterparty_htlc_transaction + // Skipped ChannelKeys_call_sign_closing_transaction + // Skipped ChannelKeys_call_sign_channel_announcement + public void call_on_accept(ChannelPublicKeys channel_points, short counterparty_selected_contest_delay, short holder_selected_contest_delay) { + bindings.ChannelKeys_call_on_accept(this.ptr, channel_points.ptr & ~1, counterparty_selected_contest_delay, holder_selected_contest_delay); + this.ptrs_to.add(channel_points); + } + } diff --git a/src/main/java/org/ldk/structs/ChannelMessageHandler.java b/src/main/java/org/ldk/structs/ChannelMessageHandler.java index 02e66711..c1de1fb5 100644 --- a/src/main/java/org/ldk/structs/ChannelMessageHandler.java +++ b/src/main/java/org/ldk/structs/ChannelMessageHandler.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class ChannelMessageHandler extends CommonBase { ChannelMessageHandler(Object _dummy, long ptr) { super(ptr); } public ChannelMessageHandler(bindings.LDKChannelMessageHandler arg, bindings.LDKMessageSendEventsProvider MessageSendEventsProvider) { @@ -13,4 +15,100 @@ public class ChannelMessageHandler extends CommonBase { bindings.ChannelMessageHandler_free(ptr); super.finalize(); } + public void call_handle_open_channel(byte[] their_node_id, InitFeatures their_features, OpenChannel msg) { + bindings.ChannelMessageHandler_call_handle_open_channel(this.ptr, their_node_id, their_features.ptr & ~1, msg.ptr & ~1); + this.ptrs_to.add(their_features); + this.ptrs_to.add(msg); + } + + public void call_handle_accept_channel(byte[] their_node_id, InitFeatures their_features, AcceptChannel msg) { + bindings.ChannelMessageHandler_call_handle_accept_channel(this.ptr, their_node_id, their_features.ptr & ~1, msg.ptr & ~1); + this.ptrs_to.add(their_features); + this.ptrs_to.add(msg); + } + + public void call_handle_funding_created(byte[] their_node_id, FundingCreated msg) { + bindings.ChannelMessageHandler_call_handle_funding_created(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_funding_signed(byte[] their_node_id, FundingSigned msg) { + bindings.ChannelMessageHandler_call_handle_funding_signed(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_funding_locked(byte[] their_node_id, FundingLocked msg) { + bindings.ChannelMessageHandler_call_handle_funding_locked(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_shutdown(byte[] their_node_id, Shutdown msg) { + bindings.ChannelMessageHandler_call_handle_shutdown(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_closing_signed(byte[] their_node_id, ClosingSigned msg) { + bindings.ChannelMessageHandler_call_handle_closing_signed(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_update_add_htlc(byte[] their_node_id, UpdateAddHTLC msg) { + bindings.ChannelMessageHandler_call_handle_update_add_htlc(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_update_fulfill_htlc(byte[] their_node_id, UpdateFulfillHTLC msg) { + bindings.ChannelMessageHandler_call_handle_update_fulfill_htlc(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_update_fail_htlc(byte[] their_node_id, UpdateFailHTLC msg) { + bindings.ChannelMessageHandler_call_handle_update_fail_htlc(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_update_fail_malformed_htlc(byte[] their_node_id, UpdateFailMalformedHTLC msg) { + bindings.ChannelMessageHandler_call_handle_update_fail_malformed_htlc(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_commitment_signed(byte[] their_node_id, CommitmentSigned msg) { + bindings.ChannelMessageHandler_call_handle_commitment_signed(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_revoke_and_ack(byte[] their_node_id, RevokeAndACK msg) { + bindings.ChannelMessageHandler_call_handle_revoke_and_ack(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_update_fee(byte[] their_node_id, UpdateFee msg) { + bindings.ChannelMessageHandler_call_handle_update_fee(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_announcement_signatures(byte[] their_node_id, AnnouncementSignatures msg) { + bindings.ChannelMessageHandler_call_handle_announcement_signatures(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_peer_disconnected(byte[] their_node_id, boolean no_connection_possible) { + bindings.ChannelMessageHandler_call_peer_disconnected(this.ptr, their_node_id, no_connection_possible); + } + + public void call_peer_connected(byte[] their_node_id, Init msg) { + bindings.ChannelMessageHandler_call_peer_connected(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_channel_reestablish(byte[] their_node_id, ChannelReestablish msg) { + bindings.ChannelMessageHandler_call_handle_channel_reestablish(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + + public void call_handle_error(byte[] their_node_id, ErrorMessage msg) { + bindings.ChannelMessageHandler_call_handle_error(this.ptr, their_node_id, msg.ptr & ~1); + this.ptrs_to.add(msg); + } + } diff --git a/src/main/java/org/ldk/structs/EventsProvider.java b/src/main/java/org/ldk/structs/EventsProvider.java index 67bd2a5c..bcdd7dbd 100644 --- a/src/main/java/org/ldk/structs/EventsProvider.java +++ b/src/main/java/org/ldk/structs/EventsProvider.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class EventsProvider extends CommonBase { EventsProvider(Object _dummy, long ptr) { super(ptr); } public EventsProvider(bindings.LDKEventsProvider arg) { @@ -13,4 +15,5 @@ public class EventsProvider extends CommonBase { bindings.EventsProvider_free(ptr); super.finalize(); } + // Skipped EventsProvider_call_get_and_clear_pending_events } diff --git a/src/main/java/org/ldk/structs/FeeEstimator.java b/src/main/java/org/ldk/structs/FeeEstimator.java index 3959317b..8189fe70 100644 --- a/src/main/java/org/ldk/structs/FeeEstimator.java +++ b/src/main/java/org/ldk/structs/FeeEstimator.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class FeeEstimator extends CommonBase { FeeEstimator(Object _dummy, long ptr) { super(ptr); } public FeeEstimator(bindings.LDKFeeEstimator arg) { @@ -13,4 +15,9 @@ public class FeeEstimator extends CommonBase { bindings.FeeEstimator_free(ptr); super.finalize(); } + public int call_get_est_sat_per_1000_weight(LDKConfirmationTarget confirmation_target) { + int ret = bindings.FeeEstimator_call_get_est_sat_per_1000_weight(this.ptr, confirmation_target); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/Filter.java b/src/main/java/org/ldk/structs/Filter.java index 19e74505..5f0a3c40 100644 --- a/src/main/java/org/ldk/structs/Filter.java +++ b/src/main/java/org/ldk/structs/Filter.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class Filter extends CommonBase { Filter(Object _dummy, long ptr) { super(ptr); } public Filter(bindings.LDKFilter arg) { @@ -13,4 +15,6 @@ public class Filter extends CommonBase { bindings.Filter_free(ptr); super.finalize(); } + // Skipped Filter_call_register_tx + // Skipped Filter_call_register_output } diff --git a/src/main/java/org/ldk/structs/InMemoryChannelKeys.java b/src/main/java/org/ldk/structs/InMemoryChannelKeys.java index 6ebd0d79..399a328e 100644 --- a/src/main/java/org/ldk/structs/InMemoryChannelKeys.java +++ b/src/main/java/org/ldk/structs/InMemoryChannelKeys.java @@ -21,35 +21,55 @@ public class InMemoryChannelKeys extends CommonBase { return ret; } - // Skipped InMemoryChannelKeys_set_funding_key + public void set_funding_key(InMemoryChannelKeys this_ptr, byte[] val) { + bindings.InMemoryChannelKeys_set_funding_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + public byte[] get_revocation_base_key(InMemoryChannelKeys this_ptr) { byte[] ret = bindings.InMemoryChannelKeys_get_revocation_base_key(this_ptr.ptr & ~1); this.ptrs_to.add(this_ptr); return ret; } - // Skipped InMemoryChannelKeys_set_revocation_base_key + public void set_revocation_base_key(InMemoryChannelKeys this_ptr, byte[] val) { + bindings.InMemoryChannelKeys_set_revocation_base_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + public byte[] get_payment_key(InMemoryChannelKeys this_ptr) { byte[] ret = bindings.InMemoryChannelKeys_get_payment_key(this_ptr.ptr & ~1); this.ptrs_to.add(this_ptr); return ret; } - // Skipped InMemoryChannelKeys_set_payment_key + public void set_payment_key(InMemoryChannelKeys this_ptr, byte[] val) { + bindings.InMemoryChannelKeys_set_payment_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + public byte[] get_delayed_payment_base_key(InMemoryChannelKeys this_ptr) { byte[] ret = bindings.InMemoryChannelKeys_get_delayed_payment_base_key(this_ptr.ptr & ~1); this.ptrs_to.add(this_ptr); return ret; } - // Skipped InMemoryChannelKeys_set_delayed_payment_base_key + public void set_delayed_payment_base_key(InMemoryChannelKeys this_ptr, byte[] val) { + bindings.InMemoryChannelKeys_set_delayed_payment_base_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + public byte[] get_htlc_base_key(InMemoryChannelKeys this_ptr) { byte[] ret = bindings.InMemoryChannelKeys_get_htlc_base_key(this_ptr.ptr & ~1); this.ptrs_to.add(this_ptr); return ret; } - // Skipped InMemoryChannelKeys_set_htlc_base_key + public void set_htlc_base_key(InMemoryChannelKeys this_ptr, byte[] val) { + bindings.InMemoryChannelKeys_set_htlc_base_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + public byte[] get_commitment_seed(InMemoryChannelKeys this_ptr) { byte[] ret = bindings.InMemoryChannelKeys_get_commitment_seed(this_ptr.ptr & ~1); this.ptrs_to.add(this_ptr); diff --git a/src/main/java/org/ldk/structs/KeysInterface.java b/src/main/java/org/ldk/structs/KeysInterface.java index f38ee6ab..665c143a 100644 --- a/src/main/java/org/ldk/structs/KeysInterface.java +++ b/src/main/java/org/ldk/structs/KeysInterface.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class KeysInterface extends CommonBase { KeysInterface(Object _dummy, long ptr) { super(ptr); } public KeysInterface(bindings.LDKKeysInterface arg) { @@ -13,4 +15,26 @@ public class KeysInterface extends CommonBase { bindings.KeysInterface_free(ptr); super.finalize(); } + public byte[] call_get_node_secret() { + byte[] ret = bindings.KeysInterface_call_get_node_secret(this.ptr); + return ret; + } + + // Skipped KeysInterface_call_get_destination_script + public byte[] call_get_shutdown_pubkey() { + byte[] ret = bindings.KeysInterface_call_get_shutdown_pubkey(this.ptr); + return ret; + } + + public ChannelKeys call_get_channel_keys(boolean inbound, long channel_value_satoshis) { + ChannelKeys ret = new ChannelKeys(null, bindings.KeysInterface_call_get_channel_keys(this.ptr, inbound, channel_value_satoshis)); + ret.ptrs_to.add(this); + return ret; + } + + public byte[] call_get_secure_random_bytes() { + byte[] ret = bindings.KeysInterface_call_get_secure_random_bytes(this.ptr); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/Logger.java b/src/main/java/org/ldk/structs/Logger.java index d9c71b88..abf5a632 100644 --- a/src/main/java/org/ldk/structs/Logger.java +++ b/src/main/java/org/ldk/structs/Logger.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class Logger extends CommonBase { Logger(Object _dummy, long ptr) { super(ptr); } public Logger(bindings.LDKLogger arg) { diff --git a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java index 5f2d952c..3c558c6b 100644 --- a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java +++ b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class MessageSendEventsProvider extends CommonBase { MessageSendEventsProvider(Object _dummy, long ptr) { super(ptr); } public MessageSendEventsProvider(bindings.LDKMessageSendEventsProvider arg) { @@ -13,4 +15,5 @@ public class MessageSendEventsProvider extends CommonBase { bindings.MessageSendEventsProvider_free(ptr); super.finalize(); } + // Skipped MessageSendEventsProvider_call_get_and_clear_pending_msg_events } diff --git a/src/main/java/org/ldk/structs/PeerManager.java b/src/main/java/org/ldk/structs/PeerManager.java index a8d7245e..81d89509 100644 --- a/src/main/java/org/ldk/structs/PeerManager.java +++ b/src/main/java/org/ldk/structs/PeerManager.java @@ -10,7 +10,12 @@ public class PeerManager extends CommonBase { bindings.PeerManager_free(ptr); super.finalize(); } - // Skipped PeerManager_new + public PeerManager(MessageHandler message_handler, byte[] our_node_secret, byte[] ephemeral_random_data, Logger logger) { + super(bindings.PeerManager_new(message_handler.ptr & ~1, our_node_secret, ephemeral_random_data, logger.ptr)); + this.ptrs_to.add(message_handler); + this.ptrs_to.add(logger); + } + // Skipped PeerManager_get_peer_node_ids // Skipped PeerManager_new_outbound_connection // Skipped PeerManager_new_inbound_connection diff --git a/src/main/java/org/ldk/structs/RoutingMessageHandler.java b/src/main/java/org/ldk/structs/RoutingMessageHandler.java index 01d97c02..cb8abb6a 100644 --- a/src/main/java/org/ldk/structs/RoutingMessageHandler.java +++ b/src/main/java/org/ldk/structs/RoutingMessageHandler.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class RoutingMessageHandler extends CommonBase { RoutingMessageHandler(Object _dummy, long ptr) { super(ptr); } public RoutingMessageHandler(bindings.LDKRoutingMessageHandler arg) { @@ -13,4 +15,15 @@ public class RoutingMessageHandler extends CommonBase { bindings.RoutingMessageHandler_free(ptr); super.finalize(); } + // Skipped RoutingMessageHandler_call_handle_node_announcement + // Skipped RoutingMessageHandler_call_handle_channel_announcement + // Skipped RoutingMessageHandler_call_handle_channel_update + // Skipped RoutingMessageHandler_call_handle_htlc_fail_channel_update + // Skipped RoutingMessageHandler_call_get_next_channel_announcements + // Skipped RoutingMessageHandler_call_get_next_node_announcements + public boolean call_should_request_full_sync(byte[] node_id) { + boolean ret = bindings.RoutingMessageHandler_call_should_request_full_sync(this.ptr, node_id); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/SocketDescriptor.java b/src/main/java/org/ldk/structs/SocketDescriptor.java index 9518201f..5c72fb38 100644 --- a/src/main/java/org/ldk/structs/SocketDescriptor.java +++ b/src/main/java/org/ldk/structs/SocketDescriptor.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class SocketDescriptor extends CommonBase { SocketDescriptor(Object _dummy, long ptr) { super(ptr); } public SocketDescriptor(bindings.LDKSocketDescriptor arg) { @@ -13,4 +15,14 @@ public class SocketDescriptor extends CommonBase { bindings.SocketDescriptor_free(ptr); super.finalize(); } + // Skipped SocketDescriptor_call_send_data + public void call_disconnect_socket() { + bindings.SocketDescriptor_call_disconnect_socket(this.ptr); + } + + public long call_hash() { + long ret = bindings.SocketDescriptor_call_hash(this.ptr); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index dcaf613b..c5d7b1a4 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -2,6 +2,8 @@ package org.ldk.structs; import org.ldk.impl.bindings; +import org.ldk.enums.*; + public class Watch extends CommonBase { Watch(Object _dummy, long ptr) { super(ptr); } public Watch(bindings.LDKWatch arg) { @@ -13,4 +15,7 @@ public class Watch extends CommonBase { bindings.Watch_free(ptr); super.finalize(); } + // Skipped Watch_call_watch_channel + // Skipped Watch_call_update_channel + // Skipped Watch_call_release_pending_monitor_events } diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 9f7da8b1..f3c8a553 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -171,10 +171,6 @@ _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec and [u8] need _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec and [u8] need to have been mapped identically"); _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec and [u8] need to have been mapped identically"); -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new(JNIEnv * _env, jclass _b) { - LDKSecretKey* key = (LDKSecretKey*)MALLOC(sizeof(LDKSecretKey), "LDKSecretKey"); - return (long)key; -} static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) { switch ((*env)->CallIntMethod(env, val, ordinal_meth)) { case 0: return LDKAccessError_UnknownChain; @@ -1425,10 +1421,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvide DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong arg) { - LDKMessageSendEventsProvider* arg_conv = (LDKMessageSendEventsProvider*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg; LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ"); - *ret = (arg_conv->get_and_clear_pending_msg_events)(arg_conv->this_arg); + *ret = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg); return (long)ret; } @@ -1512,10 +1508,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong arg) { - LDKEventsProvider* arg_conv = (LDKEventsProvider*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg; LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ"); - *ret = (arg_conv->get_and_clear_pending_events)(arg_conv->this_arg); + *ret = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg); return (long)ret; } @@ -1646,13 +1642,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1 DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1call_1get_1utxo(JNIEnv * _env, jclass _b, jlong arg, jbyteArray genesis_hash, jlong short_channel_id) { - LDKAccess* arg_conv = (LDKAccess*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1call_1get_1utxo(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray genesis_hash, jlong short_channel_id) { + LDKAccess* this_arg_conv = (LDKAccess*)this_arg; unsigned char genesis_hash_arr[32]; (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr); unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr; LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret = (arg_conv->get_utxo)(arg_conv->this_arg, genesis_hash_ref, short_channel_id); + *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id); return (long)ret; } @@ -1903,29 +1899,29 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1f DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong arg, jlong idx) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33); - (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (arg_conv->get_per_commitment_point)(arg_conv->this_arg, idx).compressed_form); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form); return arg_arr; } -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; +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32); - (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (arg_conv->release_commitment_secret)(arg_conv->this_arg, idx).data); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data); return arg_arr; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong arg) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - *ret = (arg_conv->key_derivation_params)(arg_conv->this_arg); + *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlong htlcs) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlong htlcs) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx; FREE((void*)commitment_tx); LDKPreCalculatedTxCreationKeys keys_conv; @@ -1934,32 +1930,32 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1c LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs; FREE((void*)htlcs); LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ"); - *ret = (arg_conv->sign_counterparty_commitment)(arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv); + *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKHolderCommitmentTransaction holder_commitment_tx_conv; holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1)); holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0); LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); - *ret = (arg_conv->sign_holder_commitment)(arg_conv->this_arg, &holder_commitment_tx_conv); + *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKHolderCommitmentTransaction holder_commitment_tx_conv; holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1)); holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0); LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ"); - *ret = (arg_conv->sign_holder_commitment_htlc_transactions)(arg_conv->this_arg, &holder_commitment_tx_conv); + *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx; FREE((void*)justice_tx); unsigned char per_commitment_key_arr[32]; @@ -1969,12 +1965,12 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1j htlc_conv.inner = (void*)(htlc & (~1)); htlc_conv.is_owned = (htlc & 1) || (htlc == 0); LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); - *ret = (arg_conv->sign_justice_transaction)(arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv); + *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx; FREE((void*)htlc_tx); LDKPublicKey per_commitment_point_ref; @@ -1983,35 +1979,35 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1c htlc_conv.inner = (void*)(htlc & (~1)); htlc_conv.is_owned = (htlc & 1) || (htlc == 0); LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); - *ret = (arg_conv->sign_counterparty_htlc_transaction)(arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv); + *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong closing_tx) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx; FREE((void*)closing_tx); LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); - *ret = (arg_conv->sign_closing_transaction)(arg_conv->this_arg, closing_tx_conv); + *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKUnsignedChannelAnnouncement msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); - *ret = (arg_conv->sign_channel_announcement)(arg_conv->this_arg, &msg_conv); + *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv); return (long)ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1on_1accept(JNIEnv * _env, jclass _b, jlong arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) { - LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1on_1accept(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) { + LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; LDKChannelPublicKeys channel_points_conv; channel_points_conv.inner = (void*)(channel_points & (~1)); channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0); - return (arg_conv->on_accept)(arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay); + return (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay); } JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { @@ -2168,8 +2164,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1j DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong monitor) { - LDKWatch* arg_conv = (LDKWatch*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) { + LDKWatch* this_arg_conv = (LDKWatch*)this_arg; LDKOutPoint funding_txo_conv; funding_txo_conv.inner = (void*)(funding_txo & (~1)); funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0); @@ -2179,12 +2175,12 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1watch_1channe monitor_conv.inner = (void*)(monitor & (~1)); monitor_conv.is_owned = (monitor & 1) || (monitor == 0); LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ"); - *ret = (arg_conv->watch_channel)(arg_conv->this_arg, funding_txo_conv, monitor_conv); + *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong update) { - LDKWatch* arg_conv = (LDKWatch*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) { + LDKWatch* this_arg_conv = (LDKWatch*)this_arg; LDKOutPoint funding_txo_conv; funding_txo_conv.inner = (void*)(funding_txo & (~1)); funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0); @@ -2196,14 +2192,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1update_1chann if (update_conv.inner != NULL) update_conv = ChannelMonitorUpdate_clone(&update_conv); LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ"); - *ret = (arg_conv->update_channel)(arg_conv->this_arg, funding_txo_conv, update_conv); + *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong arg) { - LDKWatch* arg_conv = (LDKWatch*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKWatch* this_arg_conv = (LDKWatch*)this_arg; LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ"); - *ret = (arg_conv->release_pending_monitor_events)(arg_conv->this_arg); + *ret = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg); return (long)ret; } @@ -2278,22 +2274,22 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1 DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong arg, jbyteArray txid, jlong script_pubkey) { - LDKFilter* arg_conv = (LDKFilter*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jlong script_pubkey) { + LDKFilter* this_arg_conv = (LDKFilter*)this_arg; unsigned char txid_arr[32]; (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr); unsigned char (*txid_ref)[32] = &txid_arr; LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey; - return (arg_conv->register_tx)(arg_conv->this_arg, txid_ref, script_pubkey_conv); + return (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong arg, jlong outpoint, jlong script_pubkey) { - LDKFilter* arg_conv = (LDKFilter*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jlong script_pubkey) { + LDKFilter* this_arg_conv = (LDKFilter*)this_arg; LDKOutPoint outpoint_conv; outpoint_conv.inner = (void*)(outpoint & (~1)); outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0); LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey; - return (arg_conv->register_output)(arg_conv->this_arg, &outpoint_conv, script_pubkey_conv); + return (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_conv); } typedef struct LDKBroadcasterInterface_JCalls { @@ -2352,11 +2348,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1ge DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong tx) { - LDKBroadcasterInterface* arg_conv = (LDKBroadcasterInterface*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) { + LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg; LDKTransaction tx_conv = *(LDKTransaction*)tx; FREE((void*)tx); - return (arg_conv->broadcast_transaction)(arg_conv->this_arg, tx_conv); + return (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv); } typedef struct LDKFeeEstimator_JCalls { @@ -2415,10 +2411,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1 DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1call_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong arg, jclass confirmation_target) { - LDKFeeEstimator* arg_conv = (LDKFeeEstimator*)arg; +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1call_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong this_arg, jclass confirmation_target) { + LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg; LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target); - return (arg_conv->get_est_sat_per_1000_weight)(arg_conv->this_arg, confirmation_target_conv); + return (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { @@ -2503,10 +2499,10 @@ LDKSecretKey get_node_secret_jcall(const void* this_arg) { DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); DO_ASSERT(obj != NULL); - LDKSecretKey* ret = (LDKSecretKey*)(*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth); - LDKSecretKey res = *ret; - FREE(ret); - return res; + jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth); + LDKSecretKey ret; + (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.bytes); + return ret; } LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -2573,7 +2569,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, j atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()J"); + calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B"); DO_ASSERT(calls->get_node_secret_meth != NULL); calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J"); DO_ASSERT(calls->get_destination_script_meth != NULL); @@ -2605,38 +2601,38 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_ DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong arg) { - LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg; - LDKSecretKey* ret = MALLOC(sizeof(LDKSecretKey), "LDKSecretKey"); - *ret = (arg_conv->get_node_secret)(arg_conv->this_arg); - return (long)ret; +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; + jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes); + return arg_arr; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong arg) { - LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z"); - *ret = (arg_conv->get_destination_script)(arg_conv->this_arg); + *ret = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); return (long)ret; } -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong arg) { - LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg; +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33); - (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (arg_conv->get_shutdown_pubkey)(arg_conv->this_arg).compressed_form); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form); return arg_arr; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong arg, jboolean inbound, jlong channel_value_satoshis) { - LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong this_arg, jboolean inbound, jlong channel_value_satoshis) { + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = (arg_conv->get_channel_keys)(arg_conv->this_arg, inbound, channel_value_satoshis); + *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis); return (long)ret; } -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; +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32); - (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (arg_conv->get_secure_random_bytes)(arg_conv->this_arg).data); + (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data); return arg_arr; } @@ -3076,8 +3072,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1g DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong their_features, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKInitFeatures their_features_conv; @@ -3086,11 +3082,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call LDKOpenChannel msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_open_channel)(arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); + return (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong their_features, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKInitFeatures their_features_conv; @@ -3099,174 +3095,174 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call LDKAcceptChannel msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_accept_channel)(arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); + return (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKFundingCreated msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_funding_created)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKFundingSigned msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_funding_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKFundingLocked msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_funding_locked)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKShutdown msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_shutdown)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKClosingSigned msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_closing_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKUpdateAddHTLC msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_update_add_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKUpdateFulfillHTLC msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_update_fulfill_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKUpdateFailHTLC msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_update_fail_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKUpdateFailMalformedHTLC msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_update_fail_malformed_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKCommitmentSigned msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_commitment_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKRevokeAndACK msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_revoke_and_ack)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKUpdateFee msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_update_fee)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKAnnouncementSignatures msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_announcement_signatures)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jboolean no_connection_possible) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jboolean no_connection_possible) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - return (arg_conv->peer_disconnected)(arg_conv->this_arg, their_node_id_ref, no_connection_possible); + return (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKInit msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->peer_connected)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKChannelReestablish msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_channel_reestablish)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) { - LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form); LDKErrorMessage msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); - return (arg_conv->handle_error)(arg_conv->this_arg, their_node_id_ref, &msg_conv); + return (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { @@ -3657,63 +3653,63 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1g DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) { - LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) { + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg; LDKNodeAnnouncement msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ"); - *ret = (arg_conv->handle_node_announcement)(arg_conv->this_arg, &msg_conv); + *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) { - LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) { + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg; LDKChannelAnnouncement msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ"); - *ret = (arg_conv->handle_channel_announcement)(arg_conv->this_arg, &msg_conv); + *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong msg) { - LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) { + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg; LDKChannelUpdate msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = (msg & 1) || (msg == 0); LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ"); - *ret = (arg_conv->handle_channel_update)(arg_conv->this_arg, &msg_conv); + *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv); return (long)ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong update) { - LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) { + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg; LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update; - return (arg_conv->handle_htlc_fail_channel_update)(arg_conv->this_arg, update_conv); + return (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong arg, jlong starting_point, jbyte batch_amount) { - LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jlong starting_point, jbyte batch_amount) { + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg; LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ"); - *ret = (arg_conv->get_next_channel_announcements)(arg_conv->this_arg, starting_point, batch_amount); + *ret = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount); return (long)ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong arg, jbyteArray starting_point, jbyte batch_amount) { - LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray starting_point, jbyte batch_amount) { + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg; LDKPublicKey starting_point_ref; (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form); LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ"); - *ret = (arg_conv->get_next_node_announcements)(arg_conv->this_arg, starting_point_ref, batch_amount); + *ret = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount); return (long)ret; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong arg, jbyteArray node_id) { - LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) { + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg; LDKPublicKey node_id_ref; (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form); - return (arg_conv->should_request_full_sync)(arg_conv->this_arg, node_id_ref); + return (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref); } typedef struct LDKSocketDescriptor_JCalls { @@ -3809,20 +3805,20 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1o DO_ASSERT(ret != NULL); return ret; } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong arg, jlong data, jboolean resume_read) { - LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg; +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jlong data, jboolean resume_read) { + LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg; LDKu8slice data_conv = *(LDKu8slice*)data; - return (arg_conv->send_data)(arg_conv->this_arg, data_conv, resume_read); + return (this_arg_conv->send_data)(this_arg_conv->this_arg, data_conv, resume_read); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong arg) { - LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg; - return (arg_conv->disconnect_socket)(arg_conv->this_arg); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg; + return (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong arg) { - LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg; - return (arg_conv->hash)(arg_conv->this_arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong this_arg) { + LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg; + return (this_arg_conv->hash)(this_arg_conv->this_arg); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { @@ -4221,11 +4217,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1 return CResult_SecretKeySecpErrorZ_free(arg_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) { - LDKSecretKey arg_conv = *(LDKSecretKey*)arg; - FREE((void*)arg); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) { + LDKSecretKey arg_ref; + (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes); LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ"); - *ret = CResult_SecretKeySecpErrorZ_ok(arg_conv); + *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref); return (long)ret; } @@ -5506,13 +5502,13 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKInMemoryChannelKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - LDKSecretKey val_conv = *(LDKSecretKey*)val; - FREE((void*)val); - return InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_conv); + LDKSecretKey val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes); + return InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref); } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5524,13 +5520,13 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKInMemoryChannelKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - LDKSecretKey val_conv = *(LDKSecretKey*)val; - FREE((void*)val); - return InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_conv); + LDKSecretKey val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes); + return InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref); } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5542,13 +5538,13 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKInMemoryChannelKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - LDKSecretKey val_conv = *(LDKSecretKey*)val; - FREE((void*)val); - return InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_conv); + LDKSecretKey val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes); + return InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref); } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5560,13 +5556,13 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKInMemoryChannelKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - LDKSecretKey val_conv = *(LDKSecretKey*)val; - FREE((void*)val); - return InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_conv); + LDKSecretKey val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes); + return InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref); } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5578,13 +5574,13 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) { LDKInMemoryChannelKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - LDKSecretKey val_conv = *(LDKSecretKey*)val; - FREE((void*)val); - return InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_conv); + LDKSecretKey val_ref; + (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes); + return InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref); } JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) { @@ -5605,22 +5601,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1comm 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, 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; - FREE((void*)revocation_base_key); - LDKSecretKey payment_key_conv = *(LDKSecretKey*)payment_key; - FREE((void*)payment_key); - LDKSecretKey delayed_payment_base_key_conv = *(LDKSecretKey*)delayed_payment_base_key; - FREE((void*)delayed_payment_base_key); - LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key; - FREE((void*)htlc_base_key); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jbyteArray funding_key, jbyteArray revocation_base_key, jbyteArray payment_key, jbyteArray delayed_payment_base_key, jbyteArray htlc_base_key, jbyteArray commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) { + LDKSecretKey funding_key_ref; + (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes); + LDKSecretKey revocation_base_key_ref; + (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes); + LDKSecretKey payment_key_ref; + (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes); + LDKSecretKey delayed_payment_base_key_ref; + (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes); + LDKSecretKey htlc_base_key_ref; + (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes); 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 = 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); + LDKInMemoryChannelKeys ret = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv); return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } @@ -9710,12 +9706,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _en return PeerManager_free(this_ptr_conv); } -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jlong our_node_secret, jbyteArray ephemeral_random_data, jlong logger) { +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jbyteArray our_node_secret, jbyteArray ephemeral_random_data, jlong logger) { LDKMessageHandler message_handler_conv; message_handler_conv.inner = (void*)(message_handler & (~1)); message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0); - LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret; - FREE((void*)our_node_secret); + LDKSecretKey our_node_secret_ref; + (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes); unsigned char ephemeral_random_data_arr[32]; (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr); unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr; @@ -9724,7 +9720,7 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _en // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_clone(logger_conv.this_arg); } - LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv); + LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv); return ((long)ret.inner) | (ret.is_owned ? 1 : 0); } diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index e6cd6d3e..45236694 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -87,14 +87,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv *, jclass); -/* - * Class: org_ldk_impl_bindings - * Method: LDKSecretKey_new - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new - (JNIEnv *, jclass); - /* * Class: org_ldk_impl_bindings * Method: LDKCVecTempl_u8_arr_info @@ -425,10 +417,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvide /* * Class: org_ldk_impl_bindings - * Method: LDKMessageSendEventsProvider_call_get_and_clear_pending_msg_events + * Method: MessageSendEventsProvider_call_get_and_clear_pending_msg_events * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events (JNIEnv *, jclass, jlong); /* @@ -465,10 +457,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj /* * Class: org_ldk_impl_bindings - * Method: LDKEventsProvider_call_get_and_clear_pending_events + * Method: EventsProvider_call_get_and_clear_pending_events * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1call_1get_1and_1clear_1pending_1events +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EventsProvider_1call_1get_1and_1clear_1pending_1events (JNIEnv *, jclass, jlong); /* @@ -521,10 +513,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1 /* * Class: org_ldk_impl_bindings - * Method: LDKAccess_call_get_utxo + * Method: Access_call_get_utxo * Signature: (J[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1call_1get_1utxo +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1call_1get_1utxo (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* @@ -561,90 +553,90 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1f /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_get_per_commitment_point + * Method: ChannelKeys_call_get_per_commitment_point * Signature: (JJ)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1per_1commitment_1point +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1get_1per_1commitment_1point (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_release_commitment_secret + * Method: ChannelKeys_call_release_commitment_secret * Signature: (JJ)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1release_1commitment_1secret (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_key_derivation_params + * Method: ChannelKeys_call_key_derivation_params * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1key_1derivation_1params +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1key_1derivation_1params (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_sign_counterparty_commitment + * Method: ChannelKeys_call_sign_counterparty_commitment * Signature: (JIJJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1commitment +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1counterparty_1commitment (JNIEnv *, jclass, jlong, jint, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_sign_holder_commitment + * Method: ChannelKeys_call_sign_holder_commitment * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1holder_1commitment (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_sign_holder_commitment_htlc_transactions + * Method: ChannelKeys_call_sign_holder_commitment_htlc_transactions * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_sign_justice_transaction + * Method: ChannelKeys_call_sign_justice_transaction * Signature: (JJJJ[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1justice_1transaction +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1justice_1transaction (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_sign_counterparty_htlc_transaction + * Method: ChannelKeys_call_sign_counterparty_htlc_transaction * Signature: (JJJJ[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1htlc_1transaction +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1counterparty_1htlc_1transaction (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_sign_closing_transaction + * Method: ChannelKeys_call_sign_closing_transaction * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1closing_1transaction +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1closing_1transaction (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_sign_channel_announcement + * Method: ChannelKeys_call_sign_channel_announcement * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1channel_1announcement +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1channel_1announcement (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_call_on_accept + * Method: ChannelKeys_call_on_accept * Signature: (JJSS)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1on_1accept +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1on_1accept (JNIEnv *, jclass, jlong, jlong, jshort, jshort); /* @@ -681,26 +673,26 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1j /* * Class: org_ldk_impl_bindings - * Method: LDKWatch_call_watch_channel + * Method: Watch_call_watch_channel * Signature: (JJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1watch_1channel +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1watch_1channel (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKWatch_call_update_channel + * Method: Watch_call_update_channel * Signature: (JJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1update_1channel +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1update_1channel (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKWatch_call_release_pending_monitor_events + * Method: Watch_call_release_pending_monitor_events * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1release_1pending_1monitor_1events +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1release_1pending_1monitor_1events (JNIEnv *, jclass, jlong); /* @@ -721,18 +713,18 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1 /* * Class: org_ldk_impl_bindings - * Method: LDKFilter_call_register_tx + * Method: Filter_call_register_tx * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1tx +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1call_1register_1tx (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKFilter_call_register_output + * Method: Filter_call_register_output * Signature: (JJJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1output +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1call_1register_1output (JNIEnv *, jclass, jlong, jlong, jlong); /* @@ -753,10 +745,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1ge /* * Class: org_ldk_impl_bindings - * Method: LDKBroadcasterInterface_call_broadcast_transaction + * Method: BroadcasterInterface_call_broadcast_transaction * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1call_1broadcast_1transaction +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1call_1broadcast_1transaction (JNIEnv *, jclass, jlong, jlong); /* @@ -777,10 +769,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1 /* * Class: org_ldk_impl_bindings - * Method: LDKFeeEstimator_call_get_est_sat_per_1000_weight + * Method: FeeEstimator_call_get_est_sat_per_1000_weight * Signature: (JLorg/ldk/enums/LDKConfirmationTarget;)I */ -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1call_1get_1est_1sat_1per_11000_1weight +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1call_1get_1est_1sat_1per_11000_1weight (JNIEnv *, jclass, jlong, jobject); /* @@ -849,42 +841,42 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_ /* * Class: org_ldk_impl_bindings - * Method: LDKKeysInterface_call_get_node_secret - * Signature: (J)J + * Method: KeysInterface_call_get_node_secret + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1node_1secret +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1node_1secret (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKKeysInterface_call_get_destination_script + * Method: KeysInterface_call_get_destination_script * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1destination_1script +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1destination_1script (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKKeysInterface_call_get_shutdown_pubkey + * Method: KeysInterface_call_get_shutdown_pubkey * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1shutdown_1pubkey +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1shutdown_1pubkey (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKKeysInterface_call_get_channel_keys + * Method: KeysInterface_call_get_channel_keys * Signature: (JZJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1channel_1keys +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1channel_1keys (JNIEnv *, jclass, jlong, jboolean, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKKeysInterface_call_get_secure_random_bytes + * Method: KeysInterface_call_get_secure_random_bytes * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1secure_1random_1bytes (JNIEnv *, jclass, jlong); /* @@ -945,154 +937,154 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1g /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_open_channel + * Method: ChannelMessageHandler_call_handle_open_channel * Signature: (J[BJJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1open_1channel +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1open_1channel (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_accept_channel + * Method: ChannelMessageHandler_call_handle_accept_channel * Signature: (J[BJJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1accept_1channel +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1accept_1channel (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_funding_created + * Method: ChannelMessageHandler_call_handle_funding_created * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1created +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1created (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_funding_signed + * Method: ChannelMessageHandler_call_handle_funding_signed * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1signed +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1signed (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_funding_locked + * Method: ChannelMessageHandler_call_handle_funding_locked * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1locked +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1locked (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_shutdown + * Method: ChannelMessageHandler_call_handle_shutdown * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1shutdown +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1shutdown (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_closing_signed + * Method: ChannelMessageHandler_call_handle_closing_signed * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1closing_1signed +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1closing_1signed (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_update_add_htlc + * Method: ChannelMessageHandler_call_handle_update_add_htlc * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1add_1htlc +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1add_1htlc (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_update_fulfill_htlc + * Method: ChannelMessageHandler_call_handle_update_fulfill_htlc * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_update_fail_htlc + * Method: ChannelMessageHandler_call_handle_update_fail_htlc * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1htlc +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fail_1htlc (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_update_fail_malformed_htlc + * Method: ChannelMessageHandler_call_handle_update_fail_malformed_htlc * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_commitment_signed + * Method: ChannelMessageHandler_call_handle_commitment_signed * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1commitment_1signed +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1commitment_1signed (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_revoke_and_ack + * Method: ChannelMessageHandler_call_handle_revoke_and_ack * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1revoke_1and_1ack +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1revoke_1and_1ack (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_update_fee + * Method: ChannelMessageHandler_call_handle_update_fee * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fee +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fee (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_announcement_signatures + * Method: ChannelMessageHandler_call_handle_announcement_signatures * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1announcement_1signatures +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1announcement_1signatures (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_peer_disconnected + * Method: ChannelMessageHandler_call_peer_disconnected * Signature: (J[BZ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1disconnected +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1peer_1disconnected (JNIEnv *, jclass, jlong, jbyteArray, jboolean); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_peer_connected + * Method: ChannelMessageHandler_call_peer_connected * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1connected +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1peer_1connected (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_channel_reestablish + * Method: ChannelMessageHandler_call_handle_channel_reestablish * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1channel_1reestablish +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1channel_1reestablish (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKChannelMessageHandler_call_handle_error + * Method: ChannelMessageHandler_call_handle_error * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1error +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1error (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* @@ -1257,58 +1249,58 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1g /* * Class: org_ldk_impl_bindings - * Method: LDKRoutingMessageHandler_call_handle_node_announcement + * Method: RoutingMessageHandler_call_handle_node_announcement * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1node_1announcement +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1node_1announcement (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKRoutingMessageHandler_call_handle_channel_announcement + * Method: RoutingMessageHandler_call_handle_channel_announcement * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1announcement +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1channel_1announcement (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKRoutingMessageHandler_call_handle_channel_update + * Method: RoutingMessageHandler_call_handle_channel_update * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1update +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1channel_1update (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKRoutingMessageHandler_call_handle_htlc_fail_channel_update + * Method: RoutingMessageHandler_call_handle_htlc_fail_channel_update * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKRoutingMessageHandler_call_get_next_channel_announcements + * Method: RoutingMessageHandler_call_get_next_channel_announcements * Signature: (JJB)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1channel_1announcements +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1get_1next_1channel_1announcements (JNIEnv *, jclass, jlong, jlong, jbyte); /* * Class: org_ldk_impl_bindings - * Method: LDKRoutingMessageHandler_call_get_next_node_announcements + * Method: RoutingMessageHandler_call_get_next_node_announcements * Signature: (J[BB)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1node_1announcements +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1get_1next_1node_1announcements (JNIEnv *, jclass, jlong, jbyteArray, jbyte); /* * Class: org_ldk_impl_bindings - * Method: LDKRoutingMessageHandler_call_should_request_full_sync + * Method: RoutingMessageHandler_call_should_request_full_sync * Signature: (J[B)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1should_1request_1full_1sync +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1should_1request_1full_1sync (JNIEnv *, jclass, jlong, jbyteArray); /* @@ -1329,26 +1321,26 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1o /* * Class: org_ldk_impl_bindings - * Method: LDKSocketDescriptor_call_send_data + * Method: SocketDescriptor_call_send_data * Signature: (JJZ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1send_1data +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1send_1data (JNIEnv *, jclass, jlong, jlong, jboolean); /* * Class: org_ldk_impl_bindings - * Method: LDKSocketDescriptor_call_disconnect_socket + * Method: SocketDescriptor_call_disconnect_socket * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1disconnect_1socket +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1disconnect_1socket (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKSocketDescriptor_call_hash + * Method: SocketDescriptor_call_hash * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1hash +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1hash (JNIEnv *, jclass, jlong); /* @@ -1778,10 +1770,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1 /* * Class: org_ldk_impl_bindings * Method: CResult_SecretKeySecpErrorZ_ok - * Signature: (J)J + * Signature: ([B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok - (JNIEnv *, jclass, jlong); + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3130,10 +3122,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_set_funding_key - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3146,10 +3138,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_set_revocation_base_key - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3162,10 +3154,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_set_payment_key - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3178,10 +3170,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_set_delayed_payment_base_key - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3194,10 +3186,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_set_htlc_base_key - * Signature: (JJ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -3218,10 +3210,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1comm /* * Class: org_ldk_impl_bindings * Method: InMemoryChannelKeys_new - * Signature: (JJJJJ[BJJ)J + * Signature: ([B[B[B[B[B[BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -7146,10 +7138,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free /* * Class: org_ldk_impl_bindings * Method: PeerManager_new - * Signature: (JJ[BJ)J + * Signature: (J[B[BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new - (JNIEnv *, jclass, jlong, jlong, jbyteArray, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java index bd59b044..f408b500 100644 --- a/src/test/java/org/ldk/HumanObjectPeerTest.java +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -18,9 +18,9 @@ public class HumanObjectPeerTest { final long fee_estimator; final long tx_broadcaster; final KeysManager keys; - final long keys_interface; + final KeysInterface keys_interface; final ChannelManager chan_manager; - final long chan_manager_events; + final EventsProvider chan_manager_events; final long chan_handler; final long router; final long route_handler; @@ -78,12 +78,12 @@ public class HumanObjectPeerTest { key_seed[i] = (byte) (i ^ seed); } this.keys = new KeysManager(key_seed, LDKNetwork.LDKNetwork_Bitcoin, System.currentTimeMillis() / 1000, (int) (System.currentTimeMillis() * 1000) & 0xffffffff); - this.keys_interface = bindings.KeysManager_as_KeysInterface(keys._test_only_get_ptr()); + this.keys_interface = keys.as_KeysInterface(); this.chan_manager = new ChannelManager(LDKNetwork.LDKNetwork_Bitcoin, new FeeEstimator(confirmation_target -> 0), chain_monitor, new BroadcasterInterface(tx -> { }), new Logger(log_trait), keys.as_KeysInterface(), new UserConfig(), 1); this.node_id = chan_manager.get_our_node_id(); - this.chan_manager_events = bindings.ChannelManager_as_EventsProvider(chan_manager._test_only_get_ptr()); + this.chan_manager_events = chan_manager.as_EventsProvider(); this.chan_handler = bindings.ChannelManager_as_ChannelMessageHandler(chan_manager._test_only_get_ptr()); this.router = bindings.NetGraphMsgHandler_new(0, logger); @@ -94,7 +94,7 @@ public class HumanObjectPeerTest { for (byte i = 0; i < 32; i++) { random_data[i] = (byte) ((i ^ seed) ^ 0xf0); } - this.peer_manager = bindings.PeerManager_new(message_handler, bindings.LDKKeysInterface_call_get_node_secret(keys_interface), random_data, logger); + this.peer_manager = bindings.PeerManager_new(message_handler, keys_interface.call_get_node_secret(), random_data, logger); System.gc(); } @@ -125,8 +125,6 @@ public class HumanObjectPeerTest { bindings.Logger_free(logger); bindings.FeeEstimator_free(fee_estimator); bindings.BroadcasterInterface_free(tx_broadcaster); - bindings.KeysInterface_free(keys_interface); - bindings.EventsProvider_free(chan_manager_events); bindings.ChannelMessageHandler_free(chan_handler); bindings.NetGraphMsgHandler_free(router); bindings.RoutingMessageHandler_free(route_handler); @@ -217,7 +215,7 @@ public class HumanObjectPeerTest { bindings.PeerManager_process_events(peer2.peer_manager); while (!list.isEmpty()) { list.poll().join(); } - long events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + long events = bindings.EventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events._test_only_get_ptr()); bindings.VecOrSliceDef events_arr_info = bindings.LDKCVecTempl_Event_arr_info(events); assert events_arr_info.datalen == 1; bindings.LDKEvent event = bindings.LDKEvent_ref_from_ptr(events_arr_info.dataptr); @@ -241,7 +239,7 @@ public class HumanObjectPeerTest { bindings.PeerManager_process_events(peer2.peer_manager); while (!list.isEmpty()) { list.poll().join(); } - events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + events = bindings.EventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events._test_only_get_ptr()); events_arr_info = bindings.LDKCVecTempl_Event_arr_info(events); assert events_arr_info.datalen == 1; event = bindings.LDKEvent_ref_from_ptr(events_arr_info.dataptr); @@ -295,7 +293,7 @@ public class HumanObjectPeerTest { bindings.PeerManager_process_events(peer1.peer_manager); while (!list.isEmpty()) { list.poll().join(); } - long peer2_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events); + long peer2_events = bindings.EventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events._test_only_get_ptr()); bindings.VecOrSliceDef event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer2_events); assert event_arr_info.datalen == 1; bindings.LDKEvent forwardable = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); @@ -303,7 +301,7 @@ public class HumanObjectPeerTest { bindings.CVec_EventZ_free(peer2_events); bindings.ChannelManager_process_pending_htlc_forwards(peer2.chan_manager._test_only_get_ptr()); - peer2_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events); + peer2_events = bindings.EventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events._test_only_get_ptr()); event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer2_events); assert event_arr_info.datalen == 1; bindings.LDKEvent payment_recvd = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); @@ -316,7 +314,7 @@ public class HumanObjectPeerTest { bindings.PeerManager_process_events(peer1.peer_manager); while (!list.isEmpty()) { list.poll().join(); } - long peer1_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + long peer1_events = bindings.EventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events._test_only_get_ptr()); event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer1_events); assert event_arr_info.datalen == 1; bindings.LDKEvent sent = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); diff --git a/src/test/java/org/ldk/ManualMsgHandlingPeerTest.java b/src/test/java/org/ldk/ManualMsgHandlingPeerTest.java index 82f0ade1..04492878 100644 --- a/src/test/java/org/ldk/ManualMsgHandlingPeerTest.java +++ b/src/test/java/org/ldk/ManualMsgHandlingPeerTest.java @@ -130,9 +130,9 @@ public class ManualMsgHandlingPeerTest { } }); long message_handler = bindings.MessageHandler_new(chan_handler, route_handler); - long our_node_secret = bindings.LDKSecretKey_new(); //TODO: Need LDKSecretKey constructor + byte[] our_node_secret = new byte[32]; byte[] random_data = new byte[32]; - for (byte i = 0; i < 32; i++) { random_data[i] = i; } + for (byte i = 0; i < 32; i++) { random_data[i] = i; our_node_secret[i] = (byte) (i ^ 0xff); } long peer_manager = bindings.PeerManager_new(message_handler, our_node_secret, random_data, logger); diff --git a/src/test/java/org/ldk/PeerTest.java b/src/test/java/org/ldk/PeerTest.java index 76ed49ba..8f4bee74 100644 --- a/src/test/java/org/ldk/PeerTest.java +++ b/src/test/java/org/ldk/PeerTest.java @@ -99,7 +99,7 @@ public class PeerTest { byte[] random_data = new byte[32]; for (byte i = 0; i < 32; i++) { random_data[i] = (byte) ((i ^ seed) ^ 0xf0); } - this.peer_manager = bindings.PeerManager_new(message_handler, bindings.LDKKeysInterface_call_get_node_secret(keys_interface), random_data, logger); + this.peer_manager = bindings.PeerManager_new(message_handler, bindings.KeysInterface_call_get_node_secret(keys_interface), random_data, logger); } void connect_block(Block b, Transaction t, int height) { @@ -217,7 +217,7 @@ public class PeerTest { bindings.PeerManager_process_events(peer2.peer_manager); while (!list.isEmpty()) { list.poll().join(); } - long events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + long events = bindings.EventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); bindings.VecOrSliceDef events_arr_info = bindings.LDKCVecTempl_Event_arr_info(events); assert events_arr_info.datalen == 1; bindings.LDKEvent event = bindings.LDKEvent_ref_from_ptr(events_arr_info.dataptr); @@ -243,7 +243,7 @@ public class PeerTest { bindings.PeerManager_process_events(peer2.peer_manager); while (!list.isEmpty()) { list.poll().join(); } - events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + events = bindings.EventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); events_arr_info = bindings.LDKCVecTempl_Event_arr_info(events); assert events_arr_info.datalen == 1; event = bindings.LDKEvent_ref_from_ptr(events_arr_info.dataptr); @@ -297,7 +297,7 @@ public class PeerTest { bindings.PeerManager_process_events(peer1.peer_manager); while (!list.isEmpty()) { list.poll().join(); } - long peer2_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events); + long peer2_events = bindings.EventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events); bindings.VecOrSliceDef event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer2_events); assert event_arr_info.datalen == 1; bindings.LDKEvent forwardable = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); @@ -305,7 +305,7 @@ public class PeerTest { bindings.CVec_EventZ_free(peer2_events); bindings.ChannelManager_process_pending_htlc_forwards(peer2.chan_manager); - peer2_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events); + peer2_events = bindings.EventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events); event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer2_events); assert event_arr_info.datalen == 1; bindings.LDKEvent payment_recvd = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); @@ -318,7 +318,7 @@ public class PeerTest { bindings.PeerManager_process_events(peer1.peer_manager); while (!list.isEmpty()) { list.poll().join(); } - long peer1_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + long peer1_events = bindings.EventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer1_events); assert event_arr_info.datalen == 1; bindings.LDKEvent sent = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); -- 2.30.2