From fbf55c2a3c48fbb606cdef016c8b008b70348fd6 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 7 Oct 2020 16:42:49 -0400 Subject: [PATCH] Add ability to fetch all Vec details in one call. --- genbindings.py | 44 +++-- src/main/java/org/ldk/impl/bindings.java | 39 ++++- src/main/jni/bindings.c | 112 +++++++++++- src/main/jni/org_ldk_impl_bindings.h | 212 ++++++++++++++++++++++- src/test/java/org/ldk/PeerTest.java | 8 + 5 files changed, 398 insertions(+), 17 deletions(-) diff --git a/genbindings.py b/genbindings.py index b4f9323d..a9d91be8 100755 --- a/genbindings.py +++ b/genbindings.py @@ -469,14 +469,6 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg 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") - out_java.write("""package org.ldk.impl; - -public class bindings { - static { - System.loadLibrary(\"lightningjni\"); - init(java.lang.Enum.class); - } -""") out_c.write("""#include \"org_ldk_impl_bindings.h\" #include #include @@ -535,9 +527,22 @@ void __attribute__((destructor)) check_leaks() { DO_ASSERT(allocation_ll == NULL); } """) + out_java.write("""package org.ldk.impl; - out_java.write(""" - static native void init(java.lang.Class c); +public class bindings { + public static class VecOrSliceDef { + public long dataptr; + public long datalen; + public long stride; + public VecOrSliceDef(long dataptr, long datalen, long stride) { + this.dataptr = dataptr; this.datalen = datalen; this.stride = stride; + } + } + static { + System.loadLibrary(\"lightningjni\"); + init(java.lang.Enum.class, VecOrSliceDef.class); + } + static native void init(java.lang.Class c, java.lang.Class slicedef); public static native boolean deref_bool(long ptr); public static native long deref_long(long ptr); @@ -550,9 +555,15 @@ void __attribute__((destructor)) check_leaks() { """) out_c.write(""" jmethodID ordinal_meth = NULL; -JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) { +jmethodID slicedef_meth = NULL; +jclass slicedef_cls = NULL; +JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) { ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I"); DO_ASSERT(ordinal_meth != NULL); + slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "", "(JJJ)V"); + DO_ASSERT(slicedef_meth != NULL); + slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class); + DO_ASSERT(slicedef_cls != NULL); } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) { @@ -621,6 +632,7 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), const_val_regex = re.compile("^extern const ([A-Za-z_0-9]*) ([A-Za-z_0-9]*);$") line_indicates_result_regex = re.compile("^ bool result_ok;$") + line_indicates_vec_regex = re.compile("^ ([A-Za-z_0-9]*) \*data;$") line_indicates_opaque_regex = re.compile("^ bool is_owned;$") line_indicates_trait_regex = re.compile("^ ([A-Za-z_0-9]* \*?)\(\*([A-Za-z_0-9]*)\)\((const )?void \*this_arg(.*)\);$") assert(line_indicates_trait_regex.match(" uintptr_t (*send_data)(void *this_arg, LDKu8slice data, bool resume_read);")) @@ -645,6 +657,7 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), if line.startswith("} "): field_lines = [] struct_name = None + vec_ty = None obj_lines = cur_block_obj.split("\n") is_opaque = False is_result = False @@ -662,6 +675,7 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), in_block_comment = False else: struct_name_match = struct_name_regex.match(struct_line) + vec_ty_match = line_indicates_vec_regex.match(struct_line) if struct_name_match is not None: struct_name = struct_name_match.group(3) if struct_name_match.group(1) == "enum": @@ -675,6 +689,8 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), is_opaque = True elif line_indicates_result_regex.match(struct_line): is_result = True + elif vec_ty_match is not None and struct_name.startswith("LDKCVecTempl_"): + vec_ty = vec_ty_match.group(1) trait_fn_match = line_indicates_trait_regex.match(struct_line) if trait_fn_match is not None: trait_fn_lines.append(trait_fn_match) @@ -699,6 +715,12 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), out_c.write("}\n") elif is_result: result_templ_structs.add(struct_name) + elif vec_ty is not None: + out_java.write("\tpublic static native VecOrSliceDef " + struct_name + "_arr_info(long vec_ptr);\n") + out_c.write("JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_" + struct_name.replace("_", "_1") + "_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {\n") + out_c.write("\t" + struct_name + " *vec = (" + struct_name + "*)ptr;\n") + out_c.write("\treturn (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(" + vec_ty + "));\n") + out_c.write("}\n") elif is_unitary_enum: unitary_enums.add(struct_name) out_c.write("static inline " + struct_name + " " + struct_name + "_from_java(JNIEnv *env, jclass val) {\n") diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 6ff047a1..5a396277 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -1,12 +1,19 @@ package org.ldk.impl; public class bindings { + public static class VecOrSliceDef { + public long dataptr; + public long datalen; + public long stride; + public VecOrSliceDef(long dataptr, long datalen, long stride) { + this.dataptr = dataptr; this.datalen = datalen; this.stride = stride; + } + } static { System.loadLibrary("lightningjni"); - init(java.lang.Enum.class); + init(java.lang.Enum.class, VecOrSliceDef.class); } - - static native void init(java.lang.Class c); + static native void init(java.lang.Class c, java.lang.Class slicedef); public static native boolean deref_bool(long ptr); public static native long deref_long(long ptr); @@ -55,12 +62,15 @@ public class bindings { LDKSecp256k1Error_NotEnoughMemory, LDKSecp256k1Error_CallbackPanicked, } + public static native VecOrSliceDef LDKCVecTempl_u8_arr_info(long vec_ptr); public static native boolean LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(long arg); public static native long LDKCResult_NoneChannelMonitorUpdateErrZ_get_inner(long arg); public static native long LDKMonitorUpdateError_optional_none(); public static native boolean LDKCResult_NoneMonitorUpdateErrorZ_result_ok(long arg); public static native long LDKCResult_NoneMonitorUpdateErrorZ_get_inner(long arg); public static native long LDKOutPoint_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_TxOut_arr_info(long vec_ptr); + public static native VecOrSliceDef LDKCVecTempl_Signature_arr_info(long vec_ptr); public static native boolean LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(long arg); public static native long LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_inner(long arg); public static native boolean LDKCResult_SignatureNoneZ_result_ok(long arg); @@ -78,6 +88,7 @@ public class bindings { public static native boolean LDKCResult_NonePeerHandleErrorZ_result_ok(long arg); public static native long LDKCResult_NonePeerHandleErrorZ_get_inner(long arg); public static native long LDKHTLCOutputInCommitment_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_SpendableOutputDescriptor_arr_info(long vec_ptr); public static native long LDKAcceptChannel_optional_none(); public static native long LDKOpenChannel_optional_none(); public static native long LDKFundingCreated_optional_none(); @@ -91,6 +102,7 @@ public class bindings { public static native long LDKChannelReestablish_optional_none(); public static native long LDKNodeAnnouncement_optional_none(); public static native long LDKErrorMessage_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_MessageSendEvent_arr_info(long vec_ptr); public interface LDKMessageSendEventsProvider { long get_and_clear_pending_msg_events(); } @@ -98,6 +110,7 @@ public class bindings { 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); + public static native VecOrSliceDef LDKCVecTempl_Event_arr_info(long vec_ptr); public interface LDKEventsProvider { long get_and_clear_pending_events(); } @@ -125,6 +138,7 @@ public class bindings { public static native long LDKAccess_call_get_utxo(long arg, byte[] genesis_hash, long short_channel_id); public static native long LDKChannelPublicKeys_optional_none(); public static native long LDKPreCalculatedTxCreationKeys_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_HTLCOutputInCommitment_arr_info(long vec_ptr); public static native long LDKHolderCommitmentTransaction_optional_none(); public static native long LDKUnsignedChannelAnnouncement_optional_none(); public interface LDKChannelKeys { @@ -167,6 +181,7 @@ public class bindings { public static native long LDKChannelMonitor_optional_none(); public static native long LDKChannelMonitorUpdate_optional_none(); public static native long LDKMonitorEvent_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_MonitorEvent_arr_info(long vec_ptr); public interface LDKWatch { long watch_channel(long funding_txo, long monitor); long update_channel(long funding_txo, long update); @@ -205,7 +220,10 @@ public class bindings { // 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); public static native long LDKChainMonitor_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_C2TupleTempl_usize__Transaction_arr_info(long vec_ptr); public static native long LDKHTLCUpdate_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_Transaction_arr_info(long vec_ptr); + public static native VecOrSliceDef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut_arr_info(long vec_ptr); public interface LDKKeysInterface { long get_node_secret(); long get_destination_script(); @@ -230,7 +248,9 @@ public class bindings { public static native long LDKChannelManager_optional_none(); public static native long LDKChannelDetails_optional_none(); public static native long LDKInitFeatures_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_ChannelDetails_arr_info(long vec_ptr); public static native long LDKRoute_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_NetAddress_arr_info(long vec_ptr); public static native long LDKUpdateAddHTLC_optional_none(); public static native long LDKUpdateFulfillHTLC_optional_none(); public static native long LDKUpdateFailHTLC_optional_none(); @@ -300,6 +320,7 @@ public class bindings { // void LDKChannelMessageHandler_call_handle_error LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg public static native void LDKChannelMessageHandler_call_handle_error(long arg, long their_node_id, long msg); public static native long LDKChannelManagerReadArgs_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_ChannelMonitor_arr_info(long vec_ptr); public static native long LDKDecodeError_optional_none(); public static native long LDKPing_optional_none(); public static native long LDKPong_optional_none(); @@ -310,12 +331,19 @@ public class bindings { public static native long LDKUnsignedChannelUpdate_optional_none(); public static native long LDKQueryChannelRange_optional_none(); public static native long LDKReplyChannelRange_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_u64_arr_info(long vec_ptr); public static native long LDKQueryShortChannelIds_optional_none(); public static native long LDKReplyShortChannelIdsEnd_optional_none(); public static native long LDKGossipTimestampFilter_optional_none(); public static native long LDKLightningError_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_UpdateAddHTLC_arr_info(long vec_ptr); + public static native VecOrSliceDef LDKCVecTempl_UpdateFulfillHTLC_arr_info(long vec_ptr); + public static native VecOrSliceDef LDKCVecTempl_UpdateFailHTLC_arr_info(long vec_ptr); + public static native VecOrSliceDef LDKCVecTempl_UpdateFailMalformedHTLC_arr_info(long vec_ptr); public static native boolean LDKCResult_boolLightningErrorZ_result_ok(long arg); public static native long LDKCResult_boolLightningErrorZ_get_inner(long arg); + public static native VecOrSliceDef LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate_arr_info(long vec_ptr); + public static native VecOrSliceDef LDKCVecTempl_NodeAnnouncement_arr_info(long vec_ptr); public interface LDKRoutingMessageHandler { long handle_node_announcement(long msg); long handle_channel_announcement(long msg); @@ -357,6 +385,7 @@ public class bindings { // uint64_t LDKSocketDescriptor_call_hash LDKSocketDescriptor* arg public static native long LDKSocketDescriptor_call_hash(long arg); public static native long LDKPeerManager_optional_none(); + 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); public static native boolean LDKCResult_boolPeerHandleErrorZ_result_ok(long arg); @@ -368,12 +397,16 @@ public class bindings { public static native long LDKTxCreationKeys_optional_none(); public static native boolean LDKCResult_TxCreationKeysSecpErrorZ_result_ok(long arg); public static native long LDKCResult_TxCreationKeysSecpErrorZ_get_inner(long arg); + public static native VecOrSliceDef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature_arr_info(long vec_ptr); public static native long LDKRouteHop_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_RouteHop_arr_info(long vec_ptr); + public static native VecOrSliceDef LDKCVecTempl_CVecTempl_RouteHop_arr_info(long vec_ptr); public static native long LDKRouteHint_optional_none(); public static native long LDKRoutingFees_optional_none(); public static native boolean LDKCResult_RouteLightningErrorZ_result_ok(long arg); public static native long LDKCResult_RouteLightningErrorZ_get_inner(long arg); public static native long LDKNetworkGraph_optional_none(); + public static native VecOrSliceDef LDKCVecTempl_RouteHint_arr_info(long vec_ptr); public static native long LDKLockedNetworkGraph_optional_none(); public static native long LDKNetGraphMsgHandler_optional_none(); public static native long LDKDirectionalChannelInfo_optional_none(); diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index dcbd2cc5..6a6b8c81 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -50,9 +50,15 @@ void __attribute__((destructor)) check_leaks() { } jmethodID ordinal_meth = NULL; -JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) { +jmethodID slicedef_meth = NULL; +jclass slicedef_cls = NULL; +JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) { ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I"); DO_ASSERT(ordinal_meth != NULL); + slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "", "(JJJ)V"); + DO_ASSERT(slicedef_meth != NULL); + slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class); + DO_ASSERT(slicedef_cls != NULL); } JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) { @@ -341,6 +347,10 @@ static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error va } } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t)); +} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) { return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok; } @@ -371,6 +381,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOutPoint_1optional_1none ( ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut)); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature)); +} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) { return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok; } @@ -456,6 +474,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKHTLCOutputInCommitment_1op ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAcceptChannel_1optional_1none (JNIEnv * env, jclass _a) { LDKAcceptChannel *ret = MALLOC(sizeof(LDKAcceptChannel), "LDKAcceptChannel"); ret->inner = NULL; @@ -521,6 +543,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKErrorMessage_1optional_1no ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent)); +} typedef struct LDKMessageSendEventsProvider_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -582,6 +608,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_ return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent)); +} typedef struct LDKEventsProvider_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -801,6 +831,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPreCalculatedTxCreationKey ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKHTLCOutputInCommitment)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKHolderCommitmentTransaction_1optional_1none (JNIEnv * env, jclass _a) { LDKHolderCommitmentTransaction *ret = MALLOC(sizeof(LDKHolderCommitmentTransaction), "LDKHolderCommitmentTransaction"); ret->inner = NULL; @@ -1113,6 +1147,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1optional_1no ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMonitorEvent)); +} typedef struct LDKWatch_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -1433,11 +1471,23 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChainMonitor_1optional_1no ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKHTLCUpdate_1optional_1none (JNIEnv * env, jclass _a) { LDKHTLCUpdate *ret = MALLOC(sizeof(LDKHTLCUpdate), "LDKHTLCUpdate"); ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction)); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut)); +} typedef struct LDKKeysInterface_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -1604,11 +1654,19 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKInitFeatures_1optional_1no ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKChannelDetails)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoute_1optional_1none (JNIEnv * env, jclass _a) { LDKRoute *ret = MALLOC(sizeof(LDKRoute), "LDKRoute"); ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUpdateAddHTLC_1optional_1none (JNIEnv * env, jclass _a) { LDKUpdateAddHTLC *ret = MALLOC(sizeof(LDKUpdateAddHTLC), "LDKUpdateAddHTLC"); ret->inner = NULL; @@ -2062,6 +2120,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerReadArgs_1op ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKChannelMonitor)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1optional_1none (JNIEnv * env, jclass _a) { LDKDecodeError *ret = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); ret->inner = NULL; @@ -2112,6 +2174,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKReplyChannelRange_1optiona ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKQueryShortChannelIds_1optional_1none (JNIEnv * env, jclass _a) { LDKQueryShortChannelIds *ret = MALLOC(sizeof(LDKQueryShortChannelIds), "LDKQueryShortChannelIds"); ret->inner = NULL; @@ -2132,6 +2198,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKLightningError_1optional_1 ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKUpdateAddHTLC)); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKUpdateFulfillHTLC)); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKUpdateFailHTLC)); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKUpdateFailMalformedHTLC)); +} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) { return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok; } @@ -2142,6 +2224,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErro return (long)((LDKCResult_boolLightningErrorZ*)arg)->contents.err; } } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate)); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNodeAnnouncement)); +} typedef struct LDKRoutingMessageHandler_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -2432,6 +2522,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPeerManager_1optional_1non ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey)); +} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) { return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok; } @@ -2487,11 +2581,23 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSec return (long)((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->contents.err; } } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRouteHop_1optional_1none (JNIEnv * env, jclass _a) { LDKRouteHop *ret = MALLOC(sizeof(LDKRouteHop), "LDKRouteHop"); ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKRouteHop)); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRouteHint_1optional_1none (JNIEnv * env, jclass _a) { LDKRouteHint *ret = MALLOC(sizeof(LDKRouteHint), "LDKRouteHint"); ret->inner = NULL; @@ -2517,6 +2623,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNetworkGraph_1optional_1no ret->inner = NULL; return (long)ret; } +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) { + LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr; + return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKRouteHint)); +} JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKLockedNetworkGraph_1optional_1none (JNIEnv * env, jclass _a) { LDKLockedNetworkGraph *ret = MALLOC(sizeof(LDKLockedNetworkGraph), "LDKLockedNetworkGraph"); ret->inner = NULL; diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index c7b69658..9771fe26 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -10,10 +10,10 @@ extern "C" { /* * Class: org_ldk_impl_bindings * Method: init - * Signature: (Ljava/lang/Class;)V + * Signature: (Ljava/lang/Class;Ljava/lang/Class;)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_init - (JNIEnv *, jclass, jclass); + (JNIEnv *, jclass, jclass, jclass); /* * Class: org_ldk_impl_bindings @@ -79,6 +79,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_u8_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok @@ -127,6 +135,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdate JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOutPoint_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_TxOut_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_Signature_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok @@ -263,6 +287,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKHTLCOutputInCommitment_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_SpendableOutputDescriptor_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKAcceptChannel_optional_none @@ -367,6 +399,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNodeAnnouncement_1optional JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKErrorMessage_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_MessageSendEvent_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKMessageSendEventsProvider_new @@ -391,6 +431,14 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvide JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_Event_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKEventsProvider_new @@ -519,6 +567,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelPublicKeys_1optiona JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPreCalculatedTxCreationKeys_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_HTLCOutputInCommitment_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKHolderCommitmentTransaction_optional_none @@ -663,6 +719,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelMonitorUpdate_1opti JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_MonitorEvent_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKWatch_new @@ -791,6 +855,14 @@ JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1call_1get_1es JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChainMonitor_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_C2TupleTempl_usize__Transaction_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKHTLCUpdate_optional_none @@ -799,6 +871,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChainMonitor_1optional_1no JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKHTLCUpdate_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_Transaction_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKKeysInterface_new @@ -895,6 +983,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelDetails_1optional_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKInitFeatures_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_ChannelDetails_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKRoute_optional_none @@ -903,6 +999,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKInitFeatures_1optional_1no JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoute_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_NetAddress_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKUpdateAddHTLC_optional_none @@ -1135,6 +1239,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerReadArgs_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_ChannelMonitor_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKDecodeError_optional_none @@ -1215,6 +1327,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKQueryChannelRange_1optiona JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKReplyChannelRange_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_u64_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKQueryShortChannelIds_optional_none @@ -1247,6 +1367,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKGossipTimestampFilter_1opt JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKLightningError_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_UpdateAddHTLC_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_UpdateFulfillHTLC_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_UpdateFailHTLC_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_UpdateFailMalformedHTLC_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCResult_boolLightningErrorZ_result_ok @@ -1263,6 +1415,22 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningE JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_NodeAnnouncement_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKRoutingMessageHandler_new @@ -1391,6 +1559,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1ha JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPeerManager_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_PublicKey_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok @@ -1479,6 +1655,14 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeys JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKRouteHop_optional_none @@ -1487,6 +1671,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSec JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRouteHop_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_RouteHop_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_CVecTempl_RouteHop_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKRouteHint_optional_none @@ -1527,6 +1727,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNetworkGraph_1optional_1none (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVecTempl_RouteHint_arr_info + * Signature: (J)Lorg/ldk/impl/bindings/VecOrSliceDef; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKLockedNetworkGraph_optional_none diff --git a/src/test/java/org/ldk/PeerTest.java b/src/test/java/org/ldk/PeerTest.java index 3420de0b..dc07c909 100644 --- a/src/test/java/org/ldk/PeerTest.java +++ b/src/test/java/org/ldk/PeerTest.java @@ -15,6 +15,7 @@ public class PeerTest { final long keys_interface; final long config; final long chan_manager; + final long chan_manager_events; final long chan_handler; final long router; final long route_handler; @@ -50,6 +51,7 @@ public class PeerTest { this.keys_interface = bindings.KeysManager_as_KeysInterface(keys); this.config = bindings.UserConfig_default(); this.chan_manager = bindings.ChannelManager_new(bindings.LDKNetwork.LDKNetwork_Bitcoin, fee_estimator, chain_monitor, tx_broadcaster, logger, keys_interface, config, 1); + this.chan_manager_events = bindings.ChannelManager_as_EventsProvider(chan_manager); this.chan_handler = bindings.ChannelManager_as_ChannelMessageHandler(chan_manager); this.router = bindings.NetGraphMsgHandler_new(0, logger); @@ -70,6 +72,7 @@ public class PeerTest { bindings.KeysManager_free(keys); bindings.KeysInterface_free(keys_interface); bindings.ChannelManager_free(chan_manager); + bindings.EventsProvider_free(chan_manager_events); bindings.ChannelMessageHandler_free(chan_handler); bindings.NetGraphMsgHandler_free(router); bindings.RoutingMessageHandler_free(route_handler); @@ -145,6 +148,11 @@ 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); + bindings.VecOrSliceDef events_arr_info = bindings.LDKCVecTempl_Event_arr_info(events); + assert events_arr_info.datalen == 1; + bindings.CVec_EventZ_free(events); + long peer1_chans = bindings.ChannelManager_list_channels(peer1.chan_manager); long peer2_chans = bindings.ChannelManager_list_channels(peer2.chan_manager); assert bindings.vec_slice_len(peer1_chans) == 1; -- 2.39.5