#include <string.h>
#include <stdatomic.h>
+jmethodID ordinal_meth = NULL;
+JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) {
+ ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
+ assert(ordinal_meth != NULL);
+}
+
#include <threads.h>
static mtx_t allocation_mtx;
LDKSecretKey* key = (LDKSecretKey*)MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
return (long)key;
}
+static inline LDKChainError LDKChainError_from_java(JNIEnv *env, jclass val) {
+ switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
+ case 0: return LDKChainError_NotSupported;
+ case 1: return LDKChainError_NotWatched;
+ case 2: return LDKChainError_UnknownTx;
+ }
+ assert(false);
+}
+static inline jclass LDKChainError_to_java(JNIEnv *env, LDKChainError val) {
+ // TODO: This is pretty inefficient, we really need to cache the field IDs and class
+ jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKChainError;");
+ assert(enum_class != NULL);
+ switch (val) {
+ case LDKChainError_NotSupported: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChainError_NotSupported", "Lorg/ldk/impl/bindings$LDKChainError;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKChainError_NotWatched: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChainError_NotWatched", "Lorg/ldk/impl/bindings$LDKChainError;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKChainError_UnknownTx: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChainError_UnknownTx", "Lorg/ldk/impl/bindings$LDKChainError;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ default: assert(false);
+ }
+}
+
+static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
+ switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
+ case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
+ case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
+ }
+ assert(false);
+}
+static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
+ // TODO: This is pretty inefficient, we really need to cache the field IDs and class
+ jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
+ assert(enum_class != NULL);
+ switch (val) {
+ case LDKChannelMonitorUpdateErr_TemporaryFailure: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKChannelMonitorUpdateErr_PermanentFailure: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ default: assert(false);
+ }
+}
+
+static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
+ switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
+ case 0: return LDKConfirmationTarget_Background;
+ case 1: return LDKConfirmationTarget_Normal;
+ case 2: return LDKConfirmationTarget_HighPriority;
+ }
+ assert(false);
+}
+static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
+ // TODO: This is pretty inefficient, we really need to cache the field IDs and class
+ jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
+ assert(enum_class != NULL);
+ switch (val) {
+ case LDKConfirmationTarget_Background: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_Background", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKConfirmationTarget_Normal: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKConfirmationTarget_HighPriority: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ default: assert(false);
+ }
+}
+
+static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
+ switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
+ case 0: return LDKLevel_Off;
+ case 1: return LDKLevel_Error;
+ case 2: return LDKLevel_Warn;
+ case 3: return LDKLevel_Info;
+ case 4: return LDKLevel_Debug;
+ case 5: return LDKLevel_Trace;
+ }
+ assert(false);
+}
+static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
+ // TODO: This is pretty inefficient, we really need to cache the field IDs and class
+ jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKLevel;");
+ assert(enum_class != NULL);
+ switch (val) {
+ case LDKLevel_Off: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Off", "Lorg/ldk/impl/bindings$LDKLevel;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKLevel_Error: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Error", "Lorg/ldk/impl/bindings$LDKLevel;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKLevel_Warn: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Warn", "Lorg/ldk/impl/bindings$LDKLevel;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKLevel_Info: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Info", "Lorg/ldk/impl/bindings$LDKLevel;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKLevel_Debug: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Debug", "Lorg/ldk/impl/bindings$LDKLevel;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKLevel_Trace: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Trace", "Lorg/ldk/impl/bindings$LDKLevel;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ default: assert(false);
+ }
+}
+
+static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
+ switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
+ case 0: return LDKNetwork_Bitcoin;
+ case 1: return LDKNetwork_Testnet;
+ case 2: return LDKNetwork_Regtest;
+ }
+ assert(false);
+}
+static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
+ // TODO: This is pretty inefficient, we really need to cache the field IDs and class
+ jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetwork;");
+ assert(enum_class != NULL);
+ switch (val) {
+ case LDKNetwork_Bitcoin: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Bitcoin", "Lorg/ldk/impl/bindings$LDKNetwork;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKNetwork_Testnet: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Testnet", "Lorg/ldk/impl/bindings$LDKNetwork;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKNetwork_Regtest: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Regtest", "Lorg/ldk/impl/bindings$LDKNetwork;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ default: assert(false);
+ }
+}
+
+static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
+ switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
+ case 0: return LDKSecp256k1Error_IncorrectSignature;
+ case 1: return LDKSecp256k1Error_InvalidMessage;
+ case 2: return LDKSecp256k1Error_InvalidPublicKey;
+ case 3: return LDKSecp256k1Error_InvalidSignature;
+ case 4: return LDKSecp256k1Error_InvalidSecretKey;
+ case 5: return LDKSecp256k1Error_InvalidRecoveryId;
+ case 6: return LDKSecp256k1Error_InvalidTweak;
+ case 7: return LDKSecp256k1Error_NotEnoughMemory;
+ case 8: return LDKSecp256k1Error_CallbackPanicked;
+ }
+ assert(false);
+}
+static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
+ // TODO: This is pretty inefficient, we really need to cache the field IDs and class
+ jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(enum_class != NULL);
+ switch (val) {
+ case LDKSecp256k1Error_IncorrectSignature: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKSecp256k1Error_InvalidMessage: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKSecp256k1Error_InvalidPublicKey: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKSecp256k1Error_InvalidSignature: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKSecp256k1Error_InvalidSecretKey: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKSecp256k1Error_InvalidRecoveryId: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKSecp256k1Error_InvalidTweak: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKSecp256k1Error_NotEnoughMemory: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ case LDKSecp256k1Error_CallbackPanicked: {
+ jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
+ assert(field != NULL);
+ return (*env)->GetStaticObjectField(env, enum_class, field);
+ }
+ default: assert(false);
+ }
+}
+
typedef struct LDKMessageSendEventsProvider_JCalls {
atomic_size_t refcnt;
JNIEnv *env;
}
uintptr_t reentered_jcall(const void* this_arg) {
LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
- uintptr_t* ret = (uintptr_t*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->reentered_meth);
- uintptr_t res = *ret;
- FREE(ret);
- return res;
+ return (*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->reentered_meth);
}
static void LDKChainWatchInterface_JCalls_free(void* this_arg) {
LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
} LDKFeeEstimator_JCalls;
uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
- return (*j_calls->env)->CallIntMethod(j_calls->env, j_calls->o, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target);
+ jclass confirmation_target_conv = LDKConfirmationTarget_to_java(j_calls->env, confirmation_target);
+ return (*j_calls->env)->CallIntMethod(j_calls->env, j_calls->o, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
}
static void LDKFeeEstimator_JCalls_free(void* this_arg) {
LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
atomic_init(&calls->refcnt, 1);
calls->env = env;
calls->o = (*env)->NewGlobalRef(env, o);
- calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(J)I");
+ calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/impl/bindings$LDKConfirmationTarget;)I");
assert(calls->get_est_sat_per_1000_weight_meth != NULL);
LDKFeeEstimator ret = {
} LDKSocketDescriptor_JCalls;
uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
- uintptr_t* ret = (uintptr_t*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->send_data_meth, data, resume_read);
- uintptr_t res = *ret;
- FREE(ret);
- return res;
+ return (*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->send_data_meth, data, resume_read);
}
void disconnect_socket_jcall(void* this_arg) {
LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
}
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1Scriptu64ZChainErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1Scriptu64ZChainErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
LDKChainError arg_conv = *(LDKChainError*)arg;
FREE((void*)arg);
LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ), "LDKCResult_C2Tuple_Scriptu64ZChainErrorZ");
return CResult_NoneAPIErrorZ_free(arg_conv);
}
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
FREE((void*)arg);
LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
return (long)ret;
}
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
FREE((void*)arg);
LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
LDKOutPoint a_conv = *(LDKOutPoint*)a;
FREE((void*)a);
- a_conv._underlying_ref = false;
+ a_conv.is_owned = true;
LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
FREE((void*)b);
LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
LDKChannelAnnouncement a_conv = *(LDKChannelAnnouncement*)a;
FREE((void*)a);
- a_conv._underlying_ref = false;
+ a_conv.is_owned = true;
LDKChannelUpdate b_conv = *(LDKChannelUpdate*)b;
FREE((void*)b);
- b_conv._underlying_ref = false;
+ b_conv.is_owned = true;
LDKChannelUpdate c_conv = *(LDKChannelUpdate*)c;
FREE((void*)c);
- c_conv._underlying_ref = false;
+ c_conv.is_owned = true;
LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
*ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
return (long)ret;
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
LDKHTLCOutputInCommitment a_conv = *(LDKHTLCOutputInCommitment*)a;
FREE((void*)a);
- a_conv._underlying_ref = false;
+ a_conv.is_owned = true;
LDKSignature b_conv = *(LDKSignature*)b;
FREE((void*)b);
LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
return APIError_free(this_ptr_conv);
}
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
- LDKLevel* ret = MALLOC(sizeof(LDKLevel), "LDKLevel");
- *ret = Level_max();
- return (long)ret;
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
+ jclass ret = LDKLevel_to_java(_env, Level_max());
+ return ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelHandshakeConfig this_ptr_conv = *(LDKChannelHandshakeConfig*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelHandshakeConfig_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv * _env, jclass _b, jint minimum_depth_arg, jshort our_to_self_delay_arg, jlong our_htlc_minimum_msat_arg) {
LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
*ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
*ret = ChannelHandshakeConfig_default();
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelHandshakeLimits this_ptr_conv = *(LDKChannelHandshakeLimits*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelHandshakeLimits_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv * _env, jclass _b, jlong min_funding_satoshis_arg, jlong max_htlc_minimum_msat_arg, jlong min_max_htlc_value_in_flight_msat_arg, jlong max_channel_reserve_satoshis_arg, jshort min_max_accepted_htlcs_arg, jlong min_dust_limit_satoshis_arg, jlong max_dust_limit_satoshis_arg, jint max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, jshort their_to_self_delay_arg) {
LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
*ret = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
*ret = ChannelHandshakeLimits_default();
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelConfig this_ptr_conv = *(LDKChannelConfig*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelConfig_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv * _env, jclass _b, jint fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
*ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
*ret = ChannelConfig_default();
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
*ret = ChannelConfig_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUserConfig this_ptr_conv = *(LDKUserConfig*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UserConfig_free(this_ptr_conv);
}
LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
*ret = UserConfig_get_own_channel_config(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
LDKChannelHandshakeConfig val_conv = *(LDKChannelHandshakeConfig*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return UserConfig_set_own_channel_config(this_ptr_conv, val_conv);
}
LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
*ret = UserConfig_get_peer_channel_config_limits(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
LDKChannelHandshakeLimits val_conv = *(LDKChannelHandshakeLimits*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return UserConfig_set_peer_channel_config_limits(this_ptr_conv, val_conv);
}
LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
*ret = UserConfig_get_channel_options(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
LDKChannelConfig val_conv = *(LDKChannelConfig*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return UserConfig_set_channel_options(this_ptr_conv, val_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv * _env, jclass _b, jlong own_channel_config_arg, jlong peer_channel_config_limits_arg, jlong channel_options_arg) {
LDKChannelHandshakeConfig own_channel_config_arg_conv = *(LDKChannelHandshakeConfig*)own_channel_config_arg;
FREE((void*)own_channel_config_arg);
- own_channel_config_arg_conv._underlying_ref = false;
+ own_channel_config_arg_conv.is_owned = true;
LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv = *(LDKChannelHandshakeLimits*)peer_channel_config_limits_arg;
FREE((void*)peer_channel_config_limits_arg);
- peer_channel_config_limits_arg_conv._underlying_ref = false;
+ peer_channel_config_limits_arg_conv.is_owned = true;
LDKChannelConfig channel_options_arg_conv = *(LDKChannelConfig*)channel_options_arg;
FREE((void*)channel_options_arg);
- channel_options_arg_conv._underlying_ref = false;
+ channel_options_arg_conv.is_owned = true;
LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
*ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
*ret = UserConfig_default();
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainWatchedUtil_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChainWatchedUtil this_ptr_conv = *(LDKChainWatchedUtil*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChainWatchedUtil_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainWatchedUtil_1new(JNIEnv * _env, jclass _b) {
LDKChainWatchedUtil* ret = MALLOC(sizeof(LDKChainWatchedUtil), "LDKChainWatchedUtil");
*ret = ChainWatchedUtil_new();
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKBlockNotifier this_ptr_conv = *(LDKBlockNotifier*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return BlockNotifier_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1new(JNIEnv * _env, jclass _b, jlong chain_monitor) {
LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
- LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
+ if (chain_monitor_conv.free == LDKChainWatchInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
+ }
LDKBlockNotifier* ret = MALLOC(sizeof(LDKBlockNotifier), "LDKBlockNotifier");
*ret = BlockNotifier_new(chain_monitor_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1register_1listener(JNIEnv * _env, jclass _b, jlong this_arg, jlong listener) {
LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
LDKChainListener listener_conv = *(LDKChainListener*)listener;
- LDKChainListener_JCalls_clone(listener_conv.this_arg);
+ if (listener_conv.free == LDKChainListener_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKChainListener_JCalls_clone(listener_conv.this_arg);
+ }
return BlockNotifier_register_listener(this_arg_conv, listener_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainWatchInterfaceUtil_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChainWatchInterfaceUtil this_ptr_conv = *(LDKChainWatchInterfaceUtil*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChainWatchInterfaceUtil_free(this_ptr_conv);
}
return (long)ret;
}
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainWatchInterfaceUtil_1new(JNIEnv * _env, jclass _b, jlong network) {
- LDKNetwork network_conv = *(LDKNetwork*)network;
- FREE((void*)network);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainWatchInterfaceUtil_1new(JNIEnv * _env, jclass _b, jclass network) {
+ LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
LDKChainWatchInterfaceUtil* ret = MALLOC(sizeof(LDKChainWatchInterfaceUtil), "LDKChainWatchInterfaceUtil");
*ret = ChainWatchInterfaceUtil_new(network_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKOutPoint this_ptr_conv = *(LDKOutPoint*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return OutPoint_free(this_ptr_conv);
}
FREE((void*)txid_arg);
LDKOutPoint* ret = MALLOC(sizeof(LDKOutPoint), "LDKOutPoint");
*ret = OutPoint_new(txid_arg_conv, index_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKOutPoint* ret = MALLOC(sizeof(LDKOutPoint), "LDKOutPoint");
*ret = OutPoint_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKInMemoryChannelKeys this_ptr_conv = *(LDKInMemoryChannelKeys*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return InMemoryChannelKeys_free(this_ptr_conv);
}
FREE((void*)key_derivation_params);
LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
*ret = InMemoryChannelKeys_new(funding_key_conv, revocation_base_key_conv, payment_key_conv, delayed_payment_base_key_conv, htlc_base_key_conv, commitment_seed_conv, channel_value_satoshis, key_derivation_params_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
*ret = InMemoryChannelKeys_remote_pubkeys(this_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
*ret = InMemoryChannelKeys_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKKeysManager this_ptr_conv = *(LDKKeysManager*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return KeysManager_free(this_ptr_conv);
}
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv * _env, jclass _b, jbyteArray seed, jlong network, jlong starting_time_secs, jint starting_time_nanos) {
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv * _env, jclass _b, jbyteArray seed, jclass network, jlong starting_time_secs, jint starting_time_nanos) {
unsigned char seed_arr[32];
(*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
unsigned char (*seed_ref)[32] = &seed_arr;
- LDKNetwork network_conv = *(LDKNetwork*)network;
- FREE((void*)network);
+ LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
LDKKeysManager* ret = MALLOC(sizeof(LDKKeysManager), "LDKKeysManager");
*ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKKeysManager* this_arg_conv = (LDKKeysManager*)this_arg;
LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
*ret = KeysManager_derive_channel_keys(this_arg_conv, channel_value_satoshis, params_1, params_2);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelManager this_ptr_conv = *(LDKChannelManager*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelManager_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelDetails this_ptr_conv = *(LDKChannelDetails*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelDetails_free(this_ptr_conv);
}
LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
LDKInitFeatures* ret = MALLOC(sizeof(LDKInitFeatures), "LDKInitFeatures");
*ret = ChannelDetails_get_counterparty_features(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
LDKInitFeatures val_conv = *(LDKInitFeatures*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return ChannelDetails_set_counterparty_features(this_ptr_conv, val_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return PaymentSendFailure_free(this_ptr_conv);
}
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv * _env, jclass _b, jlong network, jlong fee_est, jlong monitor, jlong tx_broadcaster, jlong logger, jlong keys_manager, jlong config, jlong current_blockchain_height) {
- LDKNetwork network_conv = *(LDKNetwork*)network;
- FREE((void*)network);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv * _env, jclass _b, jclass network, jlong fee_est, jlong monitor, jlong tx_broadcaster, jlong logger, jlong keys_manager, jlong config, jlong current_blockchain_height) {
+ LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
- LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
+ if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
+ }
LDKManyChannelMonitor monitor_conv = *(LDKManyChannelMonitor*)monitor;
- LDKManyChannelMonitor_JCalls_clone(monitor_conv.this_arg);
+ if (monitor_conv.free == LDKManyChannelMonitor_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKManyChannelMonitor_JCalls_clone(monitor_conv.this_arg);
+ }
LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
- LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
+ if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
+ }
LDKLogger logger_conv = *(LDKLogger*)logger;
- LDKLogger_JCalls_clone(logger_conv.this_arg);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_clone(logger_conv.this_arg);
+ }
LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
- LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
+ if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
+ }
LDKUserConfig config_conv = *(LDKUserConfig*)config;
FREE((void*)config);
- config_conv._underlying_ref = false;
- uintptr_t current_blockchain_height_conv = *(uintptr_t*)current_blockchain_height;
- FREE((void*)current_blockchain_height);
+ config_conv.is_owned = true;
LDKChannelManager* ret = MALLOC(sizeof(LDKChannelManager), "LDKChannelManager");
- *ret = ChannelManager_new(network_conv, fee_est_conv, monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ *ret = ChannelManager_new(network_conv, fee_est_conv, monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)their_network_key);
LDKUserConfig override_config_conv = *(LDKUserConfig*)override_config;
FREE((void*)override_config);
- override_config_conv._underlying_ref = false;
+ override_config_conv.is_owned = true;
LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
*ret = ChannelManager_create_channel(this_arg_conv, their_network_key_conv, channel_value_satoshis, push_msat, user_id, override_config_conv);
return (long)ret;
unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
LDKOutPoint funding_txo_conv = *(LDKOutPoint*)funding_txo;
FREE((void*)funding_txo);
- funding_txo_conv._underlying_ref = false;
+ funding_txo_conv.is_owned = true;
return ChannelManager_funding_transaction_generated(this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelManagerReadArgs this_ptr_conv = *(LDKChannelManagerReadArgs*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelManagerReadArgs_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
- LDKKeysInterface_JCalls_clone(val_conv.this_arg);
+ if (val_conv.free == LDKKeysInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKKeysInterface_JCalls_clone(val_conv.this_arg);
+ }
return ChannelManagerReadArgs_set_keys_manager(this_ptr_conv, val_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
- LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
+ if (val_conv.free == LDKFeeEstimator_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
+ }
return ChannelManagerReadArgs_set_fee_estimator(this_ptr_conv, val_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
LDKManyChannelMonitor val_conv = *(LDKManyChannelMonitor*)val;
- LDKManyChannelMonitor_JCalls_clone(val_conv.this_arg);
+ if (val_conv.free == LDKManyChannelMonitor_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKManyChannelMonitor_JCalls_clone(val_conv.this_arg);
+ }
return ChannelManagerReadArgs_set_monitor(this_ptr_conv, val_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
- LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
+ if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
+ }
return ChannelManagerReadArgs_set_tx_broadcaster(this_ptr_conv, val_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
LDKLogger val_conv = *(LDKLogger*)val;
- LDKLogger_JCalls_clone(val_conv.this_arg);
+ if (val_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_clone(val_conv.this_arg);
+ }
return ChannelManagerReadArgs_set_logger(this_ptr_conv, val_conv);
}
LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
*ret = ChannelManagerReadArgs_get_default_config(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
LDKUserConfig val_conv = *(LDKUserConfig*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return ChannelManagerReadArgs_set_default_config(this_ptr_conv, val_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv * _env, jclass _b, jlong keys_manager, jlong fee_estimator, jlong monitor, jlong tx_broadcaster, jlong logger, jlong default_config, jlong channel_monitors) {
LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
- LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
+ if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
+ }
LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
- LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
+ if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
+ }
LDKManyChannelMonitor monitor_conv = *(LDKManyChannelMonitor*)monitor;
- LDKManyChannelMonitor_JCalls_clone(monitor_conv.this_arg);
+ if (monitor_conv.free == LDKManyChannelMonitor_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKManyChannelMonitor_JCalls_clone(monitor_conv.this_arg);
+ }
LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
- LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
+ if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
+ }
LDKLogger logger_conv = *(LDKLogger*)logger;
- LDKLogger_JCalls_clone(logger_conv.this_arg);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_clone(logger_conv.this_arg);
+ }
LDKUserConfig default_config_conv = *(LDKUserConfig*)default_config;
FREE((void*)default_config);
- default_config_conv._underlying_ref = false;
+ default_config_conv.is_owned = true;
LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
FREE((void*)channel_monitors);
LDKChannelManagerReadArgs* ret = MALLOC(sizeof(LDKChannelManagerReadArgs), "LDKChannelManagerReadArgs");
*ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelMonitorUpdate this_ptr_conv = *(LDKChannelMonitorUpdate*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelMonitorUpdate_free(this_ptr_conv);
}
FREE((void*)ser);
LDKChannelMonitorUpdate* ret = MALLOC(sizeof(LDKChannelMonitorUpdate), "LDKChannelMonitorUpdate");
*ret = ChannelMonitorUpdate_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKMonitorUpdateError this_ptr_conv = *(LDKMonitorUpdateError*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return MonitorUpdateError_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return MonitorEvent_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKHTLCUpdate this_ptr_conv = *(LDKHTLCUpdate*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return HTLCUpdate_free(this_ptr_conv);
}
FREE((void*)ser);
LDKHTLCUpdate* ret = MALLOC(sizeof(LDKHTLCUpdate), "LDKHTLCUpdate");
*ret = HTLCUpdate_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelMonitor this_ptr_conv = *(LDKChannelMonitor*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelMonitor_free(this_ptr_conv);
}
LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
LDKChannelMonitorUpdate updates_conv = *(LDKChannelMonitorUpdate*)updates;
FREE((void*)updates);
- updates_conv._underlying_ref = false;
+ updates_conv.is_owned = true;
LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
LDKLogger* logger_conv = (LDKLogger*)logger;
LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKDecodeError this_ptr_conv = *(LDKDecodeError*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return DecodeError_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKInit this_ptr_conv = *(LDKInit*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return Init_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKErrorMessage this_ptr_conv = *(LDKErrorMessage*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ErrorMessage_free(this_ptr_conv);
}
FREE((void*)data_arg);
LDKErrorMessage* ret = MALLOC(sizeof(LDKErrorMessage), "LDKErrorMessage");
*ret = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKPing this_ptr_conv = *(LDKPing*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return Ping_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
LDKPing* ret = MALLOC(sizeof(LDKPing), "LDKPing");
*ret = Ping_new(ponglen_arg, byteslen_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKPong this_ptr_conv = *(LDKPong*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return Pong_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
LDKPong* ret = MALLOC(sizeof(LDKPong), "LDKPong");
*ret = Pong_new(byteslen_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKOpenChannel this_ptr_conv = *(LDKOpenChannel*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return OpenChannel_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKAcceptChannel this_ptr_conv = *(LDKAcceptChannel*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return AcceptChannel_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKFundingCreated this_ptr_conv = *(LDKFundingCreated*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return FundingCreated_free(this_ptr_conv);
}
FREE((void*)signature_arg);
LDKFundingCreated* ret = MALLOC(sizeof(LDKFundingCreated), "LDKFundingCreated");
*ret = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_conv, funding_output_index_arg, signature_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKFundingSigned this_ptr_conv = *(LDKFundingSigned*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return FundingSigned_free(this_ptr_conv);
}
FREE((void*)signature_arg);
LDKFundingSigned* ret = MALLOC(sizeof(LDKFundingSigned), "LDKFundingSigned");
*ret = FundingSigned_new(channel_id_arg_conv, signature_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKFundingLocked this_ptr_conv = *(LDKFundingLocked*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return FundingLocked_free(this_ptr_conv);
}
FREE((void*)next_per_commitment_point_arg);
LDKFundingLocked* ret = MALLOC(sizeof(LDKFundingLocked), "LDKFundingLocked");
*ret = FundingLocked_new(channel_id_arg_conv, next_per_commitment_point_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKShutdown this_ptr_conv = *(LDKShutdown*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return Shutdown_free(this_ptr_conv);
}
FREE((void*)scriptpubkey_arg);
LDKShutdown* ret = MALLOC(sizeof(LDKShutdown), "LDKShutdown");
*ret = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKClosingSigned this_ptr_conv = *(LDKClosingSigned*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ClosingSigned_free(this_ptr_conv);
}
FREE((void*)signature_arg);
LDKClosingSigned* ret = MALLOC(sizeof(LDKClosingSigned), "LDKClosingSigned");
*ret = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUpdateAddHTLC this_ptr_conv = *(LDKUpdateAddHTLC*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UpdateAddHTLC_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUpdateFulfillHTLC this_ptr_conv = *(LDKUpdateFulfillHTLC*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UpdateFulfillHTLC_free(this_ptr_conv);
}
FREE((void*)payment_preimage_arg);
LDKUpdateFulfillHTLC* ret = MALLOC(sizeof(LDKUpdateFulfillHTLC), "LDKUpdateFulfillHTLC");
*ret = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUpdateFailHTLC this_ptr_conv = *(LDKUpdateFailHTLC*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UpdateFailHTLC_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUpdateFailMalformedHTLC this_ptr_conv = *(LDKUpdateFailMalformedHTLC*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UpdateFailMalformedHTLC_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKCommitmentSigned this_ptr_conv = *(LDKCommitmentSigned*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return CommitmentSigned_free(this_ptr_conv);
}
FREE((void*)htlc_signatures_arg);
LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
*ret = CommitmentSigned_new(channel_id_arg_conv, signature_arg_conv, htlc_signatures_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKRevokeAndACK this_ptr_conv = *(LDKRevokeAndACK*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return RevokeAndACK_free(this_ptr_conv);
}
FREE((void*)next_per_commitment_point_arg);
LDKRevokeAndACK* ret = MALLOC(sizeof(LDKRevokeAndACK), "LDKRevokeAndACK");
*ret = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_conv, next_per_commitment_point_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUpdateFee this_ptr_conv = *(LDKUpdateFee*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UpdateFee_free(this_ptr_conv);
}
FREE((void*)channel_id_arg);
LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
*ret = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKDataLossProtect this_ptr_conv = *(LDKDataLossProtect*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return DataLossProtect_free(this_ptr_conv);
}
FREE((void*)my_current_per_commitment_point_arg);
LDKDataLossProtect* ret = MALLOC(sizeof(LDKDataLossProtect), "LDKDataLossProtect");
*ret = DataLossProtect_new(your_last_per_commitment_secret_arg_conv, my_current_per_commitment_point_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelReestablish this_ptr_conv = *(LDKChannelReestablish*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelReestablish_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKAnnouncementSignatures this_ptr_conv = *(LDKAnnouncementSignatures*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return AnnouncementSignatures_free(this_ptr_conv);
}
FREE((void*)bitcoin_signature_arg);
LDKAnnouncementSignatures* ret = MALLOC(sizeof(LDKAnnouncementSignatures), "LDKAnnouncementSignatures");
*ret = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUnsignedNodeAnnouncement this_ptr_conv = *(LDKUnsignedNodeAnnouncement*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UnsignedNodeAnnouncement_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKNodeAnnouncement this_ptr_conv = *(LDKNodeAnnouncement*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return NodeAnnouncement_free(this_ptr_conv);
}
LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
LDKUnsignedNodeAnnouncement* ret = MALLOC(sizeof(LDKUnsignedNodeAnnouncement), "LDKUnsignedNodeAnnouncement");
*ret = NodeAnnouncement_get_contents(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
LDKUnsignedNodeAnnouncement val_conv = *(LDKUnsignedNodeAnnouncement*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return NodeAnnouncement_set_contents(this_ptr_conv, val_conv);
}
FREE((void*)signature_arg);
LDKUnsignedNodeAnnouncement contents_arg_conv = *(LDKUnsignedNodeAnnouncement*)contents_arg;
FREE((void*)contents_arg);
- contents_arg_conv._underlying_ref = false;
+ contents_arg_conv.is_owned = true;
LDKNodeAnnouncement* ret = MALLOC(sizeof(LDKNodeAnnouncement), "LDKNodeAnnouncement");
*ret = NodeAnnouncement_new(signature_arg_conv, contents_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUnsignedChannelAnnouncement this_ptr_conv = *(LDKUnsignedChannelAnnouncement*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UnsignedChannelAnnouncement_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelAnnouncement this_ptr_conv = *(LDKChannelAnnouncement*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelAnnouncement_free(this_ptr_conv);
}
LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
LDKUnsignedChannelAnnouncement* ret = MALLOC(sizeof(LDKUnsignedChannelAnnouncement), "LDKUnsignedChannelAnnouncement");
*ret = ChannelAnnouncement_get_contents(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
LDKUnsignedChannelAnnouncement val_conv = *(LDKUnsignedChannelAnnouncement*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return ChannelAnnouncement_set_contents(this_ptr_conv, val_conv);
}
FREE((void*)bitcoin_signature_2_arg);
LDKUnsignedChannelAnnouncement contents_arg_conv = *(LDKUnsignedChannelAnnouncement*)contents_arg;
FREE((void*)contents_arg);
- contents_arg_conv._underlying_ref = false;
+ contents_arg_conv.is_owned = true;
LDKChannelAnnouncement* ret = MALLOC(sizeof(LDKChannelAnnouncement), "LDKChannelAnnouncement");
*ret = ChannelAnnouncement_new(node_signature_1_arg_conv, node_signature_2_arg_conv, bitcoin_signature_1_arg_conv, bitcoin_signature_2_arg_conv, contents_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKUnsignedChannelUpdate this_ptr_conv = *(LDKUnsignedChannelUpdate*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return UnsignedChannelUpdate_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelUpdate this_ptr_conv = *(LDKChannelUpdate*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelUpdate_free(this_ptr_conv);
}
LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
LDKUnsignedChannelUpdate* ret = MALLOC(sizeof(LDKUnsignedChannelUpdate), "LDKUnsignedChannelUpdate");
*ret = ChannelUpdate_get_contents(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
LDKUnsignedChannelUpdate val_conv = *(LDKUnsignedChannelUpdate*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return ChannelUpdate_set_contents(this_ptr_conv, val_conv);
}
FREE((void*)signature_arg);
LDKUnsignedChannelUpdate contents_arg_conv = *(LDKUnsignedChannelUpdate*)contents_arg;
FREE((void*)contents_arg);
- contents_arg_conv._underlying_ref = false;
+ contents_arg_conv.is_owned = true;
LDKChannelUpdate* ret = MALLOC(sizeof(LDKChannelUpdate), "LDKChannelUpdate");
*ret = ChannelUpdate_new(signature_arg_conv, contents_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKLightningError this_ptr_conv = *(LDKLightningError*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return LightningError_free(this_ptr_conv);
}
FREE((void*)action_arg);
LDKLightningError* ret = MALLOC(sizeof(LDKLightningError), "LDKLightningError");
*ret = LightningError_new(err_arg_conv, action_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKCommitmentUpdate this_ptr_conv = *(LDKCommitmentUpdate*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return CommitmentUpdate_free(this_ptr_conv);
}
LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
*ret = CommitmentUpdate_get_update_fee(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
LDKUpdateFee val_conv = *(LDKUpdateFee*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return CommitmentUpdate_set_update_fee(this_ptr_conv, val_conv);
}
LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
*ret = CommitmentUpdate_get_commitment_signed(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
LDKCommitmentSigned val_conv = *(LDKCommitmentSigned*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return CommitmentUpdate_set_commitment_signed(this_ptr_conv, val_conv);
}
FREE((void*)update_fail_malformed_htlcs_arg);
LDKUpdateFee update_fee_arg_conv = *(LDKUpdateFee*)update_fee_arg;
FREE((void*)update_fee_arg);
- update_fee_arg_conv._underlying_ref = false;
+ update_fee_arg_conv.is_owned = true;
LDKCommitmentSigned commitment_signed_arg_conv = *(LDKCommitmentSigned*)commitment_signed_arg;
FREE((void*)commitment_signed_arg);
- commitment_signed_arg_conv._underlying_ref = false;
+ commitment_signed_arg_conv.is_owned = true;
LDKCommitmentUpdate* ret = MALLOC(sizeof(LDKCommitmentUpdate), "LDKCommitmentUpdate");
*ret = CommitmentUpdate_new(update_add_htlcs_arg_conv, update_fulfill_htlcs_arg_conv, update_fail_htlcs_arg_conv, update_fail_malformed_htlcs_arg_conv, update_fee_arg_conv, commitment_signed_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKAcceptChannel* ret = MALLOC(sizeof(LDKAcceptChannel), "LDKAcceptChannel");
*ret = AcceptChannel_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKAnnouncementSignatures* ret = MALLOC(sizeof(LDKAnnouncementSignatures), "LDKAnnouncementSignatures");
*ret = AnnouncementSignatures_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKChannelReestablish* ret = MALLOC(sizeof(LDKChannelReestablish), "LDKChannelReestablish");
*ret = ChannelReestablish_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKClosingSigned* ret = MALLOC(sizeof(LDKClosingSigned), "LDKClosingSigned");
*ret = ClosingSigned_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
*ret = CommitmentSigned_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKFundingCreated* ret = MALLOC(sizeof(LDKFundingCreated), "LDKFundingCreated");
*ret = FundingCreated_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKFundingSigned* ret = MALLOC(sizeof(LDKFundingSigned), "LDKFundingSigned");
*ret = FundingSigned_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKFundingLocked* ret = MALLOC(sizeof(LDKFundingLocked), "LDKFundingLocked");
*ret = FundingLocked_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKInit* ret = MALLOC(sizeof(LDKInit), "LDKInit");
*ret = Init_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKOpenChannel* ret = MALLOC(sizeof(LDKOpenChannel), "LDKOpenChannel");
*ret = OpenChannel_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKRevokeAndACK* ret = MALLOC(sizeof(LDKRevokeAndACK), "LDKRevokeAndACK");
*ret = RevokeAndACK_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKShutdown* ret = MALLOC(sizeof(LDKShutdown), "LDKShutdown");
*ret = Shutdown_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKUpdateFailHTLC* ret = MALLOC(sizeof(LDKUpdateFailHTLC), "LDKUpdateFailHTLC");
*ret = UpdateFailHTLC_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKUpdateFailMalformedHTLC* ret = MALLOC(sizeof(LDKUpdateFailMalformedHTLC), "LDKUpdateFailMalformedHTLC");
*ret = UpdateFailMalformedHTLC_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
*ret = UpdateFee_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKUpdateFulfillHTLC* ret = MALLOC(sizeof(LDKUpdateFulfillHTLC), "LDKUpdateFulfillHTLC");
*ret = UpdateFulfillHTLC_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKUpdateAddHTLC* ret = MALLOC(sizeof(LDKUpdateAddHTLC), "LDKUpdateAddHTLC");
*ret = UpdateAddHTLC_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKPing* ret = MALLOC(sizeof(LDKPing), "LDKPing");
*ret = Ping_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKPong* ret = MALLOC(sizeof(LDKPong), "LDKPong");
*ret = Pong_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKUnsignedChannelAnnouncement* ret = MALLOC(sizeof(LDKUnsignedChannelAnnouncement), "LDKUnsignedChannelAnnouncement");
*ret = UnsignedChannelAnnouncement_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKChannelAnnouncement* ret = MALLOC(sizeof(LDKChannelAnnouncement), "LDKChannelAnnouncement");
*ret = ChannelAnnouncement_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKUnsignedChannelUpdate* ret = MALLOC(sizeof(LDKUnsignedChannelUpdate), "LDKUnsignedChannelUpdate");
*ret = UnsignedChannelUpdate_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKChannelUpdate* ret = MALLOC(sizeof(LDKChannelUpdate), "LDKChannelUpdate");
*ret = ChannelUpdate_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKErrorMessage* ret = MALLOC(sizeof(LDKErrorMessage), "LDKErrorMessage");
*ret = ErrorMessage_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKUnsignedNodeAnnouncement* ret = MALLOC(sizeof(LDKUnsignedNodeAnnouncement), "LDKUnsignedNodeAnnouncement");
*ret = UnsignedNodeAnnouncement_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKNodeAnnouncement* ret = MALLOC(sizeof(LDKNodeAnnouncement), "LDKNodeAnnouncement");
*ret = NodeAnnouncement_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKMessageHandler this_ptr_conv = *(LDKMessageHandler*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return MessageHandler_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
- LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
+ if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
+ }
return MessageHandler_set_chan_handler(this_ptr_conv, val_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
- LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
+ if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
+ }
return MessageHandler_set_route_handler(this_ptr_conv, val_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
- LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
+ if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
+ }
LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
- LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
+ if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
+ }
LDKMessageHandler* ret = MALLOC(sizeof(LDKMessageHandler), "LDKMessageHandler");
*ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKPeerHandleError this_ptr_conv = *(LDKPeerHandleError*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return PeerHandleError_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
LDKPeerHandleError* ret = MALLOC(sizeof(LDKPeerHandleError), "LDKPeerHandleError");
*ret = PeerHandleError_new(no_connection_possible_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKPeerManager this_ptr_conv = *(LDKPeerManager*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
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) {
LDKMessageHandler message_handler_conv = *(LDKMessageHandler*)message_handler;
FREE((void*)message_handler);
- message_handler_conv._underlying_ref = false;
+ message_handler_conv.is_owned = true;
LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret;
FREE((void*)our_node_secret);
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;
LDKLogger logger_conv = *(LDKLogger*)logger;
- LDKLogger_JCalls_clone(logger_conv.this_arg);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // 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 = MALLOC(sizeof(LDKPeerManager), "LDKPeerManager");
*ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
FREE((void*)their_node_id);
LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
- LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
+ if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
+ }
LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
*ret = PeerManager_new_outbound_connection(this_arg_conv, their_node_id_conv, descriptor_conv);
return (long)ret;
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
- LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
+ if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
+ }
LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
*ret = PeerManager_new_inbound_connection(this_arg_conv, descriptor_conv);
return (long)ret;
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKTxCreationKeys this_ptr_conv = *(LDKTxCreationKeys*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return TxCreationKeys_free(this_ptr_conv);
}
FREE((void*)a_delayed_payment_key_arg);
LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
*ret = TxCreationKeys_new(per_commitment_point_arg_conv, revocation_key_arg_conv, a_htlc_key_arg_conv, b_htlc_key_arg_conv, a_delayed_payment_key_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
*ret = TxCreationKeys_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKPreCalculatedTxCreationKeys this_ptr_conv = *(LDKPreCalculatedTxCreationKeys*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return PreCalculatedTxCreationKeys_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
LDKTxCreationKeys keys_conv = *(LDKTxCreationKeys*)keys;
FREE((void*)keys);
- keys_conv._underlying_ref = false;
+ keys_conv.is_owned = true;
LDKPreCalculatedTxCreationKeys* ret = MALLOC(sizeof(LDKPreCalculatedTxCreationKeys), "LDKPreCalculatedTxCreationKeys");
*ret = PreCalculatedTxCreationKeys_new(keys_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKPreCalculatedTxCreationKeys* this_arg_conv = (LDKPreCalculatedTxCreationKeys*)this_arg;
LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
*ret = PreCalculatedTxCreationKeys_trust_key_derivation(this_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelPublicKeys this_ptr_conv = *(LDKChannelPublicKeys*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelPublicKeys_free(this_ptr_conv);
}
FREE((void*)htlc_basepoint_arg);
LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
*ret = ChannelPublicKeys_new(funding_pubkey_arg_conv, revocation_basepoint_arg_conv, payment_point_arg_conv, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
*ret = ChannelPublicKeys_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKHTLCOutputInCommitment this_ptr_conv = *(LDKHTLCOutputInCommitment*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return HTLCOutputInCommitment_free(this_ptr_conv);
}
FREE((void*)ser);
LDKHTLCOutputInCommitment* ret = MALLOC(sizeof(LDKHTLCOutputInCommitment), "LDKHTLCOutputInCommitment");
*ret = HTLCOutputInCommitment_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKLocalCommitmentTransaction this_ptr_conv = *(LDKLocalCommitmentTransaction*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return LocalCommitmentTransaction_free(this_ptr_conv);
}
FREE((void*)their_funding_key);
LDKTxCreationKeys local_keys_conv = *(LDKTxCreationKeys*)local_keys;
FREE((void*)local_keys);
- local_keys_conv._underlying_ref = false;
+ local_keys_conv.is_owned = true;
LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
FREE((void*)htlc_data);
LDKLocalCommitmentTransaction* ret = MALLOC(sizeof(LDKLocalCommitmentTransaction), "LDKLocalCommitmentTransaction");
*ret = LocalCommitmentTransaction_new_missing_local_sig(unsigned_tx_conv, their_sig_conv, our_funding_key_conv, their_funding_key_conv, local_keys_conv, feerate_per_kw, htlc_data_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKLocalCommitmentTransaction* this_arg_conv = (LDKLocalCommitmentTransaction*)this_arg;
LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
*ret = LocalCommitmentTransaction_trust_key_derivation(this_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKLocalCommitmentTransaction* ret = MALLOC(sizeof(LDKLocalCommitmentTransaction), "LDKLocalCommitmentTransaction");
*ret = LocalCommitmentTransaction_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKInitFeatures this_ptr_conv = *(LDKInitFeatures*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return InitFeatures_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKNodeFeatures this_ptr_conv = *(LDKNodeFeatures*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return NodeFeatures_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelFeatures this_ptr_conv = *(LDKChannelFeatures*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelFeatures_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKRouteHop this_ptr_conv = *(LDKRouteHop*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return RouteHop_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKRoute this_ptr_conv = *(LDKRoute*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return Route_free(this_ptr_conv);
}
FREE((void*)paths_arg);
LDKRoute* ret = MALLOC(sizeof(LDKRoute), "LDKRoute");
*ret = Route_new(paths_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKRoute* ret = MALLOC(sizeof(LDKRoute), "LDKRoute");
*ret = Route_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKRouteHint this_ptr_conv = *(LDKRouteHint*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return RouteHint_free(this_ptr_conv);
}
LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
*ret = RouteHint_get_fees(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
LDKRoutingFees val_conv = *(LDKRoutingFees*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return RouteHint_set_fees(this_ptr_conv, val_conv);
}
FREE((void*)src_node_id_arg);
LDKRoutingFees fees_arg_conv = *(LDKRoutingFees*)fees_arg;
FREE((void*)fees_arg);
- fees_arg_conv._underlying_ref = false;
+ fees_arg_conv.is_owned = true;
LDKRouteHint* ret = MALLOC(sizeof(LDKRouteHint), "LDKRouteHint");
*ret = RouteHint_new(src_node_id_arg_conv, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
FREE((void*)last_hops);
LDKLogger logger_conv = *(LDKLogger*)logger;
- LDKLogger_JCalls_clone(logger_conv.this_arg);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_clone(logger_conv.this_arg);
+ }
LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
*ret = get_route(our_node_id_conv, network_conv, target_conv, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
return (long)ret;
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKNetworkGraph this_ptr_conv = *(LDKNetworkGraph*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return NetworkGraph_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKLockedNetworkGraph this_ptr_conv = *(LDKLockedNetworkGraph*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return LockedNetworkGraph_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKNetGraphMsgHandler this_ptr_conv = *(LDKNetGraphMsgHandler*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return NetGraphMsgHandler_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_monitor, jlong logger) {
LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
- LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
+ if (chain_monitor_conv.free == LDKChainWatchInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
+ }
LDKLogger logger_conv = *(LDKLogger*)logger;
- LDKLogger_JCalls_clone(logger_conv.this_arg);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_clone(logger_conv.this_arg);
+ }
LDKNetGraphMsgHandler* ret = MALLOC(sizeof(LDKNetGraphMsgHandler), "LDKNetGraphMsgHandler");
*ret = NetGraphMsgHandler_new(chain_monitor_conv, logger_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_monitor, jlong logger, jlong network_graph) {
LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
- LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
+ if (chain_monitor_conv.free == LDKChainWatchInterface_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
+ }
LDKLogger logger_conv = *(LDKLogger*)logger;
- LDKLogger_JCalls_clone(logger_conv.this_arg);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_clone(logger_conv.this_arg);
+ }
LDKNetworkGraph network_graph_conv = *(LDKNetworkGraph*)network_graph;
FREE((void*)network_graph);
- network_graph_conv._underlying_ref = false;
+ network_graph_conv.is_owned = true;
LDKNetGraphMsgHandler* ret = MALLOC(sizeof(LDKNetGraphMsgHandler), "LDKNetGraphMsgHandler");
*ret = NetGraphMsgHandler_from_net_graph(chain_monitor_conv, logger_conv, network_graph_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKNetGraphMsgHandler* this_arg_conv = (LDKNetGraphMsgHandler*)this_arg;
LDKLockedNetworkGraph* ret = MALLOC(sizeof(LDKLockedNetworkGraph), "LDKLockedNetworkGraph");
*ret = NetGraphMsgHandler_read_locked_graph(this_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKLockedNetworkGraph* this_arg_conv = (LDKLockedNetworkGraph*)this_arg;
LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
*ret = LockedNetworkGraph_graph(this_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKDirectionalChannelInfo this_ptr_conv = *(LDKDirectionalChannelInfo*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return DirectionalChannelInfo_free(this_ptr_conv);
}
FREE((void*)ser);
LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
*ret = DirectionalChannelInfo_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKChannelInfo this_ptr_conv = *(LDKChannelInfo*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return ChannelInfo_free(this_ptr_conv);
}
LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
*ret = ChannelInfo_get_one_to_two(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
LDKDirectionalChannelInfo val_conv = *(LDKDirectionalChannelInfo*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return ChannelInfo_set_one_to_two(this_ptr_conv, val_conv);
}
LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
*ret = ChannelInfo_get_two_to_one(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
LDKDirectionalChannelInfo val_conv = *(LDKDirectionalChannelInfo*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return ChannelInfo_set_two_to_one(this_ptr_conv, val_conv);
}
FREE((void*)ser);
LDKChannelInfo* ret = MALLOC(sizeof(LDKChannelInfo), "LDKChannelInfo");
*ret = ChannelInfo_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKRoutingFees this_ptr_conv = *(LDKRoutingFees*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return RoutingFees_free(this_ptr_conv);
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
*ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
*ret = RoutingFees_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKNodeAnnouncementInfo this_ptr_conv = *(LDKNodeAnnouncementInfo*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return NodeAnnouncementInfo_free(this_ptr_conv);
}
FREE((void*)ser);
LDKNodeAnnouncementInfo* ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo");
*ret = NodeAnnouncementInfo_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
LDKNodeInfo this_ptr_conv = *(LDKNodeInfo*)this_ptr;
FREE((void*)this_ptr);
- this_ptr_conv._underlying_ref = false;
+ this_ptr_conv.is_owned = true;
return NodeInfo_free(this_ptr_conv);
}
LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
*ret = NodeInfo_get_lowest_inbound_channel_fees(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
LDKRoutingFees val_conv = *(LDKRoutingFees*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return NodeInfo_set_lowest_inbound_channel_fees(this_ptr_conv, val_conv);
}
LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
LDKNodeAnnouncementInfo* ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo");
*ret = NodeInfo_get_announcement_info(this_ptr_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
LDKNodeAnnouncementInfo val_conv = *(LDKNodeAnnouncementInfo*)val;
FREE((void*)val);
- val_conv._underlying_ref = false;
+ val_conv.is_owned = true;
return NodeInfo_set_announcement_info(this_ptr_conv, val_conv);
}
FREE((void*)channels_arg);
LDKRoutingFees lowest_inbound_channel_fees_arg_conv = *(LDKRoutingFees*)lowest_inbound_channel_fees_arg;
FREE((void*)lowest_inbound_channel_fees_arg);
- lowest_inbound_channel_fees_arg_conv._underlying_ref = false;
+ lowest_inbound_channel_fees_arg_conv.is_owned = true;
LDKNodeAnnouncementInfo announcement_info_arg_conv = *(LDKNodeAnnouncementInfo*)announcement_info_arg;
FREE((void*)announcement_info_arg);
- announcement_info_arg_conv._underlying_ref = false;
+ announcement_info_arg_conv.is_owned = true;
LDKNodeInfo* ret = MALLOC(sizeof(LDKNodeInfo), "LDKNodeInfo");
*ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKNodeInfo* ret = MALLOC(sizeof(LDKNodeInfo), "LDKNodeInfo");
*ret = NodeInfo_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
FREE((void*)ser);
LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
*ret = NetworkGraph_read(ser_conv);
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
*ret = NetworkGraph_new();
- assert(!ret->_underlying_ref);
- ret->_underlying_ref = true;
+ assert(ret->is_owned);
+ ret->is_owned = false;
return (long)ret;
}