X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjni%2Fbindings.c;h=93ad2e57aae3c48107f54cc73ba52fb6a7df89b4;hb=ac4869b989e27b4500e00e901ea5851604315345;hp=f3d3cca176a22081e38e1859a22f29ecb4e159a4;hpb=3c88e2f6e84c7f38723ff162ca72d613df5eeb97;p=ldk-java diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index f3d3cca1..93ad2e57 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -2867,10 +2867,7 @@ LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64 CHECK(obj != NULL); LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis); LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret; - if (ret_conv.free == LDKChannelKeys_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKChannelKeys_JCalls_clone(ret_conv.this_arg); - } + ret_conv = ChannelKeys_clone(ret); return ret_conv; } LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { @@ -6800,6 +6797,13 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1cl return ret_ref; } +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) { + LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig; + LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); + *ret = ChannelKeys_clone(orig_conv); + return (long)ret; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) { LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr; FREE((void*)this_ptr); @@ -12328,6 +12332,13 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * return ret_ref; } +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) { + LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig; + LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor"); + *ret = SocketDescriptor_clone(orig_conv); + return (long)ret; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) { LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr; FREE((void*)this_ptr);