1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
8 #define MALLOC(a, _) malloc(a)
9 #define FREE(p) if ((long)(p) > 1024) { free(p); }
10 #define DO_ASSERT(a) (void)(a)
13 static jmethodID ordinal_meth = NULL;
14 static jmethodID slicedef_meth = NULL;
15 static jclass slicedef_cls = NULL;
16 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
17 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
18 CHECK(ordinal_meth != NULL);
19 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
20 CHECK(slicedef_meth != NULL);
21 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
22 CHECK(slicedef_cls != NULL);
25 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
28 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
31 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
34 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
35 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
36 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
39 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
40 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
41 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
42 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
45 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
46 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
47 vec->datalen = (*env)->GetArrayLength(env, bytes);
48 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
49 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
52 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
53 LDKTransaction *txdata = (LDKTransaction*)ptr;
55 slice.data = txdata->data;
56 slice.datalen = txdata->datalen;
57 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (long)&slice);
59 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
60 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
61 txdata->datalen = (*env)->GetArrayLength(env, bytes);
62 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
63 txdata->data_is_owned = false;
64 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
67 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
68 LDKTransaction *tx = (LDKTransaction*)ptr;
69 tx->data_is_owned = true;
70 Transaction_free(*tx);
73 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
74 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
75 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
76 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
77 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
78 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
79 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
80 return (long)vec->datalen;
82 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
83 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
84 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
85 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
86 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
87 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
88 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
94 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
95 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
96 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
97 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
99 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
100 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
101 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
103 typedef jlongArray int64_tArray;
104 typedef jbyteArray int8_tArray;
106 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
107 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
108 char* err_buf = MALLOC(len + 1, "str conv buf");
109 memcpy(err_buf, chars, len);
111 jstring err_conv = (*env)->NewStringUTF(env, chars);
115 static jclass arr_of_B_clz = NULL;
116 static jclass arr_of_J_clz = NULL;
117 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
118 arr_of_B_clz = (*env)->FindClass(env, "[B");
119 CHECK(arr_of_B_clz != NULL);
120 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
121 arr_of_J_clz = (*env)->FindClass(env, "[J");
122 CHECK(arr_of_J_clz != NULL);
123 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
125 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
126 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
127 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
128 case 0: return LDKAccessError_UnknownChain;
129 case 1: return LDKAccessError_UnknownTx;
133 static jclass LDKAccessError_class = NULL;
134 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
135 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
136 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv *env, jclass clz) {
137 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
138 CHECK(LDKAccessError_class != NULL);
139 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
140 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
141 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
142 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
144 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
146 case LDKAccessError_UnknownChain:
147 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
148 case LDKAccessError_UnknownTx:
149 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
154 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
155 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
156 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
157 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
161 static jclass LDKChannelMonitorUpdateErr_class = NULL;
162 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
163 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
164 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
165 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
166 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
167 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
168 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
169 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
170 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
172 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
174 case LDKChannelMonitorUpdateErr_TemporaryFailure:
175 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
176 case LDKChannelMonitorUpdateErr_PermanentFailure:
177 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
182 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
183 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
184 case 0: return LDKConfirmationTarget_Background;
185 case 1: return LDKConfirmationTarget_Normal;
186 case 2: return LDKConfirmationTarget_HighPriority;
190 static jclass LDKConfirmationTarget_class = NULL;
191 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
192 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
193 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
194 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv *env, jclass clz) {
195 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
196 CHECK(LDKConfirmationTarget_class != NULL);
197 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
198 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
199 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
200 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
201 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
202 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
204 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
206 case LDKConfirmationTarget_Background:
207 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
208 case LDKConfirmationTarget_Normal:
209 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
210 case LDKConfirmationTarget_HighPriority:
211 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
216 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
217 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
218 case 0: return LDKLevel_Off;
219 case 1: return LDKLevel_Error;
220 case 2: return LDKLevel_Warn;
221 case 3: return LDKLevel_Info;
222 case 4: return LDKLevel_Debug;
223 case 5: return LDKLevel_Trace;
227 static jclass LDKLevel_class = NULL;
228 static jfieldID LDKLevel_LDKLevel_Off = NULL;
229 static jfieldID LDKLevel_LDKLevel_Error = NULL;
230 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
231 static jfieldID LDKLevel_LDKLevel_Info = NULL;
232 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
233 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
234 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv *env, jclass clz) {
235 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
236 CHECK(LDKLevel_class != NULL);
237 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
238 CHECK(LDKLevel_LDKLevel_Off != NULL);
239 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
240 CHECK(LDKLevel_LDKLevel_Error != NULL);
241 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
242 CHECK(LDKLevel_LDKLevel_Warn != NULL);
243 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
244 CHECK(LDKLevel_LDKLevel_Info != NULL);
245 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
246 CHECK(LDKLevel_LDKLevel_Debug != NULL);
247 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
248 CHECK(LDKLevel_LDKLevel_Trace != NULL);
250 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
253 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
255 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
257 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
259 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
261 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
263 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
268 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
269 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
270 case 0: return LDKNetwork_Bitcoin;
271 case 1: return LDKNetwork_Testnet;
272 case 2: return LDKNetwork_Regtest;
273 case 3: return LDKNetwork_Signet;
277 static jclass LDKNetwork_class = NULL;
278 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
279 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
280 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
281 static jfieldID LDKNetwork_LDKNetwork_Signet = NULL;
282 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv *env, jclass clz) {
283 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
284 CHECK(LDKNetwork_class != NULL);
285 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
286 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
287 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
288 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
289 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
290 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
291 LDKNetwork_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Signet", "Lorg/ldk/enums/LDKNetwork;");
292 CHECK(LDKNetwork_LDKNetwork_Signet != NULL);
294 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
296 case LDKNetwork_Bitcoin:
297 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
298 case LDKNetwork_Testnet:
299 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
300 case LDKNetwork_Regtest:
301 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
302 case LDKNetwork_Signet:
303 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Signet);
308 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
309 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
310 case 0: return LDKSecp256k1Error_IncorrectSignature;
311 case 1: return LDKSecp256k1Error_InvalidMessage;
312 case 2: return LDKSecp256k1Error_InvalidPublicKey;
313 case 3: return LDKSecp256k1Error_InvalidSignature;
314 case 4: return LDKSecp256k1Error_InvalidSecretKey;
315 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
316 case 6: return LDKSecp256k1Error_InvalidTweak;
317 case 7: return LDKSecp256k1Error_TweakCheckFailed;
318 case 8: return LDKSecp256k1Error_NotEnoughMemory;
322 static jclass LDKSecp256k1Error_class = NULL;
323 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
324 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
325 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
326 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
327 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
328 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
329 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
330 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
331 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv *env, jclass clz) {
333 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
334 CHECK(LDKSecp256k1Error_class != NULL);
335 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
336 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
337 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
338 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
339 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
340 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
341 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
342 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
343 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
344 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
345 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
346 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
347 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
348 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
349 LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/LDKSecp256k1Error;");
350 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
351 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
352 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
354 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
356 case LDKSecp256k1Error_IncorrectSignature:
357 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
358 case LDKSecp256k1Error_InvalidMessage:
359 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
360 case LDKSecp256k1Error_InvalidPublicKey:
361 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
362 case LDKSecp256k1Error_InvalidSignature:
363 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
364 case LDKSecp256k1Error_InvalidSecretKey:
365 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
366 case LDKSecp256k1Error_InvalidRecoveryId:
367 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
368 case LDKSecp256k1Error_InvalidTweak:
369 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
370 case LDKSecp256k1Error_TweakCheckFailed:
371 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
372 case LDKSecp256k1Error_NotEnoughMemory:
373 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
379 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
380 ret->datalen = (*env)->GetArrayLength(env, elems);
381 if (ret->datalen == 0) {
384 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
385 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
386 for (size_t i = 0; i < ret->datalen; i++) {
387 ret->data[i] = java_elems[i];
389 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
393 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
394 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
395 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
399 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
402 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
403 CHECK(val->result_ok);
404 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
405 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
408 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
409 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
410 CHECK(!val->result_ok);
411 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
415 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
418 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
419 CHECK(val->result_ok);
420 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
421 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
424 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
425 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
426 CHECK(!val->result_ok);
427 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
431 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
434 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
435 CHECK(val->result_ok);
436 LDKTxCreationKeys res_var = (*val->contents.result);
437 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
438 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
439 long res_ref = (long)res_var.inner & ~1;
442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
443 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
444 CHECK(!val->result_ok);
445 LDKDecodeError err_var = (*val->contents.err);
446 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
447 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
448 long err_ref = (long)err_var.inner & ~1;
451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
452 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
455 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
456 CHECK(val->result_ok);
457 LDKChannelPublicKeys res_var = (*val->contents.result);
458 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
459 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
460 long res_ref = (long)res_var.inner & ~1;
463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
464 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
465 CHECK(!val->result_ok);
466 LDKDecodeError err_var = (*val->contents.err);
467 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
468 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
469 long err_ref = (long)err_var.inner & ~1;
472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
473 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
476 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
477 CHECK(val->result_ok);
478 LDKTxCreationKeys res_var = (*val->contents.result);
479 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
480 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
481 long res_ref = (long)res_var.inner & ~1;
484 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
485 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
486 CHECK(!val->result_ok);
487 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
490 static jclass LDKCOption_u32Z_Some_class = NULL;
491 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
492 static jclass LDKCOption_u32Z_None_class = NULL;
493 static jmethodID LDKCOption_u32Z_None_meth = NULL;
494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
495 LDKCOption_u32Z_Some_class =
496 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
497 CHECK(LDKCOption_u32Z_Some_class != NULL);
498 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
499 CHECK(LDKCOption_u32Z_Some_meth != NULL);
500 LDKCOption_u32Z_None_class =
501 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
502 CHECK(LDKCOption_u32Z_None_class != NULL);
503 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
504 CHECK(LDKCOption_u32Z_None_meth != NULL);
506 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
507 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
509 case LDKCOption_u32Z_Some: {
510 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
512 case LDKCOption_u32Z_None: {
513 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
519 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
522 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
523 CHECK(val->result_ok);
524 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
525 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
526 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
527 long res_ref = (long)res_var.inner & ~1;
530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
531 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
532 CHECK(!val->result_ok);
533 LDKDecodeError err_var = (*val->contents.err);
534 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
535 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
536 long err_ref = (long)err_var.inner & ~1;
539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
540 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
543 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
544 CHECK(val->result_ok);
545 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
546 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
547 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
548 long res_ref = (long)res_var.inner & ~1;
551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
552 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
553 CHECK(!val->result_ok);
554 LDKDecodeError err_var = (*val->contents.err);
555 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
556 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
557 long err_ref = (long)err_var.inner & ~1;
560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
561 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
564 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
565 CHECK(val->result_ok);
566 LDKChannelTransactionParameters res_var = (*val->contents.result);
567 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
568 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
569 long res_ref = (long)res_var.inner & ~1;
572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
573 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
574 CHECK(!val->result_ok);
575 LDKDecodeError err_var = (*val->contents.err);
576 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
577 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
578 long err_ref = (long)err_var.inner & ~1;
581 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
582 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
585 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
586 CHECK(val->result_ok);
587 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
588 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
589 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
590 long res_ref = (long)res_var.inner & ~1;
593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
594 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
595 CHECK(!val->result_ok);
596 LDKDecodeError err_var = (*val->contents.err);
597 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
598 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
599 long err_ref = (long)err_var.inner & ~1;
602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
603 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
606 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
607 CHECK(val->result_ok);
608 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
609 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
610 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
611 long res_ref = (long)res_var.inner & ~1;
614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
615 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
616 CHECK(!val->result_ok);
617 LDKDecodeError err_var = (*val->contents.err);
618 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
619 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
620 long err_ref = (long)err_var.inner & ~1;
623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
624 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
627 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
628 CHECK(val->result_ok);
629 LDKCommitmentTransaction res_var = (*val->contents.result);
630 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
631 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
632 long res_ref = (long)res_var.inner & ~1;
635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
636 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
637 CHECK(!val->result_ok);
638 LDKDecodeError err_var = (*val->contents.err);
639 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
640 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
641 long err_ref = (long)err_var.inner & ~1;
644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
645 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
648 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
649 CHECK(val->result_ok);
650 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
651 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
652 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
653 long res_ref = (long)res_var.inner & ~1;
656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
657 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
658 CHECK(!val->result_ok);
659 return *val->contents.err;
661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
662 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
664 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
665 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
666 CHECK(val->result_ok);
667 LDKCVec_SignatureZ res_var = (*val->contents.result);
668 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
670 for (size_t i = 0; i < res_var.datalen; i++) {
671 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
672 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
673 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
678 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
679 CHECK(!val->result_ok);
680 return *val->contents.err;
682 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
683 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
684 static jclass LDKErrorAction_IgnoreError_class = NULL;
685 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
686 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
687 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
689 LDKErrorAction_DisconnectPeer_class =
690 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
691 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
692 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
693 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
694 LDKErrorAction_IgnoreError_class =
695 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
696 CHECK(LDKErrorAction_IgnoreError_class != NULL);
697 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
698 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
699 LDKErrorAction_SendErrorMessage_class =
700 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
701 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
702 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
703 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
705 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
706 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
708 case LDKErrorAction_DisconnectPeer: {
709 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
710 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
711 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
712 long msg_ref = (long)msg_var.inner & ~1;
713 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
715 case LDKErrorAction_IgnoreError: {
716 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
718 case LDKErrorAction_SendErrorMessage: {
719 LDKErrorMessage msg_var = obj->send_error_message.msg;
720 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
721 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
722 long msg_ref = (long)msg_var.inner & ~1;
723 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
728 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
729 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
730 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
731 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
732 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
733 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
735 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
737 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
738 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
739 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
740 LDKHTLCFailChannelUpdate_ChannelClosed_class =
741 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
742 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
743 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
744 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
745 LDKHTLCFailChannelUpdate_NodeFailure_class =
746 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
747 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
748 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
749 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
751 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
752 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
754 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
755 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
756 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
757 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
758 long msg_ref = (long)msg_var.inner & ~1;
759 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
761 case LDKHTLCFailChannelUpdate_ChannelClosed: {
762 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
764 case LDKHTLCFailChannelUpdate_NodeFailure: {
765 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
766 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
767 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
772 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
773 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
774 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
775 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
776 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
777 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
778 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
779 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
780 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
781 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
782 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
783 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
784 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
785 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
786 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
787 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
788 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
789 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
790 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
791 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
792 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
793 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
794 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
795 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
796 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
797 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
798 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
799 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
800 static jclass LDKMessageSendEvent_HandleError_class = NULL;
801 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
802 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
803 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
804 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
805 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
806 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
807 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
808 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
809 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
811 LDKMessageSendEvent_SendAcceptChannel_class =
812 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
813 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
814 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
815 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
816 LDKMessageSendEvent_SendOpenChannel_class =
817 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
818 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
819 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
820 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
821 LDKMessageSendEvent_SendFundingCreated_class =
822 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
823 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
824 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
825 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
826 LDKMessageSendEvent_SendFundingSigned_class =
827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
828 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
829 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
830 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
831 LDKMessageSendEvent_SendFundingLocked_class =
832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
833 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
834 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
835 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
836 LDKMessageSendEvent_SendAnnouncementSignatures_class =
837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
838 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
839 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
840 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
841 LDKMessageSendEvent_UpdateHTLCs_class =
842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
843 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
844 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
845 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
846 LDKMessageSendEvent_SendRevokeAndACK_class =
847 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
848 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
849 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
850 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
851 LDKMessageSendEvent_SendClosingSigned_class =
852 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
853 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
854 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
855 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
856 LDKMessageSendEvent_SendShutdown_class =
857 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
858 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
859 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
860 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
861 LDKMessageSendEvent_SendChannelReestablish_class =
862 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
863 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
864 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
865 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
866 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
867 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
868 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
869 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
870 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
871 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
872 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
873 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
874 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
875 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
876 LDKMessageSendEvent_BroadcastChannelUpdate_class =
877 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
878 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
879 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
880 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
881 LDKMessageSendEvent_HandleError_class =
882 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
883 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
884 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
885 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
886 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
887 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
888 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
889 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
890 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
891 LDKMessageSendEvent_SendChannelRangeQuery_class =
892 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
893 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
894 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
895 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
896 LDKMessageSendEvent_SendShortIdsQuery_class =
897 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
898 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
899 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
900 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
901 LDKMessageSendEvent_SendReplyChannelRange_class =
902 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
903 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
904 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
905 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
907 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
908 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
910 case LDKMessageSendEvent_SendAcceptChannel: {
911 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
912 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
913 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
914 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
915 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
916 long msg_ref = (long)msg_var.inner & ~1;
917 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
919 case LDKMessageSendEvent_SendOpenChannel: {
920 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
921 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
922 LDKOpenChannel msg_var = obj->send_open_channel.msg;
923 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
924 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
925 long msg_ref = (long)msg_var.inner & ~1;
926 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
928 case LDKMessageSendEvent_SendFundingCreated: {
929 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
930 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
931 LDKFundingCreated msg_var = obj->send_funding_created.msg;
932 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
933 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
934 long msg_ref = (long)msg_var.inner & ~1;
935 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
937 case LDKMessageSendEvent_SendFundingSigned: {
938 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
939 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
940 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
941 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
942 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
943 long msg_ref = (long)msg_var.inner & ~1;
944 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
946 case LDKMessageSendEvent_SendFundingLocked: {
947 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
948 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
949 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
950 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
951 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
952 long msg_ref = (long)msg_var.inner & ~1;
953 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
955 case LDKMessageSendEvent_SendAnnouncementSignatures: {
956 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
957 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
958 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
959 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
960 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
961 long msg_ref = (long)msg_var.inner & ~1;
962 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
964 case LDKMessageSendEvent_UpdateHTLCs: {
965 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
966 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
967 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
968 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
969 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
970 long updates_ref = (long)updates_var.inner & ~1;
971 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
973 case LDKMessageSendEvent_SendRevokeAndACK: {
974 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
975 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
976 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
977 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
978 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
979 long msg_ref = (long)msg_var.inner & ~1;
980 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
982 case LDKMessageSendEvent_SendClosingSigned: {
983 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
984 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
985 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
986 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
987 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
988 long msg_ref = (long)msg_var.inner & ~1;
989 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
991 case LDKMessageSendEvent_SendShutdown: {
992 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
993 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
994 LDKShutdown msg_var = obj->send_shutdown.msg;
995 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
996 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
997 long msg_ref = (long)msg_var.inner & ~1;
998 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1000 case LDKMessageSendEvent_SendChannelReestablish: {
1001 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1002 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1003 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1004 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1005 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1006 long msg_ref = (long)msg_var.inner & ~1;
1007 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1009 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1010 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1011 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1012 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1013 long msg_ref = (long)msg_var.inner & ~1;
1014 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1015 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1016 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1017 long update_msg_ref = (long)update_msg_var.inner & ~1;
1018 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1020 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1021 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1022 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1023 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1024 long msg_ref = (long)msg_var.inner & ~1;
1025 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1027 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1028 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1029 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1030 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1031 long msg_ref = (long)msg_var.inner & ~1;
1032 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1034 case LDKMessageSendEvent_HandleError: {
1035 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1036 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1037 long action_ref = ((long)&obj->handle_error.action) | 1;
1038 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1040 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1041 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
1042 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1044 case LDKMessageSendEvent_SendChannelRangeQuery: {
1045 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1046 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1047 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1048 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1049 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1050 long msg_ref = (long)msg_var.inner & ~1;
1051 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1053 case LDKMessageSendEvent_SendShortIdsQuery: {
1054 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1055 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1056 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1057 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1058 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1059 long msg_ref = (long)msg_var.inner & ~1;
1060 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1062 case LDKMessageSendEvent_SendReplyChannelRange: {
1063 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1064 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1065 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1066 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1067 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1068 long msg_ref = (long)msg_var.inner & ~1;
1069 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1075 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1076 ret->datalen = (*env)->GetArrayLength(env, elems);
1077 if (ret->datalen == 0) {
1080 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1081 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1082 for (size_t i = 0; i < ret->datalen; i++) {
1083 int64_t arr_elem = java_elems[i];
1084 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1085 FREE((void*)arr_elem);
1086 ret->data[i] = arr_elem_conv;
1088 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1092 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1093 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1094 for (size_t i = 0; i < ret.datalen; i++) {
1095 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1100 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
1102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1103 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1104 CHECK(val->result_ok);
1105 return *val->contents.result;
1107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1108 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
1109 CHECK(!val->result_ok);
1110 LDKLightningError err_var = (*val->contents.err);
1111 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1112 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1113 long err_ref = (long)err_var.inner & ~1;
1116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
1117 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
1118 LDKChannelAnnouncement a_conv;
1119 a_conv.inner = (void*)(a & (~1));
1120 a_conv.is_owned = (a & 1) || (a == 0);
1121 a_conv = ChannelAnnouncement_clone(&a_conv);
1123 LDKChannelUpdate b_conv;
1124 b_conv.inner = (void*)(b & (~1));
1125 b_conv.is_owned = (b & 1) || (b == 0);
1126 b_conv = ChannelUpdate_clone(&b_conv);
1128 LDKChannelUpdate c_conv;
1129 c_conv.inner = (void*)(c & (~1));
1130 c_conv.is_owned = (c & 1) || (c == 0);
1131 c_conv = ChannelUpdate_clone(&c_conv);
1135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1136 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1137 LDKChannelAnnouncement a_var = tuple->a;
1138 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1139 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1140 long a_ref = (long)a_var.inner & ~1;
1143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1144 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1145 LDKChannelUpdate b_var = tuple->b;
1146 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1147 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1148 long b_ref = (long)b_var.inner & ~1;
1151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
1152 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
1153 LDKChannelUpdate c_var = tuple->c;
1154 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1155 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1156 long c_ref = (long)c_var.inner & ~1;
1159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1160 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
1161 ret->datalen = (*env)->GetArrayLength(env, elems);
1162 if (ret->datalen == 0) {
1165 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
1166 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1167 for (size_t i = 0; i < ret->datalen; i++) {
1168 int64_t arr_elem = java_elems[i];
1169 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
1170 FREE((void*)arr_elem);
1171 ret->data[i] = arr_elem_conv;
1173 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1177 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
1178 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
1179 for (size_t i = 0; i < ret.datalen; i++) {
1180 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
1184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1185 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
1186 ret->datalen = (*env)->GetArrayLength(env, elems);
1187 if (ret->datalen == 0) {
1190 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
1191 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1192 for (size_t i = 0; i < ret->datalen; i++) {
1193 int64_t arr_elem = java_elems[i];
1194 LDKNodeAnnouncement arr_elem_conv;
1195 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1196 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1197 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
1198 ret->data[i] = arr_elem_conv;
1200 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1204 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
1205 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
1206 for (size_t i = 0; i < ret.datalen; i++) {
1207 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
1211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1212 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
1214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1215 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
1216 CHECK(val->result_ok);
1217 return *val->contents.result;
1219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1220 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
1221 CHECK(!val->result_ok);
1222 LDKLightningError err_var = (*val->contents.err);
1223 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1224 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1225 long err_ref = (long)err_var.inner & ~1;
1228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1229 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
1231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1232 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
1233 CHECK(val->result_ok);
1234 LDKCVec_u8Z res_var = (*val->contents.result);
1235 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
1236 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
1239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1240 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
1241 CHECK(!val->result_ok);
1242 LDKPeerHandleError err_var = (*val->contents.err);
1243 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1244 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1245 long err_ref = (long)err_var.inner & ~1;
1248 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1249 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
1251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1252 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
1253 CHECK(val->result_ok);
1254 return *val->contents.result;
1256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1257 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
1258 CHECK(!val->result_ok);
1259 LDKPeerHandleError err_var = (*val->contents.err);
1260 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1261 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1262 long err_ref = (long)err_var.inner & ~1;
1265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1266 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
1268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1269 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
1270 CHECK(val->result_ok);
1271 return *val->contents.result;
1273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1274 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
1275 CHECK(!val->result_ok);
1276 LDKPeerHandleError err_var = (*val->contents.err);
1277 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1278 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1279 long err_ref = (long)err_var.inner & ~1;
1282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1283 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1286 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1287 CHECK(val->result_ok);
1288 LDKInitFeatures res_var = (*val->contents.result);
1289 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1290 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1291 long res_ref = (long)res_var.inner & ~1;
1294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1295 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1296 CHECK(!val->result_ok);
1297 LDKDecodeError err_var = (*val->contents.err);
1298 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1299 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1300 long err_ref = (long)err_var.inner & ~1;
1303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1304 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1307 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1308 CHECK(val->result_ok);
1309 LDKNodeFeatures res_var = (*val->contents.result);
1310 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1311 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1312 long res_ref = (long)res_var.inner & ~1;
1315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1316 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1317 CHECK(!val->result_ok);
1318 LDKDecodeError err_var = (*val->contents.err);
1319 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1320 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1321 long err_ref = (long)err_var.inner & ~1;
1324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1325 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1328 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1329 CHECK(val->result_ok);
1330 LDKChannelFeatures res_var = (*val->contents.result);
1331 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1332 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1333 long res_ref = (long)res_var.inner & ~1;
1336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1337 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1338 CHECK(!val->result_ok);
1339 LDKDecodeError err_var = (*val->contents.err);
1340 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1341 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1342 long err_ref = (long)err_var.inner & ~1;
1345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1346 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1349 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1350 CHECK(val->result_ok);
1351 LDKInvoiceFeatures res_var = (*val->contents.result);
1352 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1353 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1354 long res_ref = (long)res_var.inner & ~1;
1357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1358 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1359 CHECK(!val->result_ok);
1360 LDKDecodeError err_var = (*val->contents.err);
1361 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1362 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1363 long err_ref = (long)err_var.inner & ~1;
1366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1367 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
1369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1370 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
1371 CHECK(val->result_ok);
1372 LDKChannelConfig res_var = (*val->contents.result);
1373 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1374 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1375 long res_ref = (long)res_var.inner & ~1;
1378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1379 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
1380 CHECK(!val->result_ok);
1381 LDKDecodeError err_var = (*val->contents.err);
1382 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1383 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1384 long err_ref = (long)err_var.inner & ~1;
1387 static jclass LDKCOption_u64Z_Some_class = NULL;
1388 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1389 static jclass LDKCOption_u64Z_None_class = NULL;
1390 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1392 LDKCOption_u64Z_Some_class =
1393 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1394 CHECK(LDKCOption_u64Z_Some_class != NULL);
1395 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1396 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1397 LDKCOption_u64Z_None_class =
1398 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1399 CHECK(LDKCOption_u64Z_None_class != NULL);
1400 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1401 CHECK(LDKCOption_u64Z_None_meth != NULL);
1403 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1404 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1406 case LDKCOption_u64Z_Some: {
1407 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1409 case LDKCOption_u64Z_None: {
1410 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1416 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
1418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1419 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1420 CHECK(val->result_ok);
1421 LDKDirectionalChannelInfo res_var = (*val->contents.result);
1422 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1423 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1424 long res_ref = (long)res_var.inner & ~1;
1427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1428 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1429 CHECK(!val->result_ok);
1430 LDKDecodeError err_var = (*val->contents.err);
1431 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1432 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1433 long err_ref = (long)err_var.inner & ~1;
1436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1437 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
1439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1440 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1441 CHECK(val->result_ok);
1442 LDKChannelInfo res_var = (*val->contents.result);
1443 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1444 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1445 long res_ref = (long)res_var.inner & ~1;
1448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1449 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1450 CHECK(!val->result_ok);
1451 LDKDecodeError err_var = (*val->contents.err);
1452 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1453 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1454 long err_ref = (long)err_var.inner & ~1;
1457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1458 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
1460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1461 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1462 CHECK(val->result_ok);
1463 LDKRoutingFees res_var = (*val->contents.result);
1464 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1465 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1466 long res_ref = (long)res_var.inner & ~1;
1469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1470 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1471 CHECK(!val->result_ok);
1472 LDKDecodeError err_var = (*val->contents.err);
1473 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1474 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1475 long err_ref = (long)err_var.inner & ~1;
1478 static jclass LDKNetAddress_IPv4_class = NULL;
1479 static jmethodID LDKNetAddress_IPv4_meth = NULL;
1480 static jclass LDKNetAddress_IPv6_class = NULL;
1481 static jmethodID LDKNetAddress_IPv6_meth = NULL;
1482 static jclass LDKNetAddress_OnionV2_class = NULL;
1483 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
1484 static jclass LDKNetAddress_OnionV3_class = NULL;
1485 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
1486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
1487 LDKNetAddress_IPv4_class =
1488 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
1489 CHECK(LDKNetAddress_IPv4_class != NULL);
1490 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
1491 CHECK(LDKNetAddress_IPv4_meth != NULL);
1492 LDKNetAddress_IPv6_class =
1493 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
1494 CHECK(LDKNetAddress_IPv6_class != NULL);
1495 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
1496 CHECK(LDKNetAddress_IPv6_meth != NULL);
1497 LDKNetAddress_OnionV2_class =
1498 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
1499 CHECK(LDKNetAddress_OnionV2_class != NULL);
1500 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
1501 CHECK(LDKNetAddress_OnionV2_meth != NULL);
1502 LDKNetAddress_OnionV3_class =
1503 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
1504 CHECK(LDKNetAddress_OnionV3_class != NULL);
1505 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
1506 CHECK(LDKNetAddress_OnionV3_meth != NULL);
1508 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1509 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
1511 case LDKNetAddress_IPv4: {
1512 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
1513 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
1514 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
1516 case LDKNetAddress_IPv6: {
1517 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
1518 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
1519 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
1521 case LDKNetAddress_OnionV2: {
1522 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
1523 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
1524 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
1526 case LDKNetAddress_OnionV3: {
1527 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
1528 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
1529 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, obj->onion_v3.checksum, obj->onion_v3.version, obj->onion_v3.port);
1534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1535 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1536 ret->datalen = (*env)->GetArrayLength(env, elems);
1537 if (ret->datalen == 0) {
1540 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1541 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1542 for (size_t i = 0; i < ret->datalen; i++) {
1543 int64_t arr_elem = java_elems[i];
1544 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1545 FREE((void*)arr_elem);
1546 ret->data[i] = arr_elem_conv;
1548 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1552 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1553 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1554 for (size_t i = 0; i < ret.datalen; i++) {
1555 ret.data[i] = NetAddress_clone(&orig->data[i]);
1559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1560 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1563 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1564 CHECK(val->result_ok);
1565 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1566 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1567 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1568 long res_ref = (long)res_var.inner & ~1;
1571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1572 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1573 CHECK(!val->result_ok);
1574 LDKDecodeError err_var = (*val->contents.err);
1575 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1576 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1577 long err_ref = (long)err_var.inner & ~1;
1580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1581 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1582 ret->datalen = (*env)->GetArrayLength(env, elems);
1583 if (ret->datalen == 0) {
1586 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1587 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1588 for (size_t i = 0; i < ret->datalen; i++) {
1589 ret->data[i] = java_elems[i];
1591 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1595 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1596 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1597 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1601 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1604 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1605 CHECK(val->result_ok);
1606 LDKNodeInfo res_var = (*val->contents.result);
1607 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1608 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1609 long res_ref = (long)res_var.inner & ~1;
1612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1613 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1614 CHECK(!val->result_ok);
1615 LDKDecodeError err_var = (*val->contents.err);
1616 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1617 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1618 long err_ref = (long)err_var.inner & ~1;
1621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1622 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1625 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1626 CHECK(val->result_ok);
1627 LDKNetworkGraph res_var = (*val->contents.result);
1628 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1629 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1630 long res_ref = (long)res_var.inner & ~1;
1633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1634 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1635 CHECK(!val->result_ok);
1636 LDKDecodeError err_var = (*val->contents.err);
1637 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1638 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1639 long err_ref = (long)err_var.inner & ~1;
1642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1643 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1645 LDKTransaction b_ref;
1646 b_ref.datalen = (*env)->GetArrayLength(env, b);
1647 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1648 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1649 b_ref.data_is_owned = false;
1653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1654 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1658 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1659 LDKTransaction b_var = tuple->b;
1660 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1661 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1665 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1666 ret->datalen = (*env)->GetArrayLength(env, elems);
1667 if (ret->datalen == 0) {
1670 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1671 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1672 for (size_t i = 0; i < ret->datalen; i++) {
1673 int64_t arr_elem = java_elems[i];
1674 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1675 FREE((void*)arr_elem);
1676 ret->data[i] = arr_elem_conv;
1678 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1683 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1686 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1687 CHECK(val->result_ok);
1688 return *val->contents.result;
1690 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1691 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1692 CHECK(!val->result_ok);
1693 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1696 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1697 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1698 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1699 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1701 LDKMonitorEvent_HTLCEvent_class =
1702 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1703 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1704 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1705 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1706 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1707 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1708 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1709 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1710 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1712 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1713 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1715 case LDKMonitorEvent_HTLCEvent: {
1716 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1717 CHECK((((long)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1718 CHECK((((long)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1719 long htlc_event_ref = (long)htlc_event_var.inner & ~1;
1720 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1722 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1723 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1724 CHECK((((long)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1725 CHECK((((long)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1726 long commitment_tx_broadcasted_ref = (long)commitment_tx_broadcasted_var.inner & ~1;
1727 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1733 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1734 ret->datalen = (*env)->GetArrayLength(env, elems);
1735 if (ret->datalen == 0) {
1738 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1739 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1740 for (size_t i = 0; i < ret->datalen; i++) {
1741 int64_t arr_elem = java_elems[i];
1742 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1743 FREE((void*)arr_elem);
1744 ret->data[i] = arr_elem_conv;
1746 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1750 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1751 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1752 for (size_t i = 0; i < ret.datalen; i++) {
1753 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1757 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1758 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1759 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1760 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1761 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1762 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1764 LDKSpendableOutputDescriptor_StaticOutput_class =
1765 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1766 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1767 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1768 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1769 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1770 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1771 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1772 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1773 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1774 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1775 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1776 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1777 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1778 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1780 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1781 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1783 case LDKSpendableOutputDescriptor_StaticOutput: {
1784 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1785 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1786 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1787 long outpoint_ref = (long)outpoint_var.inner & ~1;
1788 long output_ref = ((long)&obj->static_output.output) | 1;
1789 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
1791 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1792 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1793 CHECK((((long)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1794 CHECK((((long)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1795 long delayed_payment_output_ref = (long)delayed_payment_output_var.inner & ~1;
1796 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1798 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1799 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1800 CHECK((((long)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1801 CHECK((((long)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1802 long static_payment_output_ref = (long)static_payment_output_var.inner & ~1;
1803 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1809 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1810 ret->datalen = (*env)->GetArrayLength(env, elems);
1811 if (ret->datalen == 0) {
1814 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1815 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1816 for (size_t i = 0; i < ret->datalen; i++) {
1817 int64_t arr_elem = java_elems[i];
1818 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1819 FREE((void*)arr_elem);
1820 ret->data[i] = arr_elem_conv;
1822 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1826 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1827 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1828 for (size_t i = 0; i < ret.datalen; i++) {
1829 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1833 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1834 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1835 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1836 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1837 static jclass LDKEvent_PaymentReceived_class = NULL;
1838 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1839 static jclass LDKEvent_PaymentSent_class = NULL;
1840 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1841 static jclass LDKEvent_PaymentFailed_class = NULL;
1842 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1843 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1844 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1845 static jclass LDKEvent_SpendableOutputs_class = NULL;
1846 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
1848 LDKEvent_FundingGenerationReady_class =
1849 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1850 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1851 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1852 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1853 LDKEvent_FundingBroadcastSafe_class =
1854 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1855 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1856 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1857 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1858 LDKEvent_PaymentReceived_class =
1859 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1860 CHECK(LDKEvent_PaymentReceived_class != NULL);
1861 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1862 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1863 LDKEvent_PaymentSent_class =
1864 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1865 CHECK(LDKEvent_PaymentSent_class != NULL);
1866 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1867 CHECK(LDKEvent_PaymentSent_meth != NULL);
1868 LDKEvent_PaymentFailed_class =
1869 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1870 CHECK(LDKEvent_PaymentFailed_class != NULL);
1871 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1872 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1873 LDKEvent_PendingHTLCsForwardable_class =
1874 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1875 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1876 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1877 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1878 LDKEvent_SpendableOutputs_class =
1879 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1880 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1881 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1882 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1884 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1885 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1887 case LDKEvent_FundingGenerationReady: {
1888 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
1889 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1890 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1891 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
1892 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1893 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
1895 case LDKEvent_FundingBroadcastSafe: {
1896 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1897 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1898 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1899 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1900 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1902 case LDKEvent_PaymentReceived: {
1903 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1904 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1905 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1906 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1907 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1909 case LDKEvent_PaymentSent: {
1910 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1911 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1912 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1914 case LDKEvent_PaymentFailed: {
1915 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1916 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1917 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1919 case LDKEvent_PendingHTLCsForwardable: {
1920 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1922 case LDKEvent_SpendableOutputs: {
1923 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1924 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
1925 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
1926 for (size_t b = 0; b < outputs_var.datalen; b++) {
1927 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1928 outputs_arr_ptr[b] = outputs_conv_27_ref;
1930 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
1931 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1937 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1938 ret->datalen = (*env)->GetArrayLength(env, elems);
1939 if (ret->datalen == 0) {
1942 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1943 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1944 for (size_t i = 0; i < ret->datalen; i++) {
1945 int64_t arr_elem = java_elems[i];
1946 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1947 FREE((void*)arr_elem);
1948 ret->data[i] = arr_elem_conv;
1950 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1954 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1955 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1956 for (size_t i = 0; i < ret.datalen; i++) {
1957 ret.data[i] = Event_clone(&orig->data[i]);
1961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1962 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1965 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1966 CHECK(val->result_ok);
1967 LDKOutPoint res_var = (*val->contents.result);
1968 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1969 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1970 long res_ref = (long)res_var.inner & ~1;
1973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1974 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1975 CHECK(!val->result_ok);
1976 LDKDecodeError err_var = (*val->contents.err);
1977 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1978 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1979 long err_ref = (long)err_var.inner & ~1;
1982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1983 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1986 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1987 CHECK(val->result_ok);
1988 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1989 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1990 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1991 long res_ref = (long)res_var.inner & ~1;
1994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1995 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1996 CHECK(!val->result_ok);
1997 LDKDecodeError err_var = (*val->contents.err);
1998 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1999 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2000 long err_ref = (long)err_var.inner & ~1;
2003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2004 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
2006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2007 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
2008 CHECK(val->result_ok);
2009 LDKHTLCUpdate res_var = (*val->contents.result);
2010 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2011 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2012 long res_ref = (long)res_var.inner & ~1;
2015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2016 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
2017 CHECK(!val->result_ok);
2018 LDKDecodeError err_var = (*val->contents.err);
2019 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2020 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2021 long err_ref = (long)err_var.inner & ~1;
2024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2025 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
2027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2028 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
2029 CHECK(val->result_ok);
2030 return *val->contents.result;
2032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2033 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
2034 CHECK(!val->result_ok);
2035 LDKMonitorUpdateError err_var = (*val->contents.err);
2036 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2037 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2038 long err_ref = (long)err_var.inner & ~1;
2041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
2042 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
2044 a_conv.inner = (void*)(a & (~1));
2045 a_conv.is_owned = (a & 1) || (a == 0);
2046 a_conv = OutPoint_clone(&a_conv);
2049 b_ref.datalen = (*env)->GetArrayLength(env, b);
2050 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
2051 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
2055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2056 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
2057 LDKOutPoint a_var = tuple->a;
2058 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2059 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2060 long a_ref = (long)a_var.inner & ~1;
2063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2064 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
2065 LDKCVec_u8Z b_var = tuple->b;
2066 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
2067 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
2070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
2071 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
2074 b_ref.datalen = (*env)->GetArrayLength(env, b);
2075 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
2076 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
2080 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2081 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
2084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2085 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
2086 LDKCVec_u8Z b_var = tuple->b;
2087 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
2088 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
2091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2092 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
2093 ret->datalen = (*env)->GetArrayLength(env, elems);
2094 if (ret->datalen == 0) {
2097 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
2098 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2099 for (size_t i = 0; i < ret->datalen; i++) {
2100 int64_t arr_elem = java_elems[i];
2101 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
2102 FREE((void*)arr_elem);
2103 ret->data[i] = arr_elem_conv;
2105 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2109 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
2110 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
2111 for (size_t i = 0; i < ret.datalen; i++) {
2112 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
2116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
2117 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
2118 LDKThirtyTwoBytes a_ref;
2119 CHECK((*env)->GetArrayLength(env, a) == 32);
2120 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2122 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
2123 b_constr.datalen = (*env)->GetArrayLength(env, b);
2124 if (b_constr.datalen > 0)
2125 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
2127 b_constr.data = NULL;
2128 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
2129 for (size_t b = 0; b < b_constr.datalen; b++) {
2130 int64_t b_conv_27 = b_vals[b];
2131 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
2132 FREE((void*)b_conv_27);
2133 b_constr.data[b] = b_conv_27_conv;
2135 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
2139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2140 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
2141 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2142 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2145 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2146 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
2147 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
2148 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
2149 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
2150 for (size_t b = 0; b < b_var.datalen; b++) {
2151 long b_conv_27_ref = (long)(&b_var.data[b]) | 1;
2152 b_arr_ptr[b] = b_conv_27_ref;
2154 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
2157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2158 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
2159 ret->datalen = (*env)->GetArrayLength(env, elems);
2160 if (ret->datalen == 0) {
2163 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
2164 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2165 for (size_t i = 0; i < ret->datalen; i++) {
2166 int64_t arr_elem = java_elems[i];
2167 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
2168 FREE((void*)arr_elem);
2169 ret->data[i] = arr_elem_conv;
2171 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
2176 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
2178 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
2183 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2184 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
2187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2188 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
2189 long b_ref = ((long)&tuple->b) | 1;
2192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2193 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
2194 ret->datalen = (*env)->GetArrayLength(env, elems);
2195 if (ret->datalen == 0) {
2198 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
2199 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2200 for (size_t i = 0; i < ret->datalen; i++) {
2201 int64_t arr_elem = java_elems[i];
2202 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
2203 FREE((void*)arr_elem);
2204 ret->data[i] = arr_elem_conv;
2206 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2210 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
2211 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
2212 for (size_t i = 0; i < ret.datalen; i++) {
2213 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
2217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
2218 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
2219 LDKThirtyTwoBytes a_ref;
2220 CHECK((*env)->GetArrayLength(env, a) == 32);
2221 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2223 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
2224 b_constr.datalen = (*env)->GetArrayLength(env, b);
2225 if (b_constr.datalen > 0)
2226 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
2228 b_constr.data = NULL;
2229 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
2230 for (size_t a = 0; a < b_constr.datalen; a++) {
2231 int64_t b_conv_26 = b_vals[a];
2232 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
2233 FREE((void*)b_conv_26);
2234 b_constr.data[a] = b_conv_26_conv;
2236 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
2240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2241 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2242 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2243 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2246 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2247 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2248 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
2249 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
2250 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
2251 for (size_t a = 0; a < b_var.datalen; a++) {
2252 long b_conv_26_ref = (long)(&b_var.data[a]) | 1;
2253 b_arr_ptr[a] = b_conv_26_ref;
2255 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
2258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2259 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
2260 ret->datalen = (*env)->GetArrayLength(env, elems);
2261 if (ret->datalen == 0) {
2264 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
2265 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2266 for (size_t i = 0; i < ret->datalen; i++) {
2267 int64_t arr_elem = java_elems[i];
2268 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
2269 FREE((void*)arr_elem);
2270 ret->data[i] = arr_elem_conv;
2272 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2277 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2279 CHECK((*env)->GetArrayLength(env, a) == 64);
2280 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2282 LDKCVec_SignatureZ b_constr;
2283 b_constr.datalen = (*env)->GetArrayLength(env, b);
2284 if (b_constr.datalen > 0)
2285 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2287 b_constr.data = NULL;
2288 for (size_t i = 0; i < b_constr.datalen; i++) {
2289 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2290 LDKSignature b_conv_8_ref;
2291 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2292 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2293 b_constr.data[i] = b_conv_8_ref;
2298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2299 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2300 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2301 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2304 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2305 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2306 LDKCVec_SignatureZ b_var = tuple->b;
2307 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2309 for (size_t i = 0; i < b_var.datalen; i++) {
2310 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2311 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2312 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2317 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2320 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2321 CHECK(val->result_ok);
2322 long res_ref = (long)(&(*val->contents.result)) | 1;
2325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2326 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2327 CHECK(!val->result_ok);
2328 return *val->contents.err;
2330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2331 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2333 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2334 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2335 CHECK(val->result_ok);
2336 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2337 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2341 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2342 CHECK(!val->result_ok);
2343 return *val->contents.err;
2345 typedef struct LDKSign_JCalls {
2346 atomic_size_t refcnt;
2349 jmethodID get_per_commitment_point_meth;
2350 jmethodID release_commitment_secret_meth;
2351 jmethodID channel_keys_id_meth;
2352 jmethodID sign_counterparty_commitment_meth;
2353 jmethodID sign_holder_commitment_and_htlcs_meth;
2354 jmethodID sign_justice_transaction_meth;
2355 jmethodID sign_counterparty_htlc_transaction_meth;
2356 jmethodID sign_closing_transaction_meth;
2357 jmethodID sign_channel_announcement_meth;
2358 jmethodID ready_channel_meth;
2359 jmethodID write_meth;
2361 static void LDKSign_JCalls_free(void* this_arg) {
2362 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2363 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2365 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2366 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2370 LDKPublicKey get_per_commitment_point_LDKSign_jcall(const void* this_arg, uint64_t idx) {
2371 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2373 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2374 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2376 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2377 LDKPublicKey ret_ref;
2378 CHECK((*env)->GetArrayLength(env, ret) == 33);
2379 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2382 LDKThirtyTwoBytes release_commitment_secret_LDKSign_jcall(const void* this_arg, uint64_t idx) {
2383 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2385 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2386 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2388 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2389 LDKThirtyTwoBytes ret_ref;
2390 CHECK((*env)->GetArrayLength(env, ret) == 32);
2391 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2394 LDKThirtyTwoBytes channel_keys_id_LDKSign_jcall(const void* this_arg) {
2395 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2397 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2398 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2400 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2401 LDKThirtyTwoBytes ret_ref;
2402 CHECK((*env)->GetArrayLength(env, ret) == 32);
2403 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2406 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2407 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2409 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2410 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2411 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2412 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2413 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2414 long commitment_tx_ref = (long)commitment_tx_var.inner;
2415 if (commitment_tx_var.is_owned) {
2416 commitment_tx_ref |= 1;
2418 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2420 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2421 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2422 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2425 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2426 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2428 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2429 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2430 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2431 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2432 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2433 long commitment_tx_ref = (long)commitment_tx_var.inner;
2434 if (commitment_tx_var.is_owned) {
2435 commitment_tx_ref |= 1;
2437 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2439 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2440 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2441 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2444 LDKCResult_SignatureNoneZ sign_justice_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2445 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2447 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2448 LDKTransaction justice_tx_var = justice_tx;
2449 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2450 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2451 Transaction_free(justice_tx_var);
2452 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2453 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2454 LDKHTLCOutputInCommitment htlc_var = *htlc;
2455 htlc_var = HTLCOutputInCommitment_clone(htlc);
2456 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2457 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2458 long htlc_ref = (long)htlc_var.inner;
2459 if (htlc_var.is_owned) {
2462 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2464 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_transaction_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2465 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2466 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2469 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2470 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2472 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2473 LDKTransaction htlc_tx_var = htlc_tx;
2474 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2475 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2476 Transaction_free(htlc_tx_var);
2477 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2478 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2479 LDKHTLCOutputInCommitment htlc_var = *htlc;
2480 htlc_var = HTLCOutputInCommitment_clone(htlc);
2481 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2482 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2483 long htlc_ref = (long)htlc_var.inner;
2484 if (htlc_var.is_owned) {
2487 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2489 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2490 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2491 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2494 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2495 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2497 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2498 LDKTransaction closing_tx_var = closing_tx;
2499 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2500 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2501 Transaction_free(closing_tx_var);
2502 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2504 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2505 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2506 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2509 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2510 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2512 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2513 LDKUnsignedChannelAnnouncement msg_var = *msg;
2514 msg_var = UnsignedChannelAnnouncement_clone(msg);
2515 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2516 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2517 long msg_ref = (long)msg_var.inner;
2518 if (msg_var.is_owned) {
2521 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2523 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2524 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2525 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2528 void ready_channel_LDKSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2529 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2531 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2532 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2533 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2534 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2535 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2536 long channel_parameters_ref = (long)channel_parameters_var.inner;
2537 if (channel_parameters_var.is_owned) {
2538 channel_parameters_ref |= 1;
2540 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2542 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2544 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2545 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2547 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2548 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2550 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2551 LDKCVec_u8Z ret_ref;
2552 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2553 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2554 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2557 static void* LDKSign_JCalls_clone(const void* this_arg) {
2558 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2559 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2560 return (void*) this_arg;
2562 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2563 jclass c = (*env)->GetObjectClass(env, o);
2565 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2566 atomic_init(&calls->refcnt, 1);
2567 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2568 calls->o = (*env)->NewWeakGlobalRef(env, o);
2569 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2570 CHECK(calls->get_per_commitment_point_meth != NULL);
2571 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2572 CHECK(calls->release_commitment_secret_meth != NULL);
2573 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2574 CHECK(calls->channel_keys_id_meth != NULL);
2575 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2576 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2577 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2578 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2579 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
2580 CHECK(calls->sign_justice_transaction_meth != NULL);
2581 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2582 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2583 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2584 CHECK(calls->sign_closing_transaction_meth != NULL);
2585 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2586 CHECK(calls->sign_channel_announcement_meth != NULL);
2587 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2588 CHECK(calls->ready_channel_meth != NULL);
2589 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2590 CHECK(calls->write_meth != NULL);
2592 LDKChannelPublicKeys pubkeys_conv;
2593 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2594 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2595 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2598 .this_arg = (void*) calls,
2599 .get_per_commitment_point = get_per_commitment_point_LDKSign_jcall,
2600 .release_commitment_secret = release_commitment_secret_LDKSign_jcall,
2601 .channel_keys_id = channel_keys_id_LDKSign_jcall,
2602 .sign_counterparty_commitment = sign_counterparty_commitment_LDKSign_jcall,
2603 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKSign_jcall,
2604 .sign_justice_transaction = sign_justice_transaction_LDKSign_jcall,
2605 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKSign_jcall,
2606 .sign_closing_transaction = sign_closing_transaction_LDKSign_jcall,
2607 .sign_channel_announcement = sign_channel_announcement_LDKSign_jcall,
2608 .ready_channel = ready_channel_LDKSign_jcall,
2609 .clone = LDKSign_JCalls_clone,
2610 .write = write_LDKSign_jcall,
2611 .free = LDKSign_JCalls_free,
2612 .pubkeys = pubkeys_conv,
2613 .set_pubkeys = NULL,
2617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2618 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2619 *res_ptr = LDKSign_init(env, clz, o, pubkeys);
2620 return (long)res_ptr;
2622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2623 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2624 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2625 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2630 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2631 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2632 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2637 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2638 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2639 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2644 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2645 LDKCommitmentTransaction commitment_tx_conv;
2646 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2647 commitment_tx_conv.is_owned = false;
2648 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2649 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2650 return (long)ret_conv;
2653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2654 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2655 LDKHolderCommitmentTransaction commitment_tx_conv;
2656 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2657 commitment_tx_conv.is_owned = false;
2658 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2659 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2660 return (long)ret_conv;
2663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1justice_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
2664 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2665 LDKTransaction justice_tx_ref;
2666 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2667 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2668 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2669 justice_tx_ref.data_is_owned = true;
2670 unsigned char per_commitment_key_arr[32];
2671 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2672 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2673 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2674 LDKHTLCOutputInCommitment htlc_conv;
2675 htlc_conv.inner = (void*)(htlc & (~1));
2676 htlc_conv.is_owned = false;
2677 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2678 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2679 return (long)ret_conv;
2682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
2683 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2684 LDKTransaction htlc_tx_ref;
2685 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2686 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2687 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2688 htlc_tx_ref.data_is_owned = true;
2689 LDKPublicKey per_commitment_point_ref;
2690 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2691 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2692 LDKHTLCOutputInCommitment htlc_conv;
2693 htlc_conv.inner = (void*)(htlc & (~1));
2694 htlc_conv.is_owned = false;
2695 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2696 *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, amount, per_commitment_point_ref, &htlc_conv);
2697 return (long)ret_conv;
2700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
2701 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2702 LDKTransaction closing_tx_ref;
2703 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2704 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2705 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2706 closing_tx_ref.data_is_owned = true;
2707 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2708 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2709 return (long)ret_conv;
2712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2713 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2714 LDKUnsignedChannelAnnouncement msg_conv;
2715 msg_conv.inner = (void*)(msg & (~1));
2716 msg_conv.is_owned = false;
2717 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2718 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2719 return (long)ret_conv;
2722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2723 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2724 LDKChannelTransactionParameters channel_parameters_conv;
2725 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2726 channel_parameters_conv.is_owned = false;
2727 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2731 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2732 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2733 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2734 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2735 CVec_u8Z_free(ret_var);
2739 LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) {
2740 if (this_arg->set_pubkeys != NULL)
2741 this_arg->set_pubkeys(this_arg);
2742 return this_arg->pubkeys;
2744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2745 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2746 LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv);
2747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2749 long ret_ref = (long)ret_var.inner;
2750 if (ret_var.is_owned) {
2756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2757 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2758 LDKThirtyTwoBytes a_ref;
2759 CHECK((*env)->GetArrayLength(env, a) == 32);
2760 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2762 LDKChannelMonitor b_conv;
2763 b_conv.inner = (void*)(b & (~1));
2764 b_conv.is_owned = (b & 1) || (b == 0);
2765 b_conv = ChannelMonitor_clone(&b_conv);
2769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2770 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2771 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2772 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2776 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2777 LDKChannelMonitor b_var = tuple->b;
2778 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2779 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2780 long b_ref = (long)b_var.inner & ~1;
2783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2784 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2787 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2788 CHECK(val->result_ok);
2789 long res_ref = (long)(&(*val->contents.result)) | 1;
2792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2793 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2794 CHECK(!val->result_ok);
2795 LDKDecodeError err_var = (*val->contents.err);
2796 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2797 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2798 long err_ref = (long)err_var.inner & ~1;
2801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2802 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2805 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2806 CHECK(val->result_ok);
2807 long res_ref = ((long)&(*val->contents.result)) | 1;
2808 return (long)res_ref;
2810 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2811 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2812 CHECK(!val->result_ok);
2813 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
2816 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
2817 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
2818 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
2819 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
2820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
2821 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
2822 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
2823 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
2824 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
2825 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
2826 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
2827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
2828 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
2829 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
2830 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
2832 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2833 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2835 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
2836 long some_ref = (long)(&obj->some) | 1;
2837 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
2839 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
2840 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
2845 static jclass LDKAPIError_APIMisuseError_class = NULL;
2846 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2847 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2848 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2849 static jclass LDKAPIError_RouteError_class = NULL;
2850 static jmethodID LDKAPIError_RouteError_meth = NULL;
2851 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2852 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2853 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2854 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2856 LDKAPIError_APIMisuseError_class =
2857 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2858 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2859 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
2860 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2861 LDKAPIError_FeeRateTooHigh_class =
2862 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2863 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2864 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
2865 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2866 LDKAPIError_RouteError_class =
2867 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2868 CHECK(LDKAPIError_RouteError_class != NULL);
2869 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2870 CHECK(LDKAPIError_RouteError_meth != NULL);
2871 LDKAPIError_ChannelUnavailable_class =
2872 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2873 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2874 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2875 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2876 LDKAPIError_MonitorUpdateFailed_class =
2877 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2878 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2879 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2880 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2882 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2883 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2885 case LDKAPIError_APIMisuseError: {
2886 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2887 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2888 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2889 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2891 case LDKAPIError_FeeRateTooHigh: {
2892 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2893 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2894 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2895 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2897 case LDKAPIError_RouteError: {
2898 LDKStr err_str = obj->route_error.err;
2899 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2900 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2902 case LDKAPIError_ChannelUnavailable: {
2903 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2904 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2905 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2906 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2908 case LDKAPIError_MonitorUpdateFailed: {
2909 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2915 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2918 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2919 CHECK(val->result_ok);
2920 return *val->contents.result;
2922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2923 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2924 CHECK(!val->result_ok);
2925 long err_ref = ((long)&(*val->contents.err)) | 1;
2928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2929 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2930 ret->datalen = (*env)->GetArrayLength(env, elems);
2931 if (ret->datalen == 0) {
2934 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2935 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2936 for (size_t i = 0; i < ret->datalen; i++) {
2937 int64_t arr_elem = java_elems[i];
2938 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2939 FREE((void*)arr_elem);
2940 ret->data[i] = arr_elem_conv;
2942 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2946 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2947 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2948 for (size_t i = 0; i < ret.datalen; i++) {
2949 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2954 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2955 ret->datalen = (*env)->GetArrayLength(env, elems);
2956 if (ret->datalen == 0) {
2959 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2960 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2961 for (size_t i = 0; i < ret->datalen; i++) {
2962 int64_t arr_elem = java_elems[i];
2963 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2964 FREE((void*)arr_elem);
2965 ret->data[i] = arr_elem_conv;
2967 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2971 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2972 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2973 for (size_t i = 0; i < ret.datalen; i++) {
2974 ret.data[i] = APIError_clone(&orig->data[i]);
2978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2979 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2980 ret->datalen = (*env)->GetArrayLength(env, elems);
2981 if (ret->datalen == 0) {
2984 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2985 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2986 for (size_t i = 0; i < ret->datalen; i++) {
2987 int64_t arr_elem = java_elems[i];
2988 LDKChannelDetails arr_elem_conv;
2989 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2990 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2991 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2992 ret->data[i] = arr_elem_conv;
2994 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2998 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2999 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
3000 for (size_t i = 0; i < ret.datalen; i++) {
3001 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
3005 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3006 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3007 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3008 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3009 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3010 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3011 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3012 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3014 LDKPaymentSendFailure_ParameterError_class =
3015 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3016 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3017 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3018 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3019 LDKPaymentSendFailure_PathParameterError_class =
3020 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3021 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3022 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3023 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3024 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3025 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3026 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3027 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3028 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3029 LDKPaymentSendFailure_PartialFailure_class =
3030 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3031 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3032 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3033 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3035 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3036 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3038 case LDKPaymentSendFailure_ParameterError: {
3039 long parameter_error_ref = ((long)&obj->parameter_error) | 1;
3040 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3042 case LDKPaymentSendFailure_PathParameterError: {
3043 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3044 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3045 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3046 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3047 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3048 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3049 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3050 path_parameter_error_arr_ptr[w] = (long)path_parameter_error_conv_22_conv;
3052 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3053 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3055 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3056 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3057 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3058 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3059 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3060 long all_failed_retry_safe_conv_10_ref = ((long)&all_failed_retry_safe_var.data[k]) | 1;
3061 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3063 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3064 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3066 case LDKPaymentSendFailure_PartialFailure: {
3067 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3068 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3069 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3070 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3071 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3072 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3073 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3074 partial_failure_arr_ptr[w] = (long)partial_failure_conv_22_conv;
3076 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3077 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3083 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3086 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3087 CHECK(val->result_ok);
3088 return *val->contents.result;
3090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3091 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3092 CHECK(!val->result_ok);
3093 long err_ref = ((long)&(*val->contents.err)) | 1;
3096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3097 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3098 ret->datalen = (*env)->GetArrayLength(env, elems);
3099 if (ret->datalen == 0) {
3102 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3103 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3104 for (size_t i = 0; i < ret->datalen; i++) {
3105 int64_t arr_elem = java_elems[i];
3106 LDKChannelMonitor arr_elem_conv;
3107 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3108 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3109 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3110 ret->data[i] = arr_elem_conv;
3112 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3116 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3117 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3118 for (size_t i = 0; i < ret.datalen; i++) {
3119 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3123 typedef struct LDKWatch_JCalls {
3124 atomic_size_t refcnt;
3127 jmethodID watch_channel_meth;
3128 jmethodID update_channel_meth;
3129 jmethodID release_pending_monitor_events_meth;
3131 static void LDKWatch_JCalls_free(void* this_arg) {
3132 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3133 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3135 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3136 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3140 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3141 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3143 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3144 LDKOutPoint funding_txo_var = funding_txo;
3145 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3146 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3147 long funding_txo_ref = (long)funding_txo_var.inner;
3148 if (funding_txo_var.is_owned) {
3149 funding_txo_ref |= 1;
3151 LDKChannelMonitor monitor_var = monitor;
3152 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3153 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3154 long monitor_ref = (long)monitor_var.inner;
3155 if (monitor_var.is_owned) {
3158 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3160 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3161 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3162 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3165 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3166 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3168 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3169 LDKOutPoint funding_txo_var = funding_txo;
3170 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3171 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3172 long funding_txo_ref = (long)funding_txo_var.inner;
3173 if (funding_txo_var.is_owned) {
3174 funding_txo_ref |= 1;
3176 LDKChannelMonitorUpdate update_var = update;
3177 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3178 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3179 long update_ref = (long)update_var.inner;
3180 if (update_var.is_owned) {
3183 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3185 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3186 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3187 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3190 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3191 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3193 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3194 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3196 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3197 LDKCVec_MonitorEventZ ret_constr;
3198 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3199 if (ret_constr.datalen > 0)
3200 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3202 ret_constr.data = NULL;
3203 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3204 for (size_t o = 0; o < ret_constr.datalen; o++) {
3205 int64_t ret_conv_14 = ret_vals[o];
3206 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3207 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14);
3208 ret_constr.data[o] = ret_conv_14_conv;
3210 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3213 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3214 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3215 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3216 return (void*) this_arg;
3218 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3219 jclass c = (*env)->GetObjectClass(env, o);
3221 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3222 atomic_init(&calls->refcnt, 1);
3223 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3224 calls->o = (*env)->NewWeakGlobalRef(env, o);
3225 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3226 CHECK(calls->watch_channel_meth != NULL);
3227 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3228 CHECK(calls->update_channel_meth != NULL);
3229 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3230 CHECK(calls->release_pending_monitor_events_meth != NULL);
3233 .this_arg = (void*) calls,
3234 .watch_channel = watch_channel_LDKWatch_jcall,
3235 .update_channel = update_channel_LDKWatch_jcall,
3236 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3237 .free = LDKWatch_JCalls_free,
3241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3242 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3243 *res_ptr = LDKWatch_init(env, clz, o);
3244 return (long)res_ptr;
3246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t monitor) {
3247 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3248 LDKOutPoint funding_txo_conv;
3249 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3250 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3251 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3252 LDKChannelMonitor monitor_conv;
3253 monitor_conv.inner = (void*)(monitor & (~1));
3254 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3255 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3256 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3257 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3258 return (long)ret_conv;
3261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t update) {
3262 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3263 LDKOutPoint funding_txo_conv;
3264 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3265 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3266 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3267 LDKChannelMonitorUpdate update_conv;
3268 update_conv.inner = (void*)(update & (~1));
3269 update_conv.is_owned = (update & 1) || (update == 0);
3270 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3271 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3272 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3273 return (long)ret_conv;
3276 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3277 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3278 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3279 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3280 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3281 for (size_t o = 0; o < ret_var.datalen; o++) {
3282 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3283 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3284 long ret_conv_14_ref = (long)ret_conv_14_copy;
3285 ret_arr_ptr[o] = ret_conv_14_ref;
3287 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3292 typedef struct LDKBroadcasterInterface_JCalls {
3293 atomic_size_t refcnt;
3296 jmethodID broadcast_transaction_meth;
3297 } LDKBroadcasterInterface_JCalls;
3298 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3299 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3300 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3302 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3303 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3307 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3308 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3310 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3311 LDKTransaction tx_var = tx;
3312 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3313 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3314 Transaction_free(tx_var);
3315 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3317 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3319 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3320 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3321 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3322 return (void*) this_arg;
3324 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3325 jclass c = (*env)->GetObjectClass(env, o);
3327 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3328 atomic_init(&calls->refcnt, 1);
3329 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3330 calls->o = (*env)->NewWeakGlobalRef(env, o);
3331 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3332 CHECK(calls->broadcast_transaction_meth != NULL);
3334 LDKBroadcasterInterface ret = {
3335 .this_arg = (void*) calls,
3336 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3337 .free = LDKBroadcasterInterface_JCalls_free,
3341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3342 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3343 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3344 return (long)res_ptr;
3346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3347 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3348 LDKTransaction tx_ref;
3349 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3350 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3351 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3352 tx_ref.data_is_owned = true;
3353 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3357 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
3359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3360 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3361 CHECK(val->result_ok);
3362 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3363 *ret = Sign_clone(&(*val->contents.result));
3366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3367 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3368 CHECK(!val->result_ok);
3369 LDKDecodeError err_var = (*val->contents.err);
3370 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3371 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3372 long err_ref = (long)err_var.inner & ~1;
3375 typedef struct LDKKeysInterface_JCalls {
3376 atomic_size_t refcnt;
3379 jmethodID get_node_secret_meth;
3380 jmethodID get_destination_script_meth;
3381 jmethodID get_shutdown_pubkey_meth;
3382 jmethodID get_channel_signer_meth;
3383 jmethodID get_secure_random_bytes_meth;
3384 jmethodID read_chan_signer_meth;
3385 } LDKKeysInterface_JCalls;
3386 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3387 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3388 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3390 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3391 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3395 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3396 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3398 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3399 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3401 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3402 LDKSecretKey ret_ref;
3403 CHECK((*env)->GetArrayLength(env, ret) == 32);
3404 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3407 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3408 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3410 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3411 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3413 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3414 LDKCVec_u8Z ret_ref;
3415 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3416 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3417 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3420 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3421 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3423 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3424 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3426 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3427 LDKPublicKey ret_ref;
3428 CHECK((*env)->GetArrayLength(env, ret) == 33);
3429 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3432 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3433 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3435 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3436 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3438 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3439 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3440 ret_conv = Sign_clone(ret);
3443 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3444 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3446 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3447 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3449 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3450 LDKThirtyTwoBytes ret_ref;
3451 CHECK((*env)->GetArrayLength(env, ret) == 32);
3452 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3455 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3456 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3458 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3459 LDKu8slice reader_var = reader;
3460 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3461 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3462 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3464 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3465 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3466 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret);
3469 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3470 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3471 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3472 return (void*) this_arg;
3474 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3475 jclass c = (*env)->GetObjectClass(env, o);
3477 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3478 atomic_init(&calls->refcnt, 1);
3479 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3480 calls->o = (*env)->NewWeakGlobalRef(env, o);
3481 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3482 CHECK(calls->get_node_secret_meth != NULL);
3483 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3484 CHECK(calls->get_destination_script_meth != NULL);
3485 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3486 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3487 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3488 CHECK(calls->get_channel_signer_meth != NULL);
3489 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3490 CHECK(calls->get_secure_random_bytes_meth != NULL);
3491 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3492 CHECK(calls->read_chan_signer_meth != NULL);
3494 LDKKeysInterface ret = {
3495 .this_arg = (void*) calls,
3496 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3497 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3498 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3499 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3500 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3501 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3502 .free = LDKKeysInterface_JCalls_free,
3506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3507 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3508 *res_ptr = LDKKeysInterface_init(env, clz, o);
3509 return (long)res_ptr;
3511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3512 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3513 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3514 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3519 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3520 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3521 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3522 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3523 CVec_u8Z_free(ret_var);
3527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3528 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3529 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3530 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3535 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3536 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3537 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3542 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3543 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3544 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3549 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3550 LDKu8slice reader_ref;
3551 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3552 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3553 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3554 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3555 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3556 return (long)ret_conv;
3559 typedef struct LDKFeeEstimator_JCalls {
3560 atomic_size_t refcnt;
3563 jmethodID get_est_sat_per_1000_weight_meth;
3564 } LDKFeeEstimator_JCalls;
3565 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3566 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3567 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3569 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3570 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3574 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3575 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3577 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3578 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3579 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3581 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3583 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3584 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3585 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3586 return (void*) this_arg;
3588 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3589 jclass c = (*env)->GetObjectClass(env, o);
3591 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3592 atomic_init(&calls->refcnt, 1);
3593 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3594 calls->o = (*env)->NewWeakGlobalRef(env, o);
3595 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
3596 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3598 LDKFeeEstimator ret = {
3599 .this_arg = (void*) calls,
3600 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3601 .free = LDKFeeEstimator_JCalls_free,
3605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3606 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3607 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3608 return (long)res_ptr;
3610 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_arg, jclass confirmation_target) {
3611 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3612 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3613 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3617 typedef struct LDKLogger_JCalls {
3618 atomic_size_t refcnt;
3623 static void LDKLogger_JCalls_free(void* this_arg) {
3624 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3625 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3627 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3628 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3632 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3633 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3635 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3636 const char* record_str = record;
3637 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3638 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3640 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3642 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3643 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3644 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3645 return (void*) this_arg;
3647 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3648 jclass c = (*env)->GetObjectClass(env, o);
3650 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3651 atomic_init(&calls->refcnt, 1);
3652 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3653 calls->o = (*env)->NewWeakGlobalRef(env, o);
3654 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3655 CHECK(calls->log_meth != NULL);
3658 .this_arg = (void*) calls,
3659 .log = log_LDKLogger_jcall,
3660 .free = LDKLogger_JCalls_free,
3664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3665 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3666 *res_ptr = LDKLogger_init(env, clz, o);
3667 return (long)res_ptr;
3669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3670 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3671 LDKThirtyTwoBytes a_ref;
3672 CHECK((*env)->GetArrayLength(env, a) == 32);
3673 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3675 LDKChannelManager b_conv;
3676 b_conv.inner = (void*)(b & (~1));
3677 b_conv.is_owned = (b & 1) || (b == 0);
3678 // Warning: we need a move here but no clone is available for LDKChannelManager
3682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3683 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3684 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3685 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3689 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3690 LDKChannelManager b_var = tuple->b;
3691 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3692 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3693 long b_ref = (long)b_var.inner & ~1;
3696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3697 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3700 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3701 CHECK(val->result_ok);
3702 long res_ref = (long)(&(*val->contents.result)) | 1;
3705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3706 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3707 CHECK(!val->result_ok);
3708 LDKDecodeError err_var = (*val->contents.err);
3709 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3710 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3711 long err_ref = (long)err_var.inner & ~1;
3714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3715 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
3717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3718 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3719 CHECK(val->result_ok);
3720 long res_ref = ((long)&(*val->contents.result)) | 1;
3723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3724 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3725 CHECK(!val->result_ok);
3726 LDKDecodeError err_var = (*val->contents.err);
3727 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3728 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3729 long err_ref = (long)err_var.inner & ~1;
3732 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3733 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3734 for (size_t i = 0; i < ret.datalen; i++) {
3735 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3740 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3742 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3743 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3744 CHECK(val->result_ok);
3745 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3746 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3748 for (size_t i = 0; i < res_var.datalen; i++) {
3749 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3750 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3751 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3752 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3757 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3758 CHECK(!val->result_ok);
3759 return *val->contents.err;
3761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3762 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3765 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3766 CHECK(val->result_ok);
3767 LDKInMemorySigner res_var = (*val->contents.result);
3768 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3769 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3770 long res_ref = (long)res_var.inner & ~1;
3773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3774 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3775 CHECK(!val->result_ok);
3776 LDKDecodeError err_var = (*val->contents.err);
3777 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3778 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3779 long err_ref = (long)err_var.inner & ~1;
3782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3783 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3784 ret->datalen = (*env)->GetArrayLength(env, elems);
3785 if (ret->datalen == 0) {
3788 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3789 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3790 for (size_t i = 0; i < ret->datalen; i++) {
3791 int64_t arr_elem = java_elems[i];
3792 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3793 FREE((void*)arr_elem);
3794 ret->data[i] = arr_elem_conv;
3796 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3800 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3801 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3802 for (size_t i = 0; i < ret.datalen; i++) {
3803 ret.data[i] = TxOut_clone(&orig->data[i]);
3807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3808 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3811 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3812 CHECK(val->result_ok);
3813 LDKTransaction res_var = (*val->contents.result);
3814 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3815 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3819 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3820 CHECK(!val->result_ok);
3821 return *val->contents.err;
3823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3824 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3825 ret->datalen = (*env)->GetArrayLength(env, elems);
3826 if (ret->datalen == 0) {
3829 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3830 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3831 for (size_t i = 0; i < ret->datalen; i++) {
3832 int64_t arr_elem = java_elems[i];
3833 LDKRouteHop arr_elem_conv;
3834 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3835 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3836 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3837 ret->data[i] = arr_elem_conv;
3839 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3843 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3844 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3845 for (size_t i = 0; i < ret.datalen; i++) {
3846 ret.data[i] = RouteHop_clone(&orig->data[i]);
3850 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3851 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3852 for (size_t i = 0; i < ret.datalen; i++) {
3853 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3858 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3861 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3862 CHECK(val->result_ok);
3863 LDKRoute res_var = (*val->contents.result);
3864 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3865 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3866 long res_ref = (long)res_var.inner & ~1;
3869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3870 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3871 CHECK(!val->result_ok);
3872 LDKDecodeError err_var = (*val->contents.err);
3873 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3874 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3875 long err_ref = (long)err_var.inner & ~1;
3878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3879 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3880 ret->datalen = (*env)->GetArrayLength(env, elems);
3881 if (ret->datalen == 0) {
3884 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3885 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3886 for (size_t i = 0; i < ret->datalen; i++) {
3887 int64_t arr_elem = java_elems[i];
3888 LDKRouteHint arr_elem_conv;
3889 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3890 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3891 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3892 ret->data[i] = arr_elem_conv;
3894 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3898 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3899 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3900 for (size_t i = 0; i < ret.datalen; i++) {
3901 ret.data[i] = RouteHint_clone(&orig->data[i]);
3905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3906 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3909 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3910 CHECK(val->result_ok);
3911 LDKRoute res_var = (*val->contents.result);
3912 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3913 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3914 long res_ref = (long)res_var.inner & ~1;
3917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3918 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3919 CHECK(!val->result_ok);
3920 LDKLightningError err_var = (*val->contents.err);
3921 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3922 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3923 long err_ref = (long)err_var.inner & ~1;
3926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3927 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3930 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3931 CHECK(val->result_ok);
3932 long res_ref = ((long)&(*val->contents.result)) | 1;
3935 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3936 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3937 CHECK(!val->result_ok);
3938 return *val->contents.err;
3940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3941 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3944 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3945 CHECK(val->result_ok);
3946 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3947 *res_conv = (*val->contents.result);
3948 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3949 return (long)res_conv;
3951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3952 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3953 CHECK(!val->result_ok);
3954 LDKDecodeError err_var = (*val->contents.err);
3955 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3956 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3957 long err_ref = (long)err_var.inner & ~1;
3960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3961 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3962 ret->datalen = (*env)->GetArrayLength(env, elems);
3963 if (ret->datalen == 0) {
3966 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3967 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3968 for (size_t i = 0; i < ret->datalen; i++) {
3969 int64_t arr_elem = java_elems[i];
3970 LDKUpdateAddHTLC arr_elem_conv;
3971 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3972 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3973 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3974 ret->data[i] = arr_elem_conv;
3976 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3980 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3981 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3982 for (size_t i = 0; i < ret.datalen; i++) {
3983 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3988 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3989 ret->datalen = (*env)->GetArrayLength(env, elems);
3990 if (ret->datalen == 0) {
3993 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3994 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3995 for (size_t i = 0; i < ret->datalen; i++) {
3996 int64_t arr_elem = java_elems[i];
3997 LDKUpdateFulfillHTLC arr_elem_conv;
3998 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3999 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4000 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
4001 ret->data[i] = arr_elem_conv;
4003 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4007 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4008 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4009 for (size_t i = 0; i < ret.datalen; i++) {
4010 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4015 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
4016 ret->datalen = (*env)->GetArrayLength(env, elems);
4017 if (ret->datalen == 0) {
4020 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
4021 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4022 for (size_t i = 0; i < ret->datalen; i++) {
4023 int64_t arr_elem = java_elems[i];
4024 LDKUpdateFailHTLC arr_elem_conv;
4025 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4026 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4027 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
4028 ret->data[i] = arr_elem_conv;
4030 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4034 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4035 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4036 for (size_t i = 0; i < ret.datalen; i++) {
4037 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4042 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
4043 ret->datalen = (*env)->GetArrayLength(env, elems);
4044 if (ret->datalen == 0) {
4047 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
4048 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4049 for (size_t i = 0; i < ret->datalen; i++) {
4050 int64_t arr_elem = java_elems[i];
4051 LDKUpdateFailMalformedHTLC arr_elem_conv;
4052 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4053 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4054 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
4055 ret->data[i] = arr_elem_conv;
4057 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4061 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4062 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4063 for (size_t i = 0; i < ret.datalen; i++) {
4064 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4069 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
4071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4072 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4073 CHECK(val->result_ok);
4074 LDKAcceptChannel res_var = (*val->contents.result);
4075 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4076 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4077 long res_ref = (long)res_var.inner & ~1;
4080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4081 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
4082 CHECK(!val->result_ok);
4083 LDKDecodeError err_var = (*val->contents.err);
4084 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4085 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4086 long err_ref = (long)err_var.inner & ~1;
4089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4090 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
4092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4093 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4094 CHECK(val->result_ok);
4095 LDKAnnouncementSignatures res_var = (*val->contents.result);
4096 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4097 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4098 long res_ref = (long)res_var.inner & ~1;
4101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4102 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
4103 CHECK(!val->result_ok);
4104 LDKDecodeError err_var = (*val->contents.err);
4105 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4106 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4107 long err_ref = (long)err_var.inner & ~1;
4110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4111 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
4113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4114 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4115 CHECK(val->result_ok);
4116 LDKChannelReestablish res_var = (*val->contents.result);
4117 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4118 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4119 long res_ref = (long)res_var.inner & ~1;
4122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4123 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
4124 CHECK(!val->result_ok);
4125 LDKDecodeError err_var = (*val->contents.err);
4126 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4127 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4128 long err_ref = (long)err_var.inner & ~1;
4131 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4132 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
4134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4135 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4136 CHECK(val->result_ok);
4137 LDKClosingSigned res_var = (*val->contents.result);
4138 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4139 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4140 long res_ref = (long)res_var.inner & ~1;
4143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4144 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
4145 CHECK(!val->result_ok);
4146 LDKDecodeError err_var = (*val->contents.err);
4147 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4148 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4149 long err_ref = (long)err_var.inner & ~1;
4152 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4153 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
4155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4156 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4157 CHECK(val->result_ok);
4158 LDKCommitmentSigned res_var = (*val->contents.result);
4159 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4160 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4161 long res_ref = (long)res_var.inner & ~1;
4164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4165 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
4166 CHECK(!val->result_ok);
4167 LDKDecodeError err_var = (*val->contents.err);
4168 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4169 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4170 long err_ref = (long)err_var.inner & ~1;
4173 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4174 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
4176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4177 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4178 CHECK(val->result_ok);
4179 LDKFundingCreated res_var = (*val->contents.result);
4180 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4181 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4182 long res_ref = (long)res_var.inner & ~1;
4185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4186 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
4187 CHECK(!val->result_ok);
4188 LDKDecodeError err_var = (*val->contents.err);
4189 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4190 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4191 long err_ref = (long)err_var.inner & ~1;
4194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4195 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
4197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4198 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4199 CHECK(val->result_ok);
4200 LDKFundingSigned res_var = (*val->contents.result);
4201 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4202 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4203 long res_ref = (long)res_var.inner & ~1;
4206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4207 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
4208 CHECK(!val->result_ok);
4209 LDKDecodeError err_var = (*val->contents.err);
4210 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4211 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4212 long err_ref = (long)err_var.inner & ~1;
4215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4216 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
4218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4219 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4220 CHECK(val->result_ok);
4221 LDKFundingLocked res_var = (*val->contents.result);
4222 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4223 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4224 long res_ref = (long)res_var.inner & ~1;
4227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4228 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
4229 CHECK(!val->result_ok);
4230 LDKDecodeError err_var = (*val->contents.err);
4231 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4232 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4233 long err_ref = (long)err_var.inner & ~1;
4236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4237 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
4239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4240 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4241 CHECK(val->result_ok);
4242 LDKInit res_var = (*val->contents.result);
4243 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4244 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4245 long res_ref = (long)res_var.inner & ~1;
4248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4249 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
4250 CHECK(!val->result_ok);
4251 LDKDecodeError err_var = (*val->contents.err);
4252 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4253 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4254 long err_ref = (long)err_var.inner & ~1;
4257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4258 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
4260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4261 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4262 CHECK(val->result_ok);
4263 LDKOpenChannel res_var = (*val->contents.result);
4264 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4265 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4266 long res_ref = (long)res_var.inner & ~1;
4269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4270 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
4271 CHECK(!val->result_ok);
4272 LDKDecodeError err_var = (*val->contents.err);
4273 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4274 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4275 long err_ref = (long)err_var.inner & ~1;
4278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4279 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
4281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4282 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4283 CHECK(val->result_ok);
4284 LDKRevokeAndACK res_var = (*val->contents.result);
4285 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4286 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4287 long res_ref = (long)res_var.inner & ~1;
4290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4291 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
4292 CHECK(!val->result_ok);
4293 LDKDecodeError err_var = (*val->contents.err);
4294 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4295 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4296 long err_ref = (long)err_var.inner & ~1;
4299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4300 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
4302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4303 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4304 CHECK(val->result_ok);
4305 LDKShutdown res_var = (*val->contents.result);
4306 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4307 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4308 long res_ref = (long)res_var.inner & ~1;
4311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4312 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
4313 CHECK(!val->result_ok);
4314 LDKDecodeError err_var = (*val->contents.err);
4315 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4316 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4317 long err_ref = (long)err_var.inner & ~1;
4320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4321 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
4323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4324 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4325 CHECK(val->result_ok);
4326 LDKUpdateFailHTLC res_var = (*val->contents.result);
4327 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4328 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4329 long res_ref = (long)res_var.inner & ~1;
4332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4333 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
4334 CHECK(!val->result_ok);
4335 LDKDecodeError err_var = (*val->contents.err);
4336 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4337 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4338 long err_ref = (long)err_var.inner & ~1;
4341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4342 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
4344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4345 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4346 CHECK(val->result_ok);
4347 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
4348 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4349 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4350 long res_ref = (long)res_var.inner & ~1;
4353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4354 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
4355 CHECK(!val->result_ok);
4356 LDKDecodeError err_var = (*val->contents.err);
4357 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4358 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4359 long err_ref = (long)err_var.inner & ~1;
4362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4363 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
4365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4366 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4367 CHECK(val->result_ok);
4368 LDKUpdateFee res_var = (*val->contents.result);
4369 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4370 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4371 long res_ref = (long)res_var.inner & ~1;
4374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4375 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
4376 CHECK(!val->result_ok);
4377 LDKDecodeError err_var = (*val->contents.err);
4378 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4379 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4380 long err_ref = (long)err_var.inner & ~1;
4383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4384 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
4386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4387 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4388 CHECK(val->result_ok);
4389 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
4390 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4391 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4392 long res_ref = (long)res_var.inner & ~1;
4395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4396 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
4397 CHECK(!val->result_ok);
4398 LDKDecodeError err_var = (*val->contents.err);
4399 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4400 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4401 long err_ref = (long)err_var.inner & ~1;
4404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4405 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
4407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4408 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4409 CHECK(val->result_ok);
4410 LDKUpdateAddHTLC res_var = (*val->contents.result);
4411 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4412 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4413 long res_ref = (long)res_var.inner & ~1;
4416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4417 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
4418 CHECK(!val->result_ok);
4419 LDKDecodeError err_var = (*val->contents.err);
4420 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4421 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4422 long err_ref = (long)err_var.inner & ~1;
4425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4426 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
4428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4429 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4430 CHECK(val->result_ok);
4431 LDKPing res_var = (*val->contents.result);
4432 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4433 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4434 long res_ref = (long)res_var.inner & ~1;
4437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4438 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4439 CHECK(!val->result_ok);
4440 LDKDecodeError err_var = (*val->contents.err);
4441 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4442 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4443 long err_ref = (long)err_var.inner & ~1;
4446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4447 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4450 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4451 CHECK(val->result_ok);
4452 LDKPong res_var = (*val->contents.result);
4453 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4454 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4455 long res_ref = (long)res_var.inner & ~1;
4458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4459 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4460 CHECK(!val->result_ok);
4461 LDKDecodeError err_var = (*val->contents.err);
4462 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4463 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4464 long err_ref = (long)err_var.inner & ~1;
4467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4468 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4471 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4472 CHECK(val->result_ok);
4473 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4474 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4475 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4476 long res_ref = (long)res_var.inner & ~1;
4479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4480 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4481 CHECK(!val->result_ok);
4482 LDKDecodeError err_var = (*val->contents.err);
4483 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4484 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4485 long err_ref = (long)err_var.inner & ~1;
4488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4489 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4492 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4493 CHECK(val->result_ok);
4494 LDKChannelAnnouncement res_var = (*val->contents.result);
4495 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4496 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4497 long res_ref = (long)res_var.inner & ~1;
4500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4501 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4502 CHECK(!val->result_ok);
4503 LDKDecodeError err_var = (*val->contents.err);
4504 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4505 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4506 long err_ref = (long)err_var.inner & ~1;
4509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4510 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4513 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4514 CHECK(val->result_ok);
4515 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4516 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4517 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4518 long res_ref = (long)res_var.inner & ~1;
4521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4522 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4523 CHECK(!val->result_ok);
4524 LDKDecodeError err_var = (*val->contents.err);
4525 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4526 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4527 long err_ref = (long)err_var.inner & ~1;
4530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4531 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4534 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4535 CHECK(val->result_ok);
4536 LDKChannelUpdate res_var = (*val->contents.result);
4537 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4538 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4539 long res_ref = (long)res_var.inner & ~1;
4542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4543 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4544 CHECK(!val->result_ok);
4545 LDKDecodeError err_var = (*val->contents.err);
4546 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4547 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4548 long err_ref = (long)err_var.inner & ~1;
4551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4552 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4555 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4556 CHECK(val->result_ok);
4557 LDKErrorMessage res_var = (*val->contents.result);
4558 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4559 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4560 long res_ref = (long)res_var.inner & ~1;
4563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4564 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4565 CHECK(!val->result_ok);
4566 LDKDecodeError err_var = (*val->contents.err);
4567 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4568 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4569 long err_ref = (long)err_var.inner & ~1;
4572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4573 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4576 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4577 CHECK(val->result_ok);
4578 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
4579 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4580 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4581 long res_ref = (long)res_var.inner & ~1;
4584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4585 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4586 CHECK(!val->result_ok);
4587 LDKDecodeError err_var = (*val->contents.err);
4588 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4589 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4590 long err_ref = (long)err_var.inner & ~1;
4593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4594 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4597 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4598 CHECK(val->result_ok);
4599 LDKNodeAnnouncement res_var = (*val->contents.result);
4600 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4601 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4602 long res_ref = (long)res_var.inner & ~1;
4605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4606 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4607 CHECK(!val->result_ok);
4608 LDKDecodeError err_var = (*val->contents.err);
4609 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4610 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4611 long err_ref = (long)err_var.inner & ~1;
4614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4615 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
4617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4618 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4619 CHECK(val->result_ok);
4620 LDKQueryShortChannelIds res_var = (*val->contents.result);
4621 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4622 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4623 long res_ref = (long)res_var.inner & ~1;
4626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4627 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4628 CHECK(!val->result_ok);
4629 LDKDecodeError err_var = (*val->contents.err);
4630 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4631 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4632 long err_ref = (long)err_var.inner & ~1;
4635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4636 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
4638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4639 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4640 CHECK(val->result_ok);
4641 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
4642 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4643 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4644 long res_ref = (long)res_var.inner & ~1;
4647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4648 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4649 CHECK(!val->result_ok);
4650 LDKDecodeError err_var = (*val->contents.err);
4651 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4652 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4653 long err_ref = (long)err_var.inner & ~1;
4656 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4657 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
4659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4660 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4661 CHECK(val->result_ok);
4662 LDKQueryChannelRange res_var = (*val->contents.result);
4663 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4664 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4665 long res_ref = (long)res_var.inner & ~1;
4668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4669 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4670 CHECK(!val->result_ok);
4671 LDKDecodeError err_var = (*val->contents.err);
4672 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4673 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4674 long err_ref = (long)err_var.inner & ~1;
4677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4678 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
4680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4681 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4682 CHECK(val->result_ok);
4683 LDKReplyChannelRange res_var = (*val->contents.result);
4684 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4685 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4686 long res_ref = (long)res_var.inner & ~1;
4689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4690 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4691 CHECK(!val->result_ok);
4692 LDKDecodeError err_var = (*val->contents.err);
4693 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4694 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4695 long err_ref = (long)err_var.inner & ~1;
4698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4699 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
4701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4702 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4703 CHECK(val->result_ok);
4704 LDKGossipTimestampFilter res_var = (*val->contents.result);
4705 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4706 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4707 long res_ref = (long)res_var.inner & ~1;
4710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4711 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4712 CHECK(!val->result_ok);
4713 LDKDecodeError err_var = (*val->contents.err);
4714 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4715 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4716 long err_ref = (long)err_var.inner & ~1;
4719 typedef struct LDKMessageSendEventsProvider_JCalls {
4720 atomic_size_t refcnt;
4723 jmethodID get_and_clear_pending_msg_events_meth;
4724 } LDKMessageSendEventsProvider_JCalls;
4725 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4726 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4727 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4729 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4730 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4734 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
4735 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4737 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4738 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4740 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
4741 LDKCVec_MessageSendEventZ ret_constr;
4742 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4743 if (ret_constr.datalen > 0)
4744 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4746 ret_constr.data = NULL;
4747 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4748 for (size_t s = 0; s < ret_constr.datalen; s++) {
4749 int64_t ret_conv_18 = ret_vals[s];
4750 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
4751 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18);
4752 ret_constr.data[s] = ret_conv_18_conv;
4754 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4757 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
4758 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4759 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4760 return (void*) this_arg;
4762 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4763 jclass c = (*env)->GetObjectClass(env, o);
4765 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4766 atomic_init(&calls->refcnt, 1);
4767 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4768 calls->o = (*env)->NewWeakGlobalRef(env, o);
4769 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
4770 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
4772 LDKMessageSendEventsProvider ret = {
4773 .this_arg = (void*) calls,
4774 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
4775 .free = LDKMessageSendEventsProvider_JCalls_free,
4779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4780 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4781 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
4782 return (long)res_ptr;
4784 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4785 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
4786 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4787 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4788 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4789 for (size_t s = 0; s < ret_var.datalen; s++) {
4790 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4791 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4792 long ret_conv_18_ref = (long)ret_conv_18_copy;
4793 ret_arr_ptr[s] = ret_conv_18_ref;
4795 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4800 typedef struct LDKEventsProvider_JCalls {
4801 atomic_size_t refcnt;
4804 jmethodID get_and_clear_pending_events_meth;
4805 } LDKEventsProvider_JCalls;
4806 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4807 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4808 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4810 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4811 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4815 LDKCVec_EventZ get_and_clear_pending_events_LDKEventsProvider_jcall(const void* this_arg) {
4816 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4818 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4819 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4821 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
4822 LDKCVec_EventZ ret_constr;
4823 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4824 if (ret_constr.datalen > 0)
4825 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4827 ret_constr.data = NULL;
4828 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4829 for (size_t h = 0; h < ret_constr.datalen; h++) {
4830 int64_t ret_conv_7 = ret_vals[h];
4831 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
4832 ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7);
4833 ret_constr.data[h] = ret_conv_7_conv;
4835 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4838 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
4839 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4840 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4841 return (void*) this_arg;
4843 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4844 jclass c = (*env)->GetObjectClass(env, o);
4846 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4847 atomic_init(&calls->refcnt, 1);
4848 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4849 calls->o = (*env)->NewWeakGlobalRef(env, o);
4850 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
4851 CHECK(calls->get_and_clear_pending_events_meth != NULL);
4853 LDKEventsProvider ret = {
4854 .this_arg = (void*) calls,
4855 .get_and_clear_pending_events = get_and_clear_pending_events_LDKEventsProvider_jcall,
4856 .free = LDKEventsProvider_JCalls_free,
4860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4861 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4862 *res_ptr = LDKEventsProvider_init(env, clz, o);
4863 return (long)res_ptr;
4865 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4866 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4867 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
4868 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4869 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4870 for (size_t h = 0; h < ret_var.datalen; h++) {
4871 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4872 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
4873 long ret_conv_7_ref = (long)ret_conv_7_copy;
4874 ret_arr_ptr[h] = ret_conv_7_ref;
4876 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4881 typedef struct LDKAccess_JCalls {
4882 atomic_size_t refcnt;
4885 jmethodID get_utxo_meth;
4887 static void LDKAccess_JCalls_free(void* this_arg) {
4888 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4889 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4891 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4892 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4896 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4897 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4899 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4900 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
4901 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
4902 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4904 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4905 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4906 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
4909 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4910 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4911 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4912 return (void*) this_arg;
4914 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
4915 jclass c = (*env)->GetObjectClass(env, o);
4917 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4918 atomic_init(&calls->refcnt, 1);
4919 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4920 calls->o = (*env)->NewWeakGlobalRef(env, o);
4921 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
4922 CHECK(calls->get_utxo_meth != NULL);
4925 .this_arg = (void*) calls,
4926 .get_utxo = get_utxo_LDKAccess_jcall,
4927 .free = LDKAccess_JCalls_free,
4931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
4932 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4933 *res_ptr = LDKAccess_init(env, clz, o);
4934 return (long)res_ptr;
4936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4937 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4938 unsigned char genesis_hash_arr[32];
4939 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
4940 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4941 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4942 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4943 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4944 return (long)ret_conv;
4947 typedef struct LDKListen_JCalls {
4948 atomic_size_t refcnt;
4951 jmethodID block_connected_meth;
4952 jmethodID block_disconnected_meth;
4954 static void LDKListen_JCalls_free(void* this_arg) {
4955 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4956 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4958 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4959 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4963 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4964 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4966 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4967 LDKu8slice block_var = block;
4968 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
4969 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
4970 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4972 return (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
4974 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4975 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4977 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4978 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
4979 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
4980 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4982 return (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
4984 static void* LDKListen_JCalls_clone(const void* this_arg) {
4985 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4986 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4987 return (void*) this_arg;
4989 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
4990 jclass c = (*env)->GetObjectClass(env, o);
4992 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4993 atomic_init(&calls->refcnt, 1);
4994 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4995 calls->o = (*env)->NewWeakGlobalRef(env, o);
4996 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
4997 CHECK(calls->block_connected_meth != NULL);
4998 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
4999 CHECK(calls->block_disconnected_meth != NULL);
5002 .this_arg = (void*) calls,
5003 .block_connected = block_connected_LDKListen_jcall,
5004 .block_disconnected = block_disconnected_LDKListen_jcall,
5005 .free = LDKListen_JCalls_free,
5009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
5010 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
5011 *res_ptr = LDKListen_init(env, clz, o);
5012 return (long)res_ptr;
5014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray block, int32_t height) {
5015 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5016 LDKu8slice block_ref;
5017 block_ref.datalen = (*env)->GetArrayLength(env, block);
5018 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
5019 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
5020 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
5023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
5024 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
5025 unsigned char header_arr[80];
5026 CHECK((*env)->GetArrayLength(env, header) == 80);
5027 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
5028 unsigned char (*header_ref)[80] = &header_arr;
5029 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
5032 typedef struct LDKFilter_JCalls {
5033 atomic_size_t refcnt;
5036 jmethodID register_tx_meth;
5037 jmethodID register_output_meth;
5039 static void LDKFilter_JCalls_free(void* this_arg) {
5040 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5041 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5043 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5044 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5048 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5049 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5051 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5052 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
5053 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
5054 LDKu8slice script_pubkey_var = script_pubkey;
5055 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
5056 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
5057 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5059 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
5061 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5062 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5064 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5065 LDKWatchedOutput output_var = output;
5066 CHECK((((long)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5067 CHECK((((long)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5068 long output_ref = (long)output_var.inner;
5069 if (output_var.is_owned) {
5072 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5074 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
5075 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
5076 // Warning: we may need a move here but no clone is available for LDKCOption_C2Tuple_usizeTransactionZZ
5079 static void* LDKFilter_JCalls_clone(const void* this_arg) {
5080 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5081 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5082 return (void*) this_arg;
5084 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
5085 jclass c = (*env)->GetObjectClass(env, o);
5087 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5088 atomic_init(&calls->refcnt, 1);
5089 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5090 calls->o = (*env)->NewWeakGlobalRef(env, o);
5091 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
5092 CHECK(calls->register_tx_meth != NULL);
5093 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
5094 CHECK(calls->register_output_meth != NULL);
5097 .this_arg = (void*) calls,
5098 .register_tx = register_tx_LDKFilter_jcall,
5099 .register_output = register_output_LDKFilter_jcall,
5100 .free = LDKFilter_JCalls_free,
5104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
5105 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5106 *res_ptr = LDKFilter_init(env, clz, o);
5107 return (long)res_ptr;
5109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5110 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5111 unsigned char txid_arr[32];
5112 CHECK((*env)->GetArrayLength(env, txid) == 32);
5113 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
5114 unsigned char (*txid_ref)[32] = &txid_arr;
5115 LDKu8slice script_pubkey_ref;
5116 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
5117 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
5118 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5119 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
5122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
5123 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
5124 LDKWatchedOutput output_conv;
5125 output_conv.inner = (void*)(output & (~1));
5126 output_conv.is_owned = (output & 1) || (output == 0);
5127 // Warning: we need a move here but no clone is available for LDKWatchedOutput
5128 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5129 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5130 long ret_ref = (long)ret_copy;
5134 typedef struct LDKPersist_JCalls {
5135 atomic_size_t refcnt;
5138 jmethodID persist_new_channel_meth;
5139 jmethodID update_persisted_channel_meth;
5140 } LDKPersist_JCalls;
5141 static void LDKPersist_JCalls_free(void* this_arg) {
5142 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5143 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5145 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5146 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5150 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
5151 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5153 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5154 LDKOutPoint id_var = id;
5155 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5156 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5157 long id_ref = (long)id_var.inner;
5158 if (id_var.is_owned) {
5161 LDKChannelMonitor data_var = *data;
5162 data_var = ChannelMonitor_clone(data);
5163 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5164 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5165 long data_ref = (long)data_var.inner;
5166 if (data_var.is_owned) {
5169 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5171 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
5172 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5173 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
5176 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
5177 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5179 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5180 LDKOutPoint id_var = id;
5181 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5182 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5183 long id_ref = (long)id_var.inner;
5184 if (id_var.is_owned) {
5187 LDKChannelMonitorUpdate update_var = *update;
5188 update_var = ChannelMonitorUpdate_clone(update);
5189 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5190 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5191 long update_ref = (long)update_var.inner;
5192 if (update_var.is_owned) {
5195 LDKChannelMonitor data_var = *data;
5196 data_var = ChannelMonitor_clone(data);
5197 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5198 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5199 long data_ref = (long)data_var.inner;
5200 if (data_var.is_owned) {
5203 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5205 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
5206 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
5207 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
5210 static void* LDKPersist_JCalls_clone(const void* this_arg) {
5211 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
5212 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5213 return (void*) this_arg;
5215 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
5216 jclass c = (*env)->GetObjectClass(env, o);
5218 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
5219 atomic_init(&calls->refcnt, 1);
5220 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5221 calls->o = (*env)->NewWeakGlobalRef(env, o);
5222 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
5223 CHECK(calls->persist_new_channel_meth != NULL);
5224 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
5225 CHECK(calls->update_persisted_channel_meth != NULL);
5228 .this_arg = (void*) calls,
5229 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
5230 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
5231 .free = LDKPersist_JCalls_free,
5235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
5236 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
5237 *res_ptr = LDKPersist_init(env, clz, o);
5238 return (long)res_ptr;
5240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t data) {
5241 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5242 LDKOutPoint id_conv;
5243 id_conv.inner = (void*)(id & (~1));
5244 id_conv.is_owned = (id & 1) || (id == 0);
5245 id_conv = OutPoint_clone(&id_conv);
5246 LDKChannelMonitor data_conv;
5247 data_conv.inner = (void*)(data & (~1));
5248 data_conv.is_owned = false;
5249 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5250 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
5251 return (long)ret_conv;
5254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t update, int64_t data) {
5255 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
5256 LDKOutPoint id_conv;
5257 id_conv.inner = (void*)(id & (~1));
5258 id_conv.is_owned = (id & 1) || (id == 0);
5259 id_conv = OutPoint_clone(&id_conv);
5260 LDKChannelMonitorUpdate update_conv;
5261 update_conv.inner = (void*)(update & (~1));
5262 update_conv.is_owned = false;
5263 LDKChannelMonitor data_conv;
5264 data_conv.inner = (void*)(data & (~1));
5265 data_conv.is_owned = false;
5266 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5267 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
5268 return (long)ret_conv;
5271 typedef struct LDKChannelMessageHandler_JCalls {
5272 atomic_size_t refcnt;
5275 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5276 jmethodID handle_open_channel_meth;
5277 jmethodID handle_accept_channel_meth;
5278 jmethodID handle_funding_created_meth;
5279 jmethodID handle_funding_signed_meth;
5280 jmethodID handle_funding_locked_meth;
5281 jmethodID handle_shutdown_meth;
5282 jmethodID handle_closing_signed_meth;
5283 jmethodID handle_update_add_htlc_meth;
5284 jmethodID handle_update_fulfill_htlc_meth;
5285 jmethodID handle_update_fail_htlc_meth;
5286 jmethodID handle_update_fail_malformed_htlc_meth;
5287 jmethodID handle_commitment_signed_meth;
5288 jmethodID handle_revoke_and_ack_meth;
5289 jmethodID handle_update_fee_meth;
5290 jmethodID handle_announcement_signatures_meth;
5291 jmethodID peer_disconnected_meth;
5292 jmethodID peer_connected_meth;
5293 jmethodID handle_channel_reestablish_meth;
5294 jmethodID handle_channel_update_meth;
5295 jmethodID handle_error_meth;
5296 } LDKChannelMessageHandler_JCalls;
5297 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
5298 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5299 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5301 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5302 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5306 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
5307 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5309 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5310 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5311 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5312 LDKInitFeatures their_features_var = their_features;
5313 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5314 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5315 long their_features_ref = (long)their_features_var.inner;
5316 if (their_features_var.is_owned) {
5317 their_features_ref |= 1;
5319 LDKOpenChannel msg_var = *msg;
5320 msg_var = OpenChannel_clone(msg);
5321 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5322 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5323 long msg_ref = (long)msg_var.inner;
5324 if (msg_var.is_owned) {
5327 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5329 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5331 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
5332 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5334 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5335 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5336 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5337 LDKInitFeatures their_features_var = their_features;
5338 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5339 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5340 long their_features_ref = (long)their_features_var.inner;
5341 if (their_features_var.is_owned) {
5342 their_features_ref |= 1;
5344 LDKAcceptChannel msg_var = *msg;
5345 msg_var = AcceptChannel_clone(msg);
5346 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5347 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5348 long msg_ref = (long)msg_var.inner;
5349 if (msg_var.is_owned) {
5352 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5354 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
5356 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
5357 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5359 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5360 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5361 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5362 LDKFundingCreated msg_var = *msg;
5363 msg_var = FundingCreated_clone(msg);
5364 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5365 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5366 long msg_ref = (long)msg_var.inner;
5367 if (msg_var.is_owned) {
5370 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5372 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
5374 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
5375 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5377 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5378 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5379 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5380 LDKFundingSigned msg_var = *msg;
5381 msg_var = FundingSigned_clone(msg);
5382 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5383 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5384 long msg_ref = (long)msg_var.inner;
5385 if (msg_var.is_owned) {
5388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5390 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
5392 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
5393 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5395 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5396 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5397 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5398 LDKFundingLocked msg_var = *msg;
5399 msg_var = FundingLocked_clone(msg);
5400 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5401 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5402 long msg_ref = (long)msg_var.inner;
5403 if (msg_var.is_owned) {
5406 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5408 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
5410 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
5411 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5413 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5414 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5415 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5416 LDKInitFeatures their_features_var = *their_features;
5417 their_features_var = InitFeatures_clone(their_features);
5418 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5419 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5420 long their_features_ref = (long)their_features_var.inner;
5421 if (their_features_var.is_owned) {
5422 their_features_ref |= 1;
5424 LDKShutdown msg_var = *msg;
5425 msg_var = Shutdown_clone(msg);
5426 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5427 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5428 long msg_ref = (long)msg_var.inner;
5429 if (msg_var.is_owned) {
5432 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5434 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
5436 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
5437 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5439 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5440 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5441 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5442 LDKClosingSigned msg_var = *msg;
5443 msg_var = ClosingSigned_clone(msg);
5444 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5445 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5446 long msg_ref = (long)msg_var.inner;
5447 if (msg_var.is_owned) {
5450 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5452 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
5454 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
5455 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5457 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5458 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5459 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5460 LDKUpdateAddHTLC msg_var = *msg;
5461 msg_var = UpdateAddHTLC_clone(msg);
5462 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5463 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5464 long msg_ref = (long)msg_var.inner;
5465 if (msg_var.is_owned) {
5468 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5470 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
5472 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
5473 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5475 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5476 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5477 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5478 LDKUpdateFulfillHTLC msg_var = *msg;
5479 msg_var = UpdateFulfillHTLC_clone(msg);
5480 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5481 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5482 long msg_ref = (long)msg_var.inner;
5483 if (msg_var.is_owned) {
5486 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5488 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
5490 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
5491 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5493 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5494 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5495 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5496 LDKUpdateFailHTLC msg_var = *msg;
5497 msg_var = UpdateFailHTLC_clone(msg);
5498 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5499 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5500 long msg_ref = (long)msg_var.inner;
5501 if (msg_var.is_owned) {
5504 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5506 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
5508 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
5509 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5511 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5512 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5513 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5514 LDKUpdateFailMalformedHTLC msg_var = *msg;
5515 msg_var = UpdateFailMalformedHTLC_clone(msg);
5516 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5517 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5518 long msg_ref = (long)msg_var.inner;
5519 if (msg_var.is_owned) {
5522 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5524 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
5526 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5527 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5529 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5530 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5531 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5532 LDKCommitmentSigned msg_var = *msg;
5533 msg_var = CommitmentSigned_clone(msg);
5534 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5535 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5536 long msg_ref = (long)msg_var.inner;
5537 if (msg_var.is_owned) {
5540 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5542 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5544 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5545 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5547 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5548 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5549 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5550 LDKRevokeAndACK msg_var = *msg;
5551 msg_var = RevokeAndACK_clone(msg);
5552 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5553 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5554 long msg_ref = (long)msg_var.inner;
5555 if (msg_var.is_owned) {
5558 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5560 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
5562 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
5563 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5565 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5566 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5567 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5568 LDKUpdateFee msg_var = *msg;
5569 msg_var = UpdateFee_clone(msg);
5570 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5571 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5572 long msg_ref = (long)msg_var.inner;
5573 if (msg_var.is_owned) {
5576 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5578 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
5580 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
5581 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5583 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5584 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5585 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5586 LDKAnnouncementSignatures msg_var = *msg;
5587 msg_var = AnnouncementSignatures_clone(msg);
5588 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5589 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5590 long msg_ref = (long)msg_var.inner;
5591 if (msg_var.is_owned) {
5594 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5596 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
5598 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
5599 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5601 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5602 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5603 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5604 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5606 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
5608 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
5609 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5611 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5612 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5613 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5614 LDKInit msg_var = *msg;
5615 msg_var = Init_clone(msg);
5616 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5617 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5618 long msg_ref = (long)msg_var.inner;
5619 if (msg_var.is_owned) {
5622 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5624 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
5626 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
5627 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5629 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5630 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5631 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5632 LDKChannelReestablish msg_var = *msg;
5633 msg_var = ChannelReestablish_clone(msg);
5634 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5635 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5636 long msg_ref = (long)msg_var.inner;
5637 if (msg_var.is_owned) {
5640 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5642 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
5644 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
5645 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5647 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5648 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5649 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5650 LDKChannelUpdate msg_var = *msg;
5651 msg_var = ChannelUpdate_clone(msg);
5652 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5653 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5654 long msg_ref = (long)msg_var.inner;
5655 if (msg_var.is_owned) {
5658 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5660 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
5662 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
5663 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5665 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5666 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5667 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5668 LDKErrorMessage msg_var = *msg;
5669 msg_var = ErrorMessage_clone(msg);
5670 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5671 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5672 long msg_ref = (long)msg_var.inner;
5673 if (msg_var.is_owned) {
5676 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5678 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
5680 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
5681 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5682 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5683 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5684 return (void*) this_arg;
5686 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5687 jclass c = (*env)->GetObjectClass(env, o);
5689 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
5690 atomic_init(&calls->refcnt, 1);
5691 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5692 calls->o = (*env)->NewWeakGlobalRef(env, o);
5693 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
5694 CHECK(calls->handle_open_channel_meth != NULL);
5695 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
5696 CHECK(calls->handle_accept_channel_meth != NULL);
5697 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
5698 CHECK(calls->handle_funding_created_meth != NULL);
5699 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
5700 CHECK(calls->handle_funding_signed_meth != NULL);
5701 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
5702 CHECK(calls->handle_funding_locked_meth != NULL);
5703 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
5704 CHECK(calls->handle_shutdown_meth != NULL);
5705 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
5706 CHECK(calls->handle_closing_signed_meth != NULL);
5707 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
5708 CHECK(calls->handle_update_add_htlc_meth != NULL);
5709 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
5710 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
5711 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
5712 CHECK(calls->handle_update_fail_htlc_meth != NULL);
5713 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
5714 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
5715 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
5716 CHECK(calls->handle_commitment_signed_meth != NULL);
5717 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
5718 CHECK(calls->handle_revoke_and_ack_meth != NULL);
5719 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
5720 CHECK(calls->handle_update_fee_meth != NULL);
5721 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
5722 CHECK(calls->handle_announcement_signatures_meth != NULL);
5723 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
5724 CHECK(calls->peer_disconnected_meth != NULL);
5725 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
5726 CHECK(calls->peer_connected_meth != NULL);
5727 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
5728 CHECK(calls->handle_channel_reestablish_meth != NULL);
5729 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
5730 CHECK(calls->handle_channel_update_meth != NULL);
5731 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
5732 CHECK(calls->handle_error_meth != NULL);
5734 LDKChannelMessageHandler ret = {
5735 .this_arg = (void*) calls,
5736 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
5737 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
5738 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
5739 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
5740 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
5741 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
5742 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
5743 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
5744 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
5745 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
5746 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
5747 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
5748 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
5749 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
5750 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
5751 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
5752 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
5753 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
5754 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
5755 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
5756 .free = LDKChannelMessageHandler_JCalls_free,
5757 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5759 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5763 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5764 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5765 return (long)res_ptr;
5767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
5768 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5769 LDKPublicKey their_node_id_ref;
5770 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5771 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5772 LDKInitFeatures their_features_conv;
5773 their_features_conv.inner = (void*)(their_features & (~1));
5774 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5775 their_features_conv = InitFeatures_clone(&their_features_conv);
5776 LDKOpenChannel msg_conv;
5777 msg_conv.inner = (void*)(msg & (~1));
5778 msg_conv.is_owned = false;
5779 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
5783 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5784 LDKPublicKey their_node_id_ref;
5785 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5786 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5787 LDKInitFeatures their_features_conv;
5788 their_features_conv.inner = (void*)(their_features & (~1));
5789 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5790 their_features_conv = InitFeatures_clone(&their_features_conv);
5791 LDKAcceptChannel msg_conv;
5792 msg_conv.inner = (void*)(msg & (~1));
5793 msg_conv.is_owned = false;
5794 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5798 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5799 LDKPublicKey their_node_id_ref;
5800 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5801 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5802 LDKFundingCreated msg_conv;
5803 msg_conv.inner = (void*)(msg & (~1));
5804 msg_conv.is_owned = false;
5805 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5809 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5810 LDKPublicKey their_node_id_ref;
5811 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5812 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5813 LDKFundingSigned msg_conv;
5814 msg_conv.inner = (void*)(msg & (~1));
5815 msg_conv.is_owned = false;
5816 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5820 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5821 LDKPublicKey their_node_id_ref;
5822 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5823 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5824 LDKFundingLocked msg_conv;
5825 msg_conv.inner = (void*)(msg & (~1));
5826 msg_conv.is_owned = false;
5827 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
5831 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5832 LDKPublicKey their_node_id_ref;
5833 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5834 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5835 LDKInitFeatures their_features_conv;
5836 their_features_conv.inner = (void*)(their_features & (~1));
5837 their_features_conv.is_owned = false;
5838 LDKShutdown msg_conv;
5839 msg_conv.inner = (void*)(msg & (~1));
5840 msg_conv.is_owned = false;
5841 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
5844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5845 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5846 LDKPublicKey their_node_id_ref;
5847 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5848 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5849 LDKClosingSigned msg_conv;
5850 msg_conv.inner = (void*)(msg & (~1));
5851 msg_conv.is_owned = false;
5852 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1add_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5856 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5857 LDKPublicKey their_node_id_ref;
5858 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5859 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5860 LDKUpdateAddHTLC msg_conv;
5861 msg_conv.inner = (void*)(msg & (~1));
5862 msg_conv.is_owned = false;
5863 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fulfill_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5867 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5868 LDKPublicKey their_node_id_ref;
5869 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5870 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5871 LDKUpdateFulfillHTLC msg_conv;
5872 msg_conv.inner = (void*)(msg & (~1));
5873 msg_conv.is_owned = false;
5874 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5878 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5879 LDKPublicKey their_node_id_ref;
5880 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5881 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5882 LDKUpdateFailHTLC msg_conv;
5883 msg_conv.inner = (void*)(msg & (~1));
5884 msg_conv.is_owned = false;
5885 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5889 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5890 LDKPublicKey their_node_id_ref;
5891 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5892 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5893 LDKUpdateFailMalformedHTLC msg_conv;
5894 msg_conv.inner = (void*)(msg & (~1));
5895 msg_conv.is_owned = false;
5896 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5900 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5901 LDKPublicKey their_node_id_ref;
5902 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5903 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5904 LDKCommitmentSigned msg_conv;
5905 msg_conv.inner = (void*)(msg & (~1));
5906 msg_conv.is_owned = false;
5907 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1revoke_1and_1ack(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5911 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5912 LDKPublicKey their_node_id_ref;
5913 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5914 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5915 LDKRevokeAndACK msg_conv;
5916 msg_conv.inner = (void*)(msg & (~1));
5917 msg_conv.is_owned = false;
5918 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fee(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5922 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5923 LDKPublicKey their_node_id_ref;
5924 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5925 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5926 LDKUpdateFee msg_conv;
5927 msg_conv.inner = (void*)(msg & (~1));
5928 msg_conv.is_owned = false;
5929 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1announcement_1signatures(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5933 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5934 LDKPublicKey their_node_id_ref;
5935 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5936 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5937 LDKAnnouncementSignatures msg_conv;
5938 msg_conv.inner = (void*)(msg & (~1));
5939 msg_conv.is_owned = false;
5940 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
5944 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5945 LDKPublicKey their_node_id_ref;
5946 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5947 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5948 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5952 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5953 LDKPublicKey their_node_id_ref;
5954 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5955 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5957 msg_conv.inner = (void*)(msg & (~1));
5958 msg_conv.is_owned = false;
5959 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1reestablish(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5963 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5964 LDKPublicKey their_node_id_ref;
5965 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5966 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5967 LDKChannelReestablish msg_conv;
5968 msg_conv.inner = (void*)(msg & (~1));
5969 msg_conv.is_owned = false;
5970 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5974 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5975 LDKPublicKey their_node_id_ref;
5976 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5977 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5978 LDKChannelUpdate msg_conv;
5979 msg_conv.inner = (void*)(msg & (~1));
5980 msg_conv.is_owned = false;
5981 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5985 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
5986 LDKPublicKey their_node_id_ref;
5987 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5988 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5989 LDKErrorMessage msg_conv;
5990 msg_conv.inner = (void*)(msg & (~1));
5991 msg_conv.is_owned = false;
5992 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5995 typedef struct LDKRoutingMessageHandler_JCalls {
5996 atomic_size_t refcnt;
5999 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6000 jmethodID handle_node_announcement_meth;
6001 jmethodID handle_channel_announcement_meth;
6002 jmethodID handle_channel_update_meth;
6003 jmethodID handle_htlc_fail_channel_update_meth;
6004 jmethodID get_next_channel_announcements_meth;
6005 jmethodID get_next_node_announcements_meth;
6006 jmethodID sync_routing_table_meth;
6007 jmethodID handle_reply_channel_range_meth;
6008 jmethodID handle_reply_short_channel_ids_end_meth;
6009 jmethodID handle_query_channel_range_meth;
6010 jmethodID handle_query_short_channel_ids_meth;
6011 } LDKRoutingMessageHandler_JCalls;
6012 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
6013 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6014 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6016 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6017 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6021 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
6022 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6024 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6025 LDKNodeAnnouncement msg_var = *msg;
6026 msg_var = NodeAnnouncement_clone(msg);
6027 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6028 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6029 long msg_ref = (long)msg_var.inner;
6030 if (msg_var.is_owned) {
6033 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6035 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
6036 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6037 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
6040 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
6041 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6043 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6044 LDKChannelAnnouncement msg_var = *msg;
6045 msg_var = ChannelAnnouncement_clone(msg);
6046 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6047 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6048 long msg_ref = (long)msg_var.inner;
6049 if (msg_var.is_owned) {
6052 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6054 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
6055 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6056 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
6059 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
6060 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6062 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6063 LDKChannelUpdate msg_var = *msg;
6064 msg_var = ChannelUpdate_clone(msg);
6065 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6066 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6067 long msg_ref = (long)msg_var.inner;
6068 if (msg_var.is_owned) {
6071 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6073 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
6074 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
6075 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
6078 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
6079 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6081 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6082 long ret_update = (long)update;
6083 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6085 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
6087 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
6088 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6090 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6091 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6093 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
6094 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
6095 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6096 if (ret_constr.datalen > 0)
6097 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6099 ret_constr.data = NULL;
6100 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6101 for (size_t l = 0; l < ret_constr.datalen; l++) {
6102 int64_t ret_conv_63 = ret_vals[l];
6103 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
6104 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63);
6105 ret_constr.data[l] = ret_conv_63_conv;
6107 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6110 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
6111 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6113 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6114 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
6115 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
6116 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6118 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
6119 LDKCVec_NodeAnnouncementZ ret_constr;
6120 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6121 if (ret_constr.datalen > 0)
6122 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6124 ret_constr.data = NULL;
6125 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6126 for (size_t s = 0; s < ret_constr.datalen; s++) {
6127 int64_t ret_conv_18 = ret_vals[s];
6128 LDKNodeAnnouncement ret_conv_18_conv;
6129 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
6130 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
6131 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
6132 ret_constr.data[s] = ret_conv_18_conv;
6134 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6137 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
6138 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6140 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6141 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6142 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6143 LDKInit init_var = *init;
6144 init_var = Init_clone(init);
6145 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6146 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6147 long init_ref = (long)init_var.inner;
6148 if (init_var.is_owned) {
6151 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6153 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
6155 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
6156 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6158 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6159 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6160 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6161 LDKReplyChannelRange msg_var = msg;
6162 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6163 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6164 long msg_ref = (long)msg_var.inner;
6165 if (msg_var.is_owned) {
6168 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6170 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
6171 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6172 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6175 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
6176 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6178 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6179 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6180 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6181 LDKReplyShortChannelIdsEnd msg_var = msg;
6182 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6183 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6184 long msg_ref = (long)msg_var.inner;
6185 if (msg_var.is_owned) {
6188 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6190 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
6191 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6192 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6195 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
6196 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6198 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6199 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6200 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6201 LDKQueryChannelRange msg_var = msg;
6202 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6203 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6204 long msg_ref = (long)msg_var.inner;
6205 if (msg_var.is_owned) {
6208 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6210 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
6211 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6212 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6215 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
6216 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6218 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6219 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6220 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6221 LDKQueryShortChannelIds msg_var = msg;
6222 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6223 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6224 long msg_ref = (long)msg_var.inner;
6225 if (msg_var.is_owned) {
6228 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6230 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
6231 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
6232 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
6235 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
6236 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
6237 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6238 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
6239 return (void*) this_arg;
6241 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
6242 jclass c = (*env)->GetObjectClass(env, o);
6244 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
6245 atomic_init(&calls->refcnt, 1);
6246 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6247 calls->o = (*env)->NewWeakGlobalRef(env, o);
6248 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
6249 CHECK(calls->handle_node_announcement_meth != NULL);
6250 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
6251 CHECK(calls->handle_channel_announcement_meth != NULL);
6252 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
6253 CHECK(calls->handle_channel_update_meth != NULL);
6254 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
6255 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
6256 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
6257 CHECK(calls->get_next_channel_announcements_meth != NULL);
6258 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
6259 CHECK(calls->get_next_node_announcements_meth != NULL);
6260 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
6261 CHECK(calls->sync_routing_table_meth != NULL);
6262 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
6263 CHECK(calls->handle_reply_channel_range_meth != NULL);
6264 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
6265 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
6266 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
6267 CHECK(calls->handle_query_channel_range_meth != NULL);
6268 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
6269 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
6271 LDKRoutingMessageHandler ret = {
6272 .this_arg = (void*) calls,
6273 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
6274 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
6275 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
6276 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
6277 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
6278 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
6279 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
6280 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
6281 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
6282 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
6283 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
6284 .free = LDKRoutingMessageHandler_JCalls_free,
6285 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
6287 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
6290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
6291 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6292 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
6293 return (long)res_ptr;
6295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6296 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6297 LDKNodeAnnouncement msg_conv;
6298 msg_conv.inner = (void*)(msg & (~1));
6299 msg_conv.is_owned = false;
6300 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6301 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
6302 return (long)ret_conv;
6305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6306 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6307 LDKChannelAnnouncement msg_conv;
6308 msg_conv.inner = (void*)(msg & (~1));
6309 msg_conv.is_owned = false;
6310 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6311 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
6312 return (long)ret_conv;
6315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
6316 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6317 LDKChannelUpdate msg_conv;
6318 msg_conv.inner = (void*)(msg & (~1));
6319 msg_conv.is_owned = false;
6320 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6321 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
6322 return (long)ret_conv;
6325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
6326 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6327 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
6328 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
6331 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
6332 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6333 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
6334 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6335 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6336 for (size_t l = 0; l < ret_var.datalen; l++) {
6337 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6338 *ret_conv_63_ref = ret_var.data[l];
6339 ret_arr_ptr[l] = (long)ret_conv_63_ref;
6341 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6346 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
6347 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6348 LDKPublicKey starting_point_ref;
6349 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
6350 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
6351 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
6352 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6353 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6354 for (size_t s = 0; s < ret_var.datalen; s++) {
6355 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
6356 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6357 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6358 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
6359 if (ret_conv_18_var.is_owned) {
6360 ret_conv_18_ref |= 1;
6362 ret_arr_ptr[s] = ret_conv_18_ref;
6364 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
6370 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6371 LDKPublicKey their_node_id_ref;
6372 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6373 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6375 init_conv.inner = (void*)(init & (~1));
6376 init_conv.is_owned = false;
6377 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
6380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
6381 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6382 LDKPublicKey their_node_id_ref;
6383 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6384 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6385 LDKReplyChannelRange msg_conv;
6386 msg_conv.inner = (void*)(msg & (~1));
6387 msg_conv.is_owned = (msg & 1) || (msg == 0);
6388 msg_conv = ReplyChannelRange_clone(&msg_conv);
6389 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6390 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6391 return (long)ret_conv;
6394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
6395 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6396 LDKPublicKey their_node_id_ref;
6397 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6398 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6399 LDKReplyShortChannelIdsEnd msg_conv;
6400 msg_conv.inner = (void*)(msg & (~1));
6401 msg_conv.is_owned = (msg & 1) || (msg == 0);
6402 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
6403 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6404 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6405 return (long)ret_conv;
6408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
6409 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6410 LDKPublicKey their_node_id_ref;
6411 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6412 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6413 LDKQueryChannelRange msg_conv;
6414 msg_conv.inner = (void*)(msg & (~1));
6415 msg_conv.is_owned = (msg & 1) || (msg == 0);
6416 msg_conv = QueryChannelRange_clone(&msg_conv);
6417 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6418 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6419 return (long)ret_conv;
6422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
6423 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
6424 LDKPublicKey their_node_id_ref;
6425 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
6426 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
6427 LDKQueryShortChannelIds msg_conv;
6428 msg_conv.inner = (void*)(msg & (~1));
6429 msg_conv.is_owned = (msg & 1) || (msg == 0);
6430 msg_conv = QueryShortChannelIds_clone(&msg_conv);
6431 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6432 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
6433 return (long)ret_conv;
6436 typedef struct LDKSocketDescriptor_JCalls {
6437 atomic_size_t refcnt;
6440 jmethodID send_data_meth;
6441 jmethodID disconnect_socket_meth;
6443 jmethodID hash_meth;
6444 } LDKSocketDescriptor_JCalls;
6445 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
6446 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6447 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6449 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6450 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6454 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
6455 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6457 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6458 LDKu8slice data_var = data;
6459 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
6460 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
6461 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6463 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
6465 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
6466 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6468 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6469 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6471 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
6473 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
6474 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6476 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6477 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6478 *other_arg_clone = SocketDescriptor_clone(other_arg);
6479 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6481 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
6483 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
6484 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6486 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
6487 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6489 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
6491 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
6492 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
6493 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6494 return (void*) this_arg;
6496 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
6497 jclass c = (*env)->GetObjectClass(env, o);
6499 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
6500 atomic_init(&calls->refcnt, 1);
6501 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6502 calls->o = (*env)->NewWeakGlobalRef(env, o);
6503 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
6504 CHECK(calls->send_data_meth != NULL);
6505 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
6506 CHECK(calls->disconnect_socket_meth != NULL);
6507 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
6508 CHECK(calls->eq_meth != NULL);
6509 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
6510 CHECK(calls->hash_meth != NULL);
6512 LDKSocketDescriptor ret = {
6513 .this_arg = (void*) calls,
6514 .send_data = send_data_LDKSocketDescriptor_jcall,
6515 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
6516 .eq = eq_LDKSocketDescriptor_jcall,
6517 .hash = hash_LDKSocketDescriptor_jcall,
6518 .clone = LDKSocketDescriptor_JCalls_clone,
6519 .free = LDKSocketDescriptor_JCalls_free,
6523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
6524 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
6525 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
6526 return (long)res_ptr;
6528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
6529 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6530 LDKu8slice data_ref;
6531 data_ref.datalen = (*env)->GetArrayLength(env, data);
6532 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
6533 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
6534 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
6538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
6539 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6540 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
6543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
6544 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
6545 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
6549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6550 LDKTransaction _res_ref;
6551 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6552 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
6553 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6554 _res_ref.data_is_owned = true;
6555 Transaction_free(_res_ref);
6558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
6559 if ((_res & 1) != 0) return;
6560 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
6562 TxOut_free(_res_conv);
6565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6566 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
6567 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6568 *ret_ref = TxOut_clone(orig_conv);
6569 return (long)ret_ref;
6572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6574 CHECK((*env)->GetArrayLength(env, o) == 32);
6575 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
6576 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6577 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
6578 return (long)ret_conv;
6581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6582 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6583 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6584 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
6585 return (long)ret_conv;
6588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6589 if ((_res & 1) != 0) return;
6590 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
6592 CResult_SecretKeyErrorZ_free(_res_conv);
6595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6597 CHECK((*env)->GetArrayLength(env, o) == 33);
6598 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
6599 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6600 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
6601 return (long)ret_conv;
6604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6605 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6606 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6607 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
6608 return (long)ret_conv;
6611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6612 if ((_res & 1) != 0) return;
6613 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
6615 CResult_PublicKeyErrorZ_free(_res_conv);
6618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6619 LDKTxCreationKeys o_conv;
6620 o_conv.inner = (void*)(o & (~1));
6621 o_conv.is_owned = (o & 1) || (o == 0);
6622 o_conv = TxCreationKeys_clone(&o_conv);
6623 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6624 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
6625 return (long)ret_conv;
6628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6629 LDKDecodeError e_conv;
6630 e_conv.inner = (void*)(e & (~1));
6631 e_conv.is_owned = (e & 1) || (e == 0);
6632 e_conv = DecodeError_clone(&e_conv);
6633 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6634 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
6635 return (long)ret_conv;
6638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6639 if ((_res & 1) != 0) return;
6640 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6642 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
6645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6646 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
6647 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6648 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
6649 return (long)ret_conv;
6652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6653 LDKChannelPublicKeys o_conv;
6654 o_conv.inner = (void*)(o & (~1));
6655 o_conv.is_owned = (o & 1) || (o == 0);
6656 o_conv = ChannelPublicKeys_clone(&o_conv);
6657 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6658 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
6659 return (long)ret_conv;
6662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6663 LDKDecodeError e_conv;
6664 e_conv.inner = (void*)(e & (~1));
6665 e_conv.is_owned = (e & 1) || (e == 0);
6666 e_conv = DecodeError_clone(&e_conv);
6667 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6668 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
6669 return (long)ret_conv;
6672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6673 if ((_res & 1) != 0) return;
6674 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6676 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
6679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6680 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
6681 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6682 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
6683 return (long)ret_conv;
6686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6687 LDKTxCreationKeys o_conv;
6688 o_conv.inner = (void*)(o & (~1));
6689 o_conv.is_owned = (o & 1) || (o == 0);
6690 o_conv = TxCreationKeys_clone(&o_conv);
6691 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6692 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
6693 return (long)ret_conv;
6696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6697 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6698 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6699 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
6700 return (long)ret_conv;
6703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6704 if ((_res & 1) != 0) return;
6705 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
6707 CResult_TxCreationKeysErrorZ_free(_res_conv);
6710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
6711 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6712 *ret_copy = COption_u32Z_some(o);
6713 long ret_ref = (long)ret_copy;
6717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
6718 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6719 *ret_copy = COption_u32Z_none();
6720 long ret_ref = (long)ret_copy;
6724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
6725 if ((_res & 1) != 0) return;
6726 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
6728 COption_u32Z_free(_res_conv);
6731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6732 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
6733 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
6734 *ret_copy = COption_u32Z_clone(orig_conv);
6735 long ret_ref = (long)ret_copy;
6739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6740 LDKHTLCOutputInCommitment o_conv;
6741 o_conv.inner = (void*)(o & (~1));
6742 o_conv.is_owned = (o & 1) || (o == 0);
6743 o_conv = HTLCOutputInCommitment_clone(&o_conv);
6744 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6745 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
6746 return (long)ret_conv;
6749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6750 LDKDecodeError e_conv;
6751 e_conv.inner = (void*)(e & (~1));
6752 e_conv.is_owned = (e & 1) || (e == 0);
6753 e_conv = DecodeError_clone(&e_conv);
6754 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6755 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
6756 return (long)ret_conv;
6759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6760 if ((_res & 1) != 0) return;
6761 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
6763 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
6766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6767 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
6768 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6769 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
6770 return (long)ret_conv;
6773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6774 LDKCounterpartyChannelTransactionParameters o_conv;
6775 o_conv.inner = (void*)(o & (~1));
6776 o_conv.is_owned = (o & 1) || (o == 0);
6777 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
6778 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6779 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6780 return (long)ret_conv;
6783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6784 LDKDecodeError e_conv;
6785 e_conv.inner = (void*)(e & (~1));
6786 e_conv.is_owned = (e & 1) || (e == 0);
6787 e_conv = DecodeError_clone(&e_conv);
6788 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6789 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
6790 return (long)ret_conv;
6793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6794 if ((_res & 1) != 0) return;
6795 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6797 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6801 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6802 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6803 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6804 return (long)ret_conv;
6807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6808 LDKChannelTransactionParameters o_conv;
6809 o_conv.inner = (void*)(o & (~1));
6810 o_conv.is_owned = (o & 1) || (o == 0);
6811 o_conv = ChannelTransactionParameters_clone(&o_conv);
6812 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6813 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6814 return (long)ret_conv;
6817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6818 LDKDecodeError e_conv;
6819 e_conv.inner = (void*)(e & (~1));
6820 e_conv.is_owned = (e & 1) || (e == 0);
6821 e_conv = DecodeError_clone(&e_conv);
6822 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6823 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
6824 return (long)ret_conv;
6827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6828 if ((_res & 1) != 0) return;
6829 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6831 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6835 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6836 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6837 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6838 return (long)ret_conv;
6841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6842 LDKCVec_SignatureZ _res_constr;
6843 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6844 if (_res_constr.datalen > 0)
6845 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6847 _res_constr.data = NULL;
6848 for (size_t i = 0; i < _res_constr.datalen; i++) {
6849 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6850 LDKSignature _res_conv_8_ref;
6851 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
6852 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
6853 _res_constr.data[i] = _res_conv_8_ref;
6855 CVec_SignatureZ_free(_res_constr);
6858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6859 LDKHolderCommitmentTransaction o_conv;
6860 o_conv.inner = (void*)(o & (~1));
6861 o_conv.is_owned = (o & 1) || (o == 0);
6862 o_conv = HolderCommitmentTransaction_clone(&o_conv);
6863 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6864 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
6865 return (long)ret_conv;
6868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6869 LDKDecodeError e_conv;
6870 e_conv.inner = (void*)(e & (~1));
6871 e_conv.is_owned = (e & 1) || (e == 0);
6872 e_conv = DecodeError_clone(&e_conv);
6873 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6874 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
6875 return (long)ret_conv;
6878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6879 if ((_res & 1) != 0) return;
6880 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6882 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
6885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6886 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6887 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6888 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6889 return (long)ret_conv;
6892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6893 LDKBuiltCommitmentTransaction o_conv;
6894 o_conv.inner = (void*)(o & (~1));
6895 o_conv.is_owned = (o & 1) || (o == 0);
6896 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
6897 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6898 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
6899 return (long)ret_conv;
6902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6903 LDKDecodeError e_conv;
6904 e_conv.inner = (void*)(e & (~1));
6905 e_conv.is_owned = (e & 1) || (e == 0);
6906 e_conv = DecodeError_clone(&e_conv);
6907 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6908 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
6909 return (long)ret_conv;
6912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6913 if ((_res & 1) != 0) return;
6914 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6916 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
6919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6920 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6921 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6922 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6923 return (long)ret_conv;
6926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6927 LDKCommitmentTransaction o_conv;
6928 o_conv.inner = (void*)(o & (~1));
6929 o_conv.is_owned = (o & 1) || (o == 0);
6930 o_conv = CommitmentTransaction_clone(&o_conv);
6931 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6932 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6933 return (long)ret_conv;
6936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6937 LDKDecodeError e_conv;
6938 e_conv.inner = (void*)(e & (~1));
6939 e_conv.is_owned = (e & 1) || (e == 0);
6940 e_conv = DecodeError_clone(&e_conv);
6941 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6942 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6943 return (long)ret_conv;
6946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6947 if ((_res & 1) != 0) return;
6948 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6950 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6954 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6955 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6956 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6957 return (long)ret_conv;
6960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6961 LDKTrustedCommitmentTransaction o_conv;
6962 o_conv.inner = (void*)(o & (~1));
6963 o_conv.is_owned = (o & 1) || (o == 0);
6964 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6965 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6966 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6967 return (long)ret_conv;
6970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
6971 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6972 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6973 return (long)ret_conv;
6976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6977 if ((_res & 1) != 0) return;
6978 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6980 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
6984 LDKCVec_SignatureZ o_constr;
6985 o_constr.datalen = (*env)->GetArrayLength(env, o);
6986 if (o_constr.datalen > 0)
6987 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6989 o_constr.data = NULL;
6990 for (size_t i = 0; i < o_constr.datalen; i++) {
6991 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
6992 LDKSignature o_conv_8_ref;
6993 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
6994 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
6995 o_constr.data[i] = o_conv_8_ref;
6997 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6998 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6999 return (long)ret_conv;
7002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
7003 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7004 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
7005 return (long)ret_conv;
7008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7009 if ((_res & 1) != 0) return;
7010 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
7012 CResult_CVec_SignatureZNoneZ_free(_res_conv);
7015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7016 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
7017 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7018 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
7019 return (long)ret_conv;
7022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7023 LDKCVec_MessageSendEventZ _res_constr;
7024 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7025 if (_res_constr.datalen > 0)
7026 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7028 _res_constr.data = NULL;
7029 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7030 for (size_t s = 0; s < _res_constr.datalen; s++) {
7031 int64_t _res_conv_18 = _res_vals[s];
7032 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
7033 FREE((void*)_res_conv_18);
7034 _res_constr.data[s] = _res_conv_18_conv;
7036 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7037 CVec_MessageSendEventZ_free(_res_constr);
7040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
7041 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7042 *ret_conv = CResult_boolLightningErrorZ_ok(o);
7043 return (long)ret_conv;
7046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7047 LDKLightningError e_conv;
7048 e_conv.inner = (void*)(e & (~1));
7049 e_conv.is_owned = (e & 1) || (e == 0);
7050 e_conv = LightningError_clone(&e_conv);
7051 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7052 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
7053 return (long)ret_conv;
7056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7057 if ((_res & 1) != 0) return;
7058 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
7060 CResult_boolLightningErrorZ_free(_res_conv);
7063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7064 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
7065 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7066 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
7067 return (long)ret_conv;
7070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7071 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
7072 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
7073 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
7074 return (long)ret_ref;
7077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
7078 LDKChannelAnnouncement a_conv;
7079 a_conv.inner = (void*)(a & (~1));
7080 a_conv.is_owned = (a & 1) || (a == 0);
7081 a_conv = ChannelAnnouncement_clone(&a_conv);
7082 LDKChannelUpdate b_conv;
7083 b_conv.inner = (void*)(b & (~1));
7084 b_conv.is_owned = (b & 1) || (b == 0);
7085 b_conv = ChannelUpdate_clone(&b_conv);
7086 LDKChannelUpdate c_conv;
7087 c_conv.inner = (void*)(c & (~1));
7088 c_conv.is_owned = (c & 1) || (c == 0);
7089 c_conv = ChannelUpdate_clone(&c_conv);
7090 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
7091 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
7092 return (long)ret_ref;
7095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7096 if ((_res & 1) != 0) return;
7097 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
7099 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
7102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7103 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
7104 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7105 if (_res_constr.datalen > 0)
7106 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
7108 _res_constr.data = NULL;
7109 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7110 for (size_t l = 0; l < _res_constr.datalen; l++) {
7111 int64_t _res_conv_63 = _res_vals[l];
7112 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
7113 FREE((void*)_res_conv_63);
7114 _res_constr.data[l] = _res_conv_63_conv;
7116 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7117 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
7120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7121 LDKCVec_NodeAnnouncementZ _res_constr;
7122 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7123 if (_res_constr.datalen > 0)
7124 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
7126 _res_constr.data = NULL;
7127 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7128 for (size_t s = 0; s < _res_constr.datalen; s++) {
7129 int64_t _res_conv_18 = _res_vals[s];
7130 LDKNodeAnnouncement _res_conv_18_conv;
7131 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
7132 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
7133 _res_constr.data[s] = _res_conv_18_conv;
7135 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7136 CVec_NodeAnnouncementZ_free(_res_constr);
7139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
7140 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7141 *ret_conv = CResult_NoneLightningErrorZ_ok();
7142 return (long)ret_conv;
7145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7146 LDKLightningError e_conv;
7147 e_conv.inner = (void*)(e & (~1));
7148 e_conv.is_owned = (e & 1) || (e == 0);
7149 e_conv = LightningError_clone(&e_conv);
7150 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7151 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
7152 return (long)ret_conv;
7155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7156 if ((_res & 1) != 0) return;
7157 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
7159 CResult_NoneLightningErrorZ_free(_res_conv);
7162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7163 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
7164 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
7165 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
7166 return (long)ret_conv;
7169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7170 LDKCVec_PublicKeyZ _res_constr;
7171 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7172 if (_res_constr.datalen > 0)
7173 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7175 _res_constr.data = NULL;
7176 for (size_t i = 0; i < _res_constr.datalen; i++) {
7177 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
7178 LDKPublicKey _res_conv_8_ref;
7179 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
7180 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
7181 _res_constr.data[i] = _res_conv_8_ref;
7183 CVec_PublicKeyZ_free(_res_constr);
7186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
7187 LDKCVec_u8Z _res_ref;
7188 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
7189 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
7190 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
7191 CVec_u8Z_free(_res_ref);
7194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
7196 o_ref.datalen = (*env)->GetArrayLength(env, o);
7197 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
7198 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
7199 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7200 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
7201 return (long)ret_conv;
7204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7205 LDKPeerHandleError e_conv;
7206 e_conv.inner = (void*)(e & (~1));
7207 e_conv.is_owned = (e & 1) || (e == 0);
7208 e_conv = PeerHandleError_clone(&e_conv);
7209 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7210 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
7211 return (long)ret_conv;
7214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7215 if ((_res & 1) != 0) return;
7216 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7218 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
7221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7222 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
7223 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7224 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
7225 return (long)ret_conv;
7228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
7229 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7230 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
7231 return (long)ret_conv;
7234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7235 LDKPeerHandleError e_conv;
7236 e_conv.inner = (void*)(e & (~1));
7237 e_conv.is_owned = (e & 1) || (e == 0);
7238 e_conv = PeerHandleError_clone(&e_conv);
7239 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7240 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
7241 return (long)ret_conv;
7244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7245 if ((_res & 1) != 0) return;
7246 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7248 CResult_NonePeerHandleErrorZ_free(_res_conv);
7251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7252 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
7253 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7254 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
7255 return (long)ret_conv;
7258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
7259 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7260 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
7261 return (long)ret_conv;
7264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7265 LDKPeerHandleError e_conv;
7266 e_conv.inner = (void*)(e & (~1));
7267 e_conv.is_owned = (e & 1) || (e == 0);
7268 e_conv = PeerHandleError_clone(&e_conv);
7269 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7270 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
7271 return (long)ret_conv;
7274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7275 if ((_res & 1) != 0) return;
7276 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
7278 CResult_boolPeerHandleErrorZ_free(_res_conv);
7281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7282 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
7283 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7284 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
7285 return (long)ret_conv;
7288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7289 LDKInitFeatures o_conv;
7290 o_conv.inner = (void*)(o & (~1));
7291 o_conv.is_owned = (o & 1) || (o == 0);
7292 o_conv = InitFeatures_clone(&o_conv);
7293 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7294 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
7295 return (long)ret_conv;
7298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7299 LDKDecodeError e_conv;
7300 e_conv.inner = (void*)(e & (~1));
7301 e_conv.is_owned = (e & 1) || (e == 0);
7302 e_conv = DecodeError_clone(&e_conv);
7303 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
7304 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
7305 return (long)ret_conv;
7308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7309 if ((_res & 1) != 0) return;
7310 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7312 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
7315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7316 LDKNodeFeatures o_conv;
7317 o_conv.inner = (void*)(o & (~1));
7318 o_conv.is_owned = (o & 1) || (o == 0);
7319 o_conv = NodeFeatures_clone(&o_conv);
7320 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7321 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
7322 return (long)ret_conv;
7325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7326 LDKDecodeError e_conv;
7327 e_conv.inner = (void*)(e & (~1));
7328 e_conv.is_owned = (e & 1) || (e == 0);
7329 e_conv = DecodeError_clone(&e_conv);
7330 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
7331 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
7332 return (long)ret_conv;
7335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7336 if ((_res & 1) != 0) return;
7337 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7339 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
7342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7343 LDKChannelFeatures o_conv;
7344 o_conv.inner = (void*)(o & (~1));
7345 o_conv.is_owned = (o & 1) || (o == 0);
7346 o_conv = ChannelFeatures_clone(&o_conv);
7347 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7348 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
7349 return (long)ret_conv;
7352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7353 LDKDecodeError e_conv;
7354 e_conv.inner = (void*)(e & (~1));
7355 e_conv.is_owned = (e & 1) || (e == 0);
7356 e_conv = DecodeError_clone(&e_conv);
7357 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
7358 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
7359 return (long)ret_conv;
7362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7363 if ((_res & 1) != 0) return;
7364 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7366 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
7369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7370 LDKInvoiceFeatures o_conv;
7371 o_conv.inner = (void*)(o & (~1));
7372 o_conv.is_owned = (o & 1) || (o == 0);
7373 o_conv = InvoiceFeatures_clone(&o_conv);
7374 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7375 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
7376 return (long)ret_conv;
7379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7380 LDKDecodeError e_conv;
7381 e_conv.inner = (void*)(e & (~1));
7382 e_conv.is_owned = (e & 1) || (e == 0);
7383 e_conv = DecodeError_clone(&e_conv);
7384 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
7385 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
7386 return (long)ret_conv;
7389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7390 if ((_res & 1) != 0) return;
7391 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7393 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
7396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7397 LDKChannelConfig o_conv;
7398 o_conv.inner = (void*)(o & (~1));
7399 o_conv.is_owned = (o & 1) || (o == 0);
7400 o_conv = ChannelConfig_clone(&o_conv);
7401 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7402 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
7403 return (long)ret_conv;
7406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7407 LDKDecodeError e_conv;
7408 e_conv.inner = (void*)(e & (~1));
7409 e_conv.is_owned = (e & 1) || (e == 0);
7410 e_conv = DecodeError_clone(&e_conv);
7411 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7412 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
7413 return (long)ret_conv;
7416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7417 if ((_res & 1) != 0) return;
7418 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
7420 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
7423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7424 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
7425 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
7426 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
7427 return (long)ret_conv;
7430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
7431 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7432 *ret_copy = COption_u64Z_some(o);
7433 long ret_ref = (long)ret_copy;
7437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
7438 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7439 *ret_copy = COption_u64Z_none();
7440 long ret_ref = (long)ret_copy;
7444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
7445 if ((_res & 1) != 0) return;
7446 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
7448 COption_u64Z_free(_res_conv);
7451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7452 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
7453 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
7454 *ret_copy = COption_u64Z_clone(orig_conv);
7455 long ret_ref = (long)ret_copy;
7459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7460 LDKDirectionalChannelInfo o_conv;
7461 o_conv.inner = (void*)(o & (~1));
7462 o_conv.is_owned = (o & 1) || (o == 0);
7463 o_conv = DirectionalChannelInfo_clone(&o_conv);
7464 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7465 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
7466 return (long)ret_conv;
7469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7470 LDKDecodeError e_conv;
7471 e_conv.inner = (void*)(e & (~1));
7472 e_conv.is_owned = (e & 1) || (e == 0);
7473 e_conv = DecodeError_clone(&e_conv);
7474 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7475 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
7476 return (long)ret_conv;
7479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7480 if ((_res & 1) != 0) return;
7481 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7483 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
7486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7487 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
7488 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
7489 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
7490 return (long)ret_conv;
7493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7494 LDKChannelInfo o_conv;
7495 o_conv.inner = (void*)(o & (~1));
7496 o_conv.is_owned = (o & 1) || (o == 0);
7497 o_conv = ChannelInfo_clone(&o_conv);
7498 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7499 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
7500 return (long)ret_conv;
7503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7504 LDKDecodeError e_conv;
7505 e_conv.inner = (void*)(e & (~1));
7506 e_conv.is_owned = (e & 1) || (e == 0);
7507 e_conv = DecodeError_clone(&e_conv);
7508 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7509 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
7510 return (long)ret_conv;
7513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7514 if ((_res & 1) != 0) return;
7515 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7517 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
7520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7521 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
7522 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
7523 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
7524 return (long)ret_conv;
7527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7528 LDKRoutingFees o_conv;
7529 o_conv.inner = (void*)(o & (~1));
7530 o_conv.is_owned = (o & 1) || (o == 0);
7531 o_conv = RoutingFees_clone(&o_conv);
7532 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7533 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7534 return (long)ret_conv;
7537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7538 LDKDecodeError e_conv;
7539 e_conv.inner = (void*)(e & (~1));
7540 e_conv.is_owned = (e & 1) || (e == 0);
7541 e_conv = DecodeError_clone(&e_conv);
7542 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7543 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7544 return (long)ret_conv;
7547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7548 if ((_res & 1) != 0) return;
7549 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7551 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7555 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
7556 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7557 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
7558 return (long)ret_conv;
7561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7562 LDKCVec_NetAddressZ _res_constr;
7563 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7564 if (_res_constr.datalen > 0)
7565 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7567 _res_constr.data = NULL;
7568 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7569 for (size_t m = 0; m < _res_constr.datalen; m++) {
7570 int64_t _res_conv_12 = _res_vals[m];
7571 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
7572 FREE((void*)_res_conv_12);
7573 _res_constr.data[m] = _res_conv_12_conv;
7575 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7576 CVec_NetAddressZ_free(_res_constr);
7579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7580 LDKNodeAnnouncementInfo o_conv;
7581 o_conv.inner = (void*)(o & (~1));
7582 o_conv.is_owned = (o & 1) || (o == 0);
7583 o_conv = NodeAnnouncementInfo_clone(&o_conv);
7584 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7585 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7586 return (long)ret_conv;
7589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7590 LDKDecodeError e_conv;
7591 e_conv.inner = (void*)(e & (~1));
7592 e_conv.is_owned = (e & 1) || (e == 0);
7593 e_conv = DecodeError_clone(&e_conv);
7594 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7595 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7596 return (long)ret_conv;
7599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7600 if ((_res & 1) != 0) return;
7601 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7603 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7607 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
7608 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7609 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
7610 return (long)ret_conv;
7613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7614 LDKCVec_u64Z _res_constr;
7615 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7616 if (_res_constr.datalen > 0)
7617 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
7619 _res_constr.data = NULL;
7620 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7621 for (size_t g = 0; g < _res_constr.datalen; g++) {
7622 int64_t _res_conv_6 = _res_vals[g];
7623 _res_constr.data[g] = _res_conv_6;
7625 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7626 CVec_u64Z_free(_res_constr);
7629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7631 o_conv.inner = (void*)(o & (~1));
7632 o_conv.is_owned = (o & 1) || (o == 0);
7633 o_conv = NodeInfo_clone(&o_conv);
7634 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7635 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7636 return (long)ret_conv;
7639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7640 LDKDecodeError e_conv;
7641 e_conv.inner = (void*)(e & (~1));
7642 e_conv.is_owned = (e & 1) || (e == 0);
7643 e_conv = DecodeError_clone(&e_conv);
7644 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7645 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7646 return (long)ret_conv;
7649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7650 if ((_res & 1) != 0) return;
7651 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7653 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7657 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7658 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7659 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7660 return (long)ret_conv;
7663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7664 LDKNetworkGraph o_conv;
7665 o_conv.inner = (void*)(o & (~1));
7666 o_conv.is_owned = (o & 1) || (o == 0);
7667 o_conv = NetworkGraph_clone(&o_conv);
7668 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7669 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7670 return (long)ret_conv;
7673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7674 LDKDecodeError e_conv;
7675 e_conv.inner = (void*)(e & (~1));
7676 e_conv.is_owned = (e & 1) || (e == 0);
7677 e_conv = DecodeError_clone(&e_conv);
7678 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7679 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7680 return (long)ret_conv;
7683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7684 if ((_res & 1) != 0) return;
7685 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7687 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7691 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
7692 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7693 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
7694 return (long)ret_conv;
7697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7698 LDKTransaction b_ref;
7699 b_ref.datalen = (*env)->GetArrayLength(env, b);
7700 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7701 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7702 b_ref.data_is_owned = true;
7703 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7704 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7705 return (long)ret_ref;
7708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7709 if ((_res & 1) != 0) return;
7710 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7712 C2Tuple_usizeTransactionZ_free(_res_conv);
7715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7716 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7717 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7718 if (_res_constr.datalen > 0)
7719 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7721 _res_constr.data = NULL;
7722 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7723 for (size_t y = 0; y < _res_constr.datalen; y++) {
7724 int64_t _res_conv_24 = _res_vals[y];
7725 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
7726 FREE((void*)_res_conv_24);
7727 _res_constr.data[y] = _res_conv_24_conv;
7729 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7730 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
7734 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7735 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7736 return (long)ret_conv;
7739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
7740 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
7741 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7742 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7743 return (long)ret_conv;
7746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7747 if ((_res & 1) != 0) return;
7748 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7750 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7754 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7755 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7756 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7757 return (long)ret_conv;
7760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7761 LDKCVec_MonitorEventZ _res_constr;
7762 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7763 if (_res_constr.datalen > 0)
7764 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
7766 _res_constr.data = NULL;
7767 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7768 for (size_t o = 0; o < _res_constr.datalen; o++) {
7769 int64_t _res_conv_14 = _res_vals[o];
7770 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
7771 FREE((void*)_res_conv_14);
7772 _res_constr.data[o] = _res_conv_14_conv;
7774 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7775 CVec_MonitorEventZ_free(_res_constr);
7778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7779 LDKCVec_EventZ _res_constr;
7780 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7781 if (_res_constr.datalen > 0)
7782 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
7784 _res_constr.data = NULL;
7785 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7786 for (size_t h = 0; h < _res_constr.datalen; h++) {
7787 int64_t _res_conv_7 = _res_vals[h];
7788 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
7789 FREE((void*)_res_conv_7);
7790 _res_constr.data[h] = _res_conv_7_conv;
7792 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7793 CVec_EventZ_free(_res_constr);
7796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7798 o_conv.inner = (void*)(o & (~1));
7799 o_conv.is_owned = (o & 1) || (o == 0);
7800 o_conv = OutPoint_clone(&o_conv);
7801 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7802 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
7803 return (long)ret_conv;
7806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7807 LDKDecodeError e_conv;
7808 e_conv.inner = (void*)(e & (~1));
7809 e_conv.is_owned = (e & 1) || (e == 0);
7810 e_conv = DecodeError_clone(&e_conv);
7811 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7812 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
7813 return (long)ret_conv;
7816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7817 if ((_res & 1) != 0) return;
7818 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
7820 CResult_OutPointDecodeErrorZ_free(_res_conv);
7823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7824 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
7825 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7826 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
7827 return (long)ret_conv;
7830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7831 LDKChannelMonitorUpdate o_conv;
7832 o_conv.inner = (void*)(o & (~1));
7833 o_conv.is_owned = (o & 1) || (o == 0);
7834 o_conv = ChannelMonitorUpdate_clone(&o_conv);
7835 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7836 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
7837 return (long)ret_conv;
7840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7841 LDKDecodeError e_conv;
7842 e_conv.inner = (void*)(e & (~1));
7843 e_conv.is_owned = (e & 1) || (e == 0);
7844 e_conv = DecodeError_clone(&e_conv);
7845 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7846 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
7847 return (long)ret_conv;
7850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7851 if ((_res & 1) != 0) return;
7852 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7854 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
7857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7858 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
7859 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7860 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
7861 return (long)ret_conv;
7864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7865 LDKHTLCUpdate o_conv;
7866 o_conv.inner = (void*)(o & (~1));
7867 o_conv.is_owned = (o & 1) || (o == 0);
7868 o_conv = HTLCUpdate_clone(&o_conv);
7869 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7870 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
7871 return (long)ret_conv;
7874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7875 LDKDecodeError e_conv;
7876 e_conv.inner = (void*)(e & (~1));
7877 e_conv.is_owned = (e & 1) || (e == 0);
7878 e_conv = DecodeError_clone(&e_conv);
7879 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7880 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
7881 return (long)ret_conv;
7884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7885 if ((_res & 1) != 0) return;
7886 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7888 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
7891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7892 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
7893 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7894 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
7895 return (long)ret_conv;
7898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
7899 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7900 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
7901 return (long)ret_conv;
7904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7905 LDKMonitorUpdateError e_conv;
7906 e_conv.inner = (void*)(e & (~1));
7907 e_conv.is_owned = (e & 1) || (e == 0);
7908 e_conv = MonitorUpdateError_clone(&e_conv);
7909 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7910 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
7911 return (long)ret_conv;
7914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7915 if ((_res & 1) != 0) return;
7916 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
7918 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
7921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7922 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
7923 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7924 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
7925 return (long)ret_conv;
7928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7929 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
7930 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7931 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
7932 return (long)ret_ref;
7935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7937 a_conv.inner = (void*)(a & (~1));
7938 a_conv.is_owned = (a & 1) || (a == 0);
7939 a_conv = OutPoint_clone(&a_conv);
7941 b_ref.datalen = (*env)->GetArrayLength(env, b);
7942 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
7943 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7944 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7945 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
7946 return (long)ret_ref;
7949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7950 if ((_res & 1) != 0) return;
7951 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
7953 C2Tuple_OutPointScriptZ_free(_res_conv);
7956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7957 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
7958 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7959 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
7960 return (long)ret_ref;
7963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
7965 b_ref.datalen = (*env)->GetArrayLength(env, b);
7966 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
7967 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7968 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7969 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
7970 return (long)ret_ref;
7973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7974 if ((_res & 1) != 0) return;
7975 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
7977 C2Tuple_u32ScriptZ_free(_res_conv);
7980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7981 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
7982 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7983 if (_res_constr.datalen > 0)
7984 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
7986 _res_constr.data = NULL;
7987 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7988 for (size_t b = 0; b < _res_constr.datalen; b++) {
7989 int64_t _res_conv_27 = _res_vals[b];
7990 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
7991 FREE((void*)_res_conv_27);
7992 _res_constr.data[b] = _res_conv_27_conv;
7994 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7995 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
7998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
7999 LDKThirtyTwoBytes a_ref;
8000 CHECK((*env)->GetArrayLength(env, a) == 32);
8001 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
8002 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
8003 b_constr.datalen = (*env)->GetArrayLength(env, b);
8004 if (b_constr.datalen > 0)
8005 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
8007 b_constr.data = NULL;
8008 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
8009 for (size_t b = 0; b < b_constr.datalen; b++) {
8010 int64_t b_conv_27 = b_vals[b];
8011 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
8012 FREE((void*)b_conv_27);
8013 b_constr.data[b] = b_conv_27_conv;
8015 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
8016 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
8017 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
8018 return (long)ret_ref;
8021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8022 if ((_res & 1) != 0) return;
8023 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
8025 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
8028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8029 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
8030 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8031 if (_res_constr.datalen > 0)
8032 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
8034 _res_constr.data = NULL;
8035 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8036 for (size_t v = 0; v < _res_constr.datalen; v++) {
8037 int64_t _res_conv_47 = _res_vals[v];
8038 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
8039 FREE((void*)_res_conv_47);
8040 _res_constr.data[v] = _res_conv_47_conv;
8042 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8043 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
8046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8047 LDKCVec_TransactionZ _res_constr;
8048 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8049 if (_res_constr.datalen > 0)
8050 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
8052 _res_constr.data = NULL;
8053 for (size_t i = 0; i < _res_constr.datalen; i++) {
8054 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8055 LDKTransaction _res_conv_8_ref;
8056 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
8057 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
8058 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
8059 _res_conv_8_ref.data_is_owned = true;
8060 _res_constr.data[i] = _res_conv_8_ref;
8062 CVec_TransactionZ_free(_res_constr);
8065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8066 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
8067 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8068 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
8069 return (long)ret_ref;
8072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
8073 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
8075 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8076 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
8077 return (long)ret_ref;
8080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8081 if ((_res & 1) != 0) return;
8082 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
8084 C2Tuple_u32TxOutZ_free(_res_conv);
8087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8088 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
8089 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8090 if (_res_constr.datalen > 0)
8091 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
8093 _res_constr.data = NULL;
8094 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8095 for (size_t a = 0; a < _res_constr.datalen; a++) {
8096 int64_t _res_conv_26 = _res_vals[a];
8097 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
8098 FREE((void*)_res_conv_26);
8099 _res_constr.data[a] = _res_conv_26_conv;
8101 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8102 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
8105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
8106 LDKThirtyTwoBytes a_ref;
8107 CHECK((*env)->GetArrayLength(env, a) == 32);
8108 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
8109 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
8110 b_constr.datalen = (*env)->GetArrayLength(env, b);
8111 if (b_constr.datalen > 0)
8112 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
8114 b_constr.data = NULL;
8115 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
8116 for (size_t a = 0; a < b_constr.datalen; a++) {
8117 int64_t b_conv_26 = b_vals[a];
8118 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
8119 FREE((void*)b_conv_26);
8120 b_constr.data[a] = b_conv_26_conv;
8122 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
8123 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8124 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
8125 return (long)ret_ref;
8128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8129 if ((_res & 1) != 0) return;
8130 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
8132 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
8135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8136 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
8137 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8138 if (_res_constr.datalen > 0)
8139 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
8141 _res_constr.data = NULL;
8142 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8143 for (size_t u = 0; u < _res_constr.datalen; u++) {
8144 int64_t _res_conv_46 = _res_vals[u];
8145 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
8146 FREE((void*)_res_conv_46);
8147 _res_constr.data[u] = _res_conv_46_conv;
8149 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8150 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
8153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
8154 LDKThirtyTwoBytes a_ref;
8155 CHECK((*env)->GetArrayLength(env, a) == 32);
8156 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
8157 LDKChannelMonitor b_conv;
8158 b_conv.inner = (void*)(b & (~1));
8159 b_conv.is_owned = (b & 1) || (b == 0);
8160 b_conv = ChannelMonitor_clone(&b_conv);
8161 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8162 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
8163 return (long)ret_ref;
8166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8167 if ((_res & 1) != 0) return;
8168 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
8170 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
8173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8174 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
8176 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8177 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
8178 return (long)ret_conv;
8181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8182 LDKDecodeError e_conv;
8183 e_conv.inner = (void*)(e & (~1));
8184 e_conv.is_owned = (e & 1) || (e == 0);
8185 e_conv = DecodeError_clone(&e_conv);
8186 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8187 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
8188 return (long)ret_conv;
8191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8192 if ((_res & 1) != 0) return;
8193 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8195 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
8198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8199 LDKCVec_SpendableOutputDescriptorZ _res_constr;
8200 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8201 if (_res_constr.datalen > 0)
8202 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
8204 _res_constr.data = NULL;
8205 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8206 for (size_t b = 0; b < _res_constr.datalen; b++) {
8207 int64_t _res_conv_27 = _res_vals[b];
8208 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
8209 FREE((void*)_res_conv_27);
8210 _res_constr.data[b] = _res_conv_27_conv;
8212 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8213 CVec_SpendableOutputDescriptorZ_free(_res_constr);
8216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8217 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
8219 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8220 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
8221 return (long)ret_conv;
8224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8225 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
8226 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8227 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
8228 return (long)ret_conv;
8231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8232 if ((_res & 1) != 0) return;
8233 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
8235 CResult_TxOutAccessErrorZ_free(_res_conv);
8238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8239 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
8240 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8241 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
8242 return (long)ret_conv;
8245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
8246 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
8248 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8249 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
8250 long ret_ref = (long)ret_copy;
8254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
8255 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8256 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
8257 long ret_ref = (long)ret_copy;
8261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8262 if ((_res & 1) != 0) return;
8263 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
8265 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
8268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
8269 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8270 *ret_conv = CResult_NoneAPIErrorZ_ok();
8271 return (long)ret_conv;
8274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8275 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
8277 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8278 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
8279 return (long)ret_conv;
8282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8283 if ((_res & 1) != 0) return;
8284 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
8286 CResult_NoneAPIErrorZ_free(_res_conv);
8289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8290 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
8291 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8292 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
8293 return (long)ret_conv;
8296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8297 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
8298 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8299 if (_res_constr.datalen > 0)
8300 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
8302 _res_constr.data = NULL;
8303 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8304 for (size_t w = 0; w < _res_constr.datalen; w++) {
8305 int64_t _res_conv_22 = _res_vals[w];
8306 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
8307 FREE((void*)_res_conv_22);
8308 _res_constr.data[w] = _res_conv_22_conv;
8310 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8311 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
8314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8315 LDKCVec_APIErrorZ _res_constr;
8316 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8317 if (_res_constr.datalen > 0)
8318 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
8320 _res_constr.data = NULL;
8321 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8322 for (size_t k = 0; k < _res_constr.datalen; k++) {
8323 int64_t _res_conv_10 = _res_vals[k];
8324 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
8325 FREE((void*)_res_conv_10);
8326 _res_constr.data[k] = _res_conv_10_conv;
8328 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8329 CVec_APIErrorZ_free(_res_constr);
8332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8333 LDKCVec_ChannelDetailsZ _res_constr;
8334 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8335 if (_res_constr.datalen > 0)
8336 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8338 _res_constr.data = NULL;
8339 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8340 for (size_t q = 0; q < _res_constr.datalen; q++) {
8341 int64_t _res_conv_16 = _res_vals[q];
8342 LDKChannelDetails _res_conv_16_conv;
8343 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8344 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8345 _res_constr.data[q] = _res_conv_16_conv;
8347 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8348 CVec_ChannelDetailsZ_free(_res_constr);
8351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
8352 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8353 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
8354 return (long)ret_conv;
8357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8358 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
8360 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8361 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
8362 return (long)ret_conv;
8365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8366 if ((_res & 1) != 0) return;
8367 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
8369 CResult_NonePaymentSendFailureZ_free(_res_conv);
8372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8373 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
8374 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8375 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
8376 return (long)ret_conv;
8379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8380 LDKCVec_ChannelMonitorZ _res_constr;
8381 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8382 if (_res_constr.datalen > 0)
8383 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8385 _res_constr.data = NULL;
8386 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8387 for (size_t q = 0; q < _res_constr.datalen; q++) {
8388 int64_t _res_conv_16 = _res_vals[q];
8389 LDKChannelMonitor _res_conv_16_conv;
8390 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8391 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8392 _res_constr.data[q] = _res_conv_16_conv;
8394 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8395 CVec_ChannelMonitorZ_free(_res_constr);
8398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
8399 LDKThirtyTwoBytes a_ref;
8400 CHECK((*env)->GetArrayLength(env, a) == 32);
8401 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
8402 LDKChannelManager b_conv;
8403 b_conv.inner = (void*)(b & (~1));
8404 b_conv.is_owned = (b & 1) || (b == 0);
8405 // Warning: we need a move here but no clone is available for LDKChannelManager
8406 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
8407 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
8408 return (long)ret_ref;
8411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8412 if ((_res & 1) != 0) return;
8413 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
8415 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
8418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8419 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
8421 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8422 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
8423 return (long)ret_conv;
8426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8427 LDKDecodeError e_conv;
8428 e_conv.inner = (void*)(e & (~1));
8429 e_conv.is_owned = (e & 1) || (e == 0);
8430 e_conv = DecodeError_clone(&e_conv);
8431 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8432 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
8433 return (long)ret_conv;
8436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8437 if ((_res & 1) != 0) return;
8438 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8440 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
8443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8444 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
8446 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8447 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
8448 return (long)ret_conv;
8451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8452 LDKDecodeError e_conv;
8453 e_conv.inner = (void*)(e & (~1));
8454 e_conv.is_owned = (e & 1) || (e == 0);
8455 e_conv = DecodeError_clone(&e_conv);
8456 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8457 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
8458 return (long)ret_conv;
8461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8462 if ((_res & 1) != 0) return;
8463 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
8465 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
8468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8469 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
8470 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8471 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
8472 return (long)ret_conv;
8475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8476 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
8477 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8478 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
8479 return (long)ret_ref;
8482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
8484 CHECK((*env)->GetArrayLength(env, a) == 64);
8485 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
8486 LDKCVec_SignatureZ b_constr;
8487 b_constr.datalen = (*env)->GetArrayLength(env, b);
8488 if (b_constr.datalen > 0)
8489 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8491 b_constr.data = NULL;
8492 for (size_t i = 0; i < b_constr.datalen; i++) {
8493 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
8494 LDKSignature b_conv_8_ref;
8495 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
8496 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
8497 b_constr.data[i] = b_conv_8_ref;
8499 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
8500 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
8501 return (long)ret_ref;
8504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8505 if ((_res & 1) != 0) return;
8506 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
8508 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
8511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8512 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
8514 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8515 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
8516 return (long)ret_conv;
8519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
8520 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8521 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
8522 return (long)ret_conv;
8525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8526 if ((_res & 1) != 0) return;
8527 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
8529 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
8532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8533 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
8534 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
8535 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
8536 return (long)ret_conv;
8539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8541 CHECK((*env)->GetArrayLength(env, o) == 64);
8542 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
8543 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8544 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
8545 return (long)ret_conv;
8548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
8549 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8550 *ret_conv = CResult_SignatureNoneZ_err();
8551 return (long)ret_conv;
8554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8555 if ((_res & 1) != 0) return;
8556 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
8558 CResult_SignatureNoneZ_free(_res_conv);
8561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8562 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
8563 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8564 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
8565 return (long)ret_conv;
8568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8569 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
8570 if (o_conv.free == LDKSign_JCalls_free) {
8571 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8572 LDKSign_JCalls_clone(o_conv.this_arg);
8574 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8575 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
8576 return (long)ret_conv;
8579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8580 LDKDecodeError e_conv;
8581 e_conv.inner = (void*)(e & (~1));
8582 e_conv.is_owned = (e & 1) || (e == 0);
8583 e_conv = DecodeError_clone(&e_conv);
8584 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8585 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
8586 return (long)ret_conv;
8589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8590 if ((_res & 1) != 0) return;
8591 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
8593 CResult_SignDecodeErrorZ_free(_res_conv);
8596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8597 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
8598 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
8599 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
8600 return (long)ret_conv;
8603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8604 LDKCVec_CVec_u8ZZ _res_constr;
8605 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8606 if (_res_constr.datalen > 0)
8607 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8609 _res_constr.data = NULL;
8610 for (size_t i = 0; i < _res_constr.datalen; i++) {
8611 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8612 LDKCVec_u8Z _res_conv_8_ref;
8613 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
8614 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
8615 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
8616 _res_constr.data[i] = _res_conv_8_ref;
8618 CVec_CVec_u8ZZ_free(_res_constr);
8621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
8622 LDKCVec_CVec_u8ZZ o_constr;
8623 o_constr.datalen = (*env)->GetArrayLength(env, o);
8624 if (o_constr.datalen > 0)
8625 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
8627 o_constr.data = NULL;
8628 for (size_t i = 0; i < o_constr.datalen; i++) {
8629 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
8630 LDKCVec_u8Z o_conv_8_ref;
8631 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
8632 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
8633 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
8634 o_constr.data[i] = o_conv_8_ref;
8636 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8637 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
8638 return (long)ret_conv;
8641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
8642 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8643 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
8644 return (long)ret_conv;
8647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8648 if ((_res & 1) != 0) return;
8649 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
8651 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
8654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8655 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
8656 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
8657 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
8658 return (long)ret_conv;
8661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8662 LDKInMemorySigner o_conv;
8663 o_conv.inner = (void*)(o & (~1));
8664 o_conv.is_owned = (o & 1) || (o == 0);
8665 o_conv = InMemorySigner_clone(&o_conv);
8666 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8667 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
8668 return (long)ret_conv;
8671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8672 LDKDecodeError e_conv;
8673 e_conv.inner = (void*)(e & (~1));
8674 e_conv.is_owned = (e & 1) || (e == 0);
8675 e_conv = DecodeError_clone(&e_conv);
8676 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8677 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
8678 return (long)ret_conv;
8681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8682 if ((_res & 1) != 0) return;
8683 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
8685 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
8688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8689 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
8690 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
8691 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
8692 return (long)ret_conv;
8695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8696 LDKCVec_TxOutZ _res_constr;
8697 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8698 if (_res_constr.datalen > 0)
8699 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
8701 _res_constr.data = NULL;
8702 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8703 for (size_t h = 0; h < _res_constr.datalen; h++) {
8704 int64_t _res_conv_7 = _res_vals[h];
8705 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
8706 FREE((void*)_res_conv_7);
8707 _res_constr.data[h] = _res_conv_7_conv;
8709 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8710 CVec_TxOutZ_free(_res_constr);
8713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8714 LDKTransaction o_ref;
8715 o_ref.datalen = (*env)->GetArrayLength(env, o);
8716 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
8717 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
8718 o_ref.data_is_owned = true;
8719 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8720 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
8721 return (long)ret_conv;
8724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
8725 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
8726 *ret_conv = CResult_TransactionNoneZ_err();
8727 return (long)ret_conv;
8730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8731 if ((_res & 1) != 0) return;
8732 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
8734 CResult_TransactionNoneZ_free(_res_conv);
8737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8738 LDKCVec_RouteHopZ _res_constr;
8739 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8740 if (_res_constr.datalen > 0)
8741 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8743 _res_constr.data = NULL;
8744 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8745 for (size_t k = 0; k < _res_constr.datalen; k++) {
8746 int64_t _res_conv_10 = _res_vals[k];
8747 LDKRouteHop _res_conv_10_conv;
8748 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
8749 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
8750 _res_constr.data[k] = _res_conv_10_conv;
8752 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8753 CVec_RouteHopZ_free(_res_constr);
8756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8757 LDKCVec_CVec_RouteHopZZ _res_constr;
8758 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8759 if (_res_constr.datalen > 0)
8760 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
8762 _res_constr.data = NULL;
8763 for (size_t m = 0; m < _res_constr.datalen; m++) {
8764 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
8765 LDKCVec_RouteHopZ _res_conv_12_constr;
8766 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
8767 if (_res_conv_12_constr.datalen > 0)
8768 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8770 _res_conv_12_constr.data = NULL;
8771 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
8772 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
8773 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
8774 LDKRouteHop _res_conv_12_conv_10_conv;
8775 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
8776 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
8777 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
8779 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
8780 _res_constr.data[m] = _res_conv_12_constr;
8782 CVec_CVec_RouteHopZZ_free(_res_constr);
8785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8787 o_conv.inner = (void*)(o & (~1));
8788 o_conv.is_owned = (o & 1) || (o == 0);
8789 o_conv = Route_clone(&o_conv);
8790 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8791 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
8792 return (long)ret_conv;
8795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8796 LDKDecodeError e_conv;
8797 e_conv.inner = (void*)(e & (~1));
8798 e_conv.is_owned = (e & 1) || (e == 0);
8799 e_conv = DecodeError_clone(&e_conv);
8800 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8801 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
8802 return (long)ret_conv;
8805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8806 if ((_res & 1) != 0) return;
8807 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
8809 CResult_RouteDecodeErrorZ_free(_res_conv);
8812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8813 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
8814 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
8815 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
8816 return (long)ret_conv;
8819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8820 LDKCVec_RouteHintZ _res_constr;
8821 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8822 if (_res_constr.datalen > 0)
8823 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
8825 _res_constr.data = NULL;
8826 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8827 for (size_t l = 0; l < _res_constr.datalen; l++) {
8828 int64_t _res_conv_11 = _res_vals[l];
8829 LDKRouteHint _res_conv_11_conv;
8830 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
8831 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
8832 _res_constr.data[l] = _res_conv_11_conv;
8834 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8835 CVec_RouteHintZ_free(_res_constr);
8838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8840 o_conv.inner = (void*)(o & (~1));
8841 o_conv.is_owned = (o & 1) || (o == 0);
8842 o_conv = Route_clone(&o_conv);
8843 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8844 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
8845 return (long)ret_conv;
8848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8849 LDKLightningError e_conv;
8850 e_conv.inner = (void*)(e & (~1));
8851 e_conv.is_owned = (e & 1) || (e == 0);
8852 e_conv = LightningError_clone(&e_conv);
8853 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8854 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
8855 return (long)ret_conv;
8858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8859 if ((_res & 1) != 0) return;
8860 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
8862 CResult_RouteLightningErrorZ_free(_res_conv);
8865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8866 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
8867 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8868 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
8869 return (long)ret_conv;
8872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
8873 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
8875 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8876 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
8877 return (long)ret_conv;
8880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
8881 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8882 *ret_conv = CResult_NetAddressu8Z_err(e);
8883 return (long)ret_conv;
8886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8887 if ((_res & 1) != 0) return;
8888 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
8890 CResult_NetAddressu8Z_free(_res_conv);
8893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8894 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
8895 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8896 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
8897 return (long)ret_conv;
8900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8901 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
8903 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8904 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
8905 return (long)ret_conv;
8908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8909 LDKDecodeError e_conv;
8910 e_conv.inner = (void*)(e & (~1));
8911 e_conv.is_owned = (e & 1) || (e == 0);
8912 e_conv = DecodeError_clone(&e_conv);
8913 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8914 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
8915 return (long)ret_conv;
8918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8919 if ((_res & 1) != 0) return;
8920 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8922 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
8925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8926 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
8927 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8928 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
8929 return (long)ret_conv;
8932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8933 LDKCVec_UpdateAddHTLCZ _res_constr;
8934 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8935 if (_res_constr.datalen > 0)
8936 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
8938 _res_constr.data = NULL;
8939 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8940 for (size_t p = 0; p < _res_constr.datalen; p++) {
8941 int64_t _res_conv_15 = _res_vals[p];
8942 LDKUpdateAddHTLC _res_conv_15_conv;
8943 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
8944 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
8945 _res_constr.data[p] = _res_conv_15_conv;
8947 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8948 CVec_UpdateAddHTLCZ_free(_res_constr);
8951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8952 LDKCVec_UpdateFulfillHTLCZ _res_constr;
8953 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8954 if (_res_constr.datalen > 0)
8955 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
8957 _res_constr.data = NULL;
8958 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8959 for (size_t t = 0; t < _res_constr.datalen; t++) {
8960 int64_t _res_conv_19 = _res_vals[t];
8961 LDKUpdateFulfillHTLC _res_conv_19_conv;
8962 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
8963 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
8964 _res_constr.data[t] = _res_conv_19_conv;
8966 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8967 CVec_UpdateFulfillHTLCZ_free(_res_constr);
8970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8971 LDKCVec_UpdateFailHTLCZ _res_constr;
8972 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8973 if (_res_constr.datalen > 0)
8974 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
8976 _res_constr.data = NULL;
8977 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8978 for (size_t q = 0; q < _res_constr.datalen; q++) {
8979 int64_t _res_conv_16 = _res_vals[q];
8980 LDKUpdateFailHTLC _res_conv_16_conv;
8981 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
8982 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
8983 _res_constr.data[q] = _res_conv_16_conv;
8985 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8986 CVec_UpdateFailHTLCZ_free(_res_constr);
8989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8990 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
8991 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8992 if (_res_constr.datalen > 0)
8993 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
8995 _res_constr.data = NULL;
8996 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8997 for (size_t z = 0; z < _res_constr.datalen; z++) {
8998 int64_t _res_conv_25 = _res_vals[z];
8999 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
9000 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
9001 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
9002 _res_constr.data[z] = _res_conv_25_conv;
9004 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9005 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
9008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9009 LDKAcceptChannel o_conv;
9010 o_conv.inner = (void*)(o & (~1));
9011 o_conv.is_owned = (o & 1) || (o == 0);
9012 o_conv = AcceptChannel_clone(&o_conv);
9013 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9014 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
9015 return (long)ret_conv;
9018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9019 LDKDecodeError e_conv;
9020 e_conv.inner = (void*)(e & (~1));
9021 e_conv.is_owned = (e & 1) || (e == 0);
9022 e_conv = DecodeError_clone(&e_conv);
9023 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9024 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
9025 return (long)ret_conv;
9028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9029 if ((_res & 1) != 0) return;
9030 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9032 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
9035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9036 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
9037 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
9038 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
9039 return (long)ret_conv;
9042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9043 LDKAnnouncementSignatures o_conv;
9044 o_conv.inner = (void*)(o & (~1));
9045 o_conv.is_owned = (o & 1) || (o == 0);
9046 o_conv = AnnouncementSignatures_clone(&o_conv);
9047 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9048 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
9049 return (long)ret_conv;
9052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9053 LDKDecodeError e_conv;
9054 e_conv.inner = (void*)(e & (~1));
9055 e_conv.is_owned = (e & 1) || (e == 0);
9056 e_conv = DecodeError_clone(&e_conv);
9057 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9058 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
9059 return (long)ret_conv;
9062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9063 if ((_res & 1) != 0) return;
9064 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9066 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
9069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9070 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
9071 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
9072 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
9073 return (long)ret_conv;
9076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9077 LDKChannelReestablish o_conv;
9078 o_conv.inner = (void*)(o & (~1));
9079 o_conv.is_owned = (o & 1) || (o == 0);
9080 o_conv = ChannelReestablish_clone(&o_conv);
9081 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9082 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
9083 return (long)ret_conv;
9086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9087 LDKDecodeError e_conv;
9088 e_conv.inner = (void*)(e & (~1));
9089 e_conv.is_owned = (e & 1) || (e == 0);
9090 e_conv = DecodeError_clone(&e_conv);
9091 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9092 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
9093 return (long)ret_conv;
9096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9097 if ((_res & 1) != 0) return;
9098 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
9100 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
9103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9104 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
9105 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
9106 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
9107 return (long)ret_conv;
9110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9111 LDKClosingSigned o_conv;
9112 o_conv.inner = (void*)(o & (~1));
9113 o_conv.is_owned = (o & 1) || (o == 0);
9114 o_conv = ClosingSigned_clone(&o_conv);
9115 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9116 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
9117 return (long)ret_conv;
9120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9121 LDKDecodeError e_conv;
9122 e_conv.inner = (void*)(e & (~1));
9123 e_conv.is_owned = (e & 1) || (e == 0);
9124 e_conv = DecodeError_clone(&e_conv);
9125 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9126 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
9127 return (long)ret_conv;
9130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9131 if ((_res & 1) != 0) return;
9132 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9134 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
9137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9138 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
9139 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
9140 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
9141 return (long)ret_conv;
9144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9145 LDKCommitmentSigned o_conv;
9146 o_conv.inner = (void*)(o & (~1));
9147 o_conv.is_owned = (o & 1) || (o == 0);
9148 o_conv = CommitmentSigned_clone(&o_conv);
9149 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9150 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
9151 return (long)ret_conv;
9154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9155 LDKDecodeError e_conv;
9156 e_conv.inner = (void*)(e & (~1));
9157 e_conv.is_owned = (e & 1) || (e == 0);
9158 e_conv = DecodeError_clone(&e_conv);
9159 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9160 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
9161 return (long)ret_conv;
9164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9165 if ((_res & 1) != 0) return;
9166 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9168 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
9171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9172 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
9173 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
9174 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
9175 return (long)ret_conv;
9178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9179 LDKFundingCreated o_conv;
9180 o_conv.inner = (void*)(o & (~1));
9181 o_conv.is_owned = (o & 1) || (o == 0);
9182 o_conv = FundingCreated_clone(&o_conv);
9183 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9184 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
9185 return (long)ret_conv;
9188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9189 LDKDecodeError e_conv;
9190 e_conv.inner = (void*)(e & (~1));
9191 e_conv.is_owned = (e & 1) || (e == 0);
9192 e_conv = DecodeError_clone(&e_conv);
9193 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9194 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
9195 return (long)ret_conv;
9198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9199 if ((_res & 1) != 0) return;
9200 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9202 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
9205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9206 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
9207 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
9208 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
9209 return (long)ret_conv;
9212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9213 LDKFundingSigned o_conv;
9214 o_conv.inner = (void*)(o & (~1));
9215 o_conv.is_owned = (o & 1) || (o == 0);
9216 o_conv = FundingSigned_clone(&o_conv);
9217 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9218 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
9219 return (long)ret_conv;
9222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9223 LDKDecodeError e_conv;
9224 e_conv.inner = (void*)(e & (~1));
9225 e_conv.is_owned = (e & 1) || (e == 0);
9226 e_conv = DecodeError_clone(&e_conv);
9227 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9228 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
9229 return (long)ret_conv;
9232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9233 if ((_res & 1) != 0) return;
9234 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9236 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
9239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9240 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
9241 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
9242 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
9243 return (long)ret_conv;
9246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9247 LDKFundingLocked o_conv;
9248 o_conv.inner = (void*)(o & (~1));
9249 o_conv.is_owned = (o & 1) || (o == 0);
9250 o_conv = FundingLocked_clone(&o_conv);
9251 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9252 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
9253 return (long)ret_conv;
9256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9257 LDKDecodeError e_conv;
9258 e_conv.inner = (void*)(e & (~1));
9259 e_conv.is_owned = (e & 1) || (e == 0);
9260 e_conv = DecodeError_clone(&e_conv);
9261 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9262 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
9263 return (long)ret_conv;
9266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9267 if ((_res & 1) != 0) return;
9268 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
9270 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
9273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9274 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
9275 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
9276 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
9277 return (long)ret_conv;
9280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9282 o_conv.inner = (void*)(o & (~1));
9283 o_conv.is_owned = (o & 1) || (o == 0);
9284 o_conv = Init_clone(&o_conv);
9285 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9286 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
9287 return (long)ret_conv;
9290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9291 LDKDecodeError e_conv;
9292 e_conv.inner = (void*)(e & (~1));
9293 e_conv.is_owned = (e & 1) || (e == 0);
9294 e_conv = DecodeError_clone(&e_conv);
9295 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9296 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
9297 return (long)ret_conv;
9300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9301 if ((_res & 1) != 0) return;
9302 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
9304 CResult_InitDecodeErrorZ_free(_res_conv);
9307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9308 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
9309 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
9310 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
9311 return (long)ret_conv;
9314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9315 LDKOpenChannel o_conv;
9316 o_conv.inner = (void*)(o & (~1));
9317 o_conv.is_owned = (o & 1) || (o == 0);
9318 o_conv = OpenChannel_clone(&o_conv);
9319 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9320 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
9321 return (long)ret_conv;
9324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9325 LDKDecodeError e_conv;
9326 e_conv.inner = (void*)(e & (~1));
9327 e_conv.is_owned = (e & 1) || (e == 0);
9328 e_conv = DecodeError_clone(&e_conv);
9329 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9330 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
9331 return (long)ret_conv;
9334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9335 if ((_res & 1) != 0) return;
9336 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
9338 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
9341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9342 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
9343 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
9344 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
9345 return (long)ret_conv;
9348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9349 LDKRevokeAndACK o_conv;
9350 o_conv.inner = (void*)(o & (~1));
9351 o_conv.is_owned = (o & 1) || (o == 0);
9352 o_conv = RevokeAndACK_clone(&o_conv);
9353 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9354 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
9355 return (long)ret_conv;
9358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9359 LDKDecodeError e_conv;
9360 e_conv.inner = (void*)(e & (~1));
9361 e_conv.is_owned = (e & 1) || (e == 0);
9362 e_conv = DecodeError_clone(&e_conv);
9363 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9364 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
9365 return (long)ret_conv;
9368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9369 if ((_res & 1) != 0) return;
9370 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
9372 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
9375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9376 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
9377 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
9378 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
9379 return (long)ret_conv;
9382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9384 o_conv.inner = (void*)(o & (~1));
9385 o_conv.is_owned = (o & 1) || (o == 0);
9386 o_conv = Shutdown_clone(&o_conv);
9387 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9388 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
9389 return (long)ret_conv;
9392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9393 LDKDecodeError e_conv;
9394 e_conv.inner = (void*)(e & (~1));
9395 e_conv.is_owned = (e & 1) || (e == 0);
9396 e_conv = DecodeError_clone(&e_conv);
9397 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9398 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
9399 return (long)ret_conv;
9402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9403 if ((_res & 1) != 0) return;
9404 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
9406 CResult_ShutdownDecodeErrorZ_free(_res_conv);
9409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9410 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
9411 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
9412 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
9413 return (long)ret_conv;
9416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9417 LDKUpdateFailHTLC o_conv;
9418 o_conv.inner = (void*)(o & (~1));
9419 o_conv.is_owned = (o & 1) || (o == 0);
9420 o_conv = UpdateFailHTLC_clone(&o_conv);
9421 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9422 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
9423 return (long)ret_conv;
9426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9427 LDKDecodeError e_conv;
9428 e_conv.inner = (void*)(e & (~1));
9429 e_conv.is_owned = (e & 1) || (e == 0);
9430 e_conv = DecodeError_clone(&e_conv);
9431 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9432 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
9433 return (long)ret_conv;
9436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9437 if ((_res & 1) != 0) return;
9438 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9440 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
9443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9444 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
9445 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
9446 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
9447 return (long)ret_conv;
9450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9451 LDKUpdateFailMalformedHTLC o_conv;
9452 o_conv.inner = (void*)(o & (~1));
9453 o_conv.is_owned = (o & 1) || (o == 0);
9454 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
9455 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9456 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
9457 return (long)ret_conv;
9460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9461 LDKDecodeError e_conv;
9462 e_conv.inner = (void*)(e & (~1));
9463 e_conv.is_owned = (e & 1) || (e == 0);
9464 e_conv = DecodeError_clone(&e_conv);
9465 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9466 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
9467 return (long)ret_conv;
9470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9471 if ((_res & 1) != 0) return;
9472 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9474 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
9477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9478 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
9479 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
9480 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
9481 return (long)ret_conv;
9484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9485 LDKUpdateFee o_conv;
9486 o_conv.inner = (void*)(o & (~1));
9487 o_conv.is_owned = (o & 1) || (o == 0);
9488 o_conv = UpdateFee_clone(&o_conv);
9489 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9490 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
9491 return (long)ret_conv;
9494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9495 LDKDecodeError e_conv;
9496 e_conv.inner = (void*)(e & (~1));
9497 e_conv.is_owned = (e & 1) || (e == 0);
9498 e_conv = DecodeError_clone(&e_conv);
9499 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9500 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
9501 return (long)ret_conv;
9504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9505 if ((_res & 1) != 0) return;
9506 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9508 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
9511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9512 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
9513 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
9514 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
9515 return (long)ret_conv;
9518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9519 LDKUpdateFulfillHTLC o_conv;
9520 o_conv.inner = (void*)(o & (~1));
9521 o_conv.is_owned = (o & 1) || (o == 0);
9522 o_conv = UpdateFulfillHTLC_clone(&o_conv);
9523 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9524 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
9525 return (long)ret_conv;
9528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9529 LDKDecodeError e_conv;
9530 e_conv.inner = (void*)(e & (~1));
9531 e_conv.is_owned = (e & 1) || (e == 0);
9532 e_conv = DecodeError_clone(&e_conv);
9533 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9534 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
9535 return (long)ret_conv;
9538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9539 if ((_res & 1) != 0) return;
9540 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9542 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
9545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9546 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
9547 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
9548 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
9549 return (long)ret_conv;
9552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9553 LDKUpdateAddHTLC o_conv;
9554 o_conv.inner = (void*)(o & (~1));
9555 o_conv.is_owned = (o & 1) || (o == 0);
9556 o_conv = UpdateAddHTLC_clone(&o_conv);
9557 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9558 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
9559 return (long)ret_conv;
9562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9563 LDKDecodeError e_conv;
9564 e_conv.inner = (void*)(e & (~1));
9565 e_conv.is_owned = (e & 1) || (e == 0);
9566 e_conv = DecodeError_clone(&e_conv);
9567 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9568 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
9569 return (long)ret_conv;
9572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9573 if ((_res & 1) != 0) return;
9574 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
9576 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
9579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9580 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
9581 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
9582 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
9583 return (long)ret_conv;
9586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9588 o_conv.inner = (void*)(o & (~1));
9589 o_conv.is_owned = (o & 1) || (o == 0);
9590 o_conv = Ping_clone(&o_conv);
9591 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9592 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
9593 return (long)ret_conv;
9596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9597 LDKDecodeError e_conv;
9598 e_conv.inner = (void*)(e & (~1));
9599 e_conv.is_owned = (e & 1) || (e == 0);
9600 e_conv = DecodeError_clone(&e_conv);
9601 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9602 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
9603 return (long)ret_conv;
9606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9607 if ((_res & 1) != 0) return;
9608 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
9610 CResult_PingDecodeErrorZ_free(_res_conv);
9613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9614 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
9615 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
9616 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
9617 return (long)ret_conv;
9620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9622 o_conv.inner = (void*)(o & (~1));
9623 o_conv.is_owned = (o & 1) || (o == 0);
9624 o_conv = Pong_clone(&o_conv);
9625 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9626 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
9627 return (long)ret_conv;
9630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9631 LDKDecodeError e_conv;
9632 e_conv.inner = (void*)(e & (~1));
9633 e_conv.is_owned = (e & 1) || (e == 0);
9634 e_conv = DecodeError_clone(&e_conv);
9635 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9636 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
9637 return (long)ret_conv;
9640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9641 if ((_res & 1) != 0) return;
9642 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
9644 CResult_PongDecodeErrorZ_free(_res_conv);
9647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9648 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
9649 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
9650 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
9651 return (long)ret_conv;
9654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9655 LDKUnsignedChannelAnnouncement o_conv;
9656 o_conv.inner = (void*)(o & (~1));
9657 o_conv.is_owned = (o & 1) || (o == 0);
9658 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
9659 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9660 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
9661 return (long)ret_conv;
9664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9665 LDKDecodeError e_conv;
9666 e_conv.inner = (void*)(e & (~1));
9667 e_conv.is_owned = (e & 1) || (e == 0);
9668 e_conv = DecodeError_clone(&e_conv);
9669 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9670 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
9671 return (long)ret_conv;
9674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9675 if ((_res & 1) != 0) return;
9676 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9678 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
9681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9682 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
9683 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
9684 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
9685 return (long)ret_conv;
9688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9689 LDKChannelAnnouncement o_conv;
9690 o_conv.inner = (void*)(o & (~1));
9691 o_conv.is_owned = (o & 1) || (o == 0);
9692 o_conv = ChannelAnnouncement_clone(&o_conv);
9693 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9694 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
9695 return (long)ret_conv;
9698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9699 LDKDecodeError e_conv;
9700 e_conv.inner = (void*)(e & (~1));
9701 e_conv.is_owned = (e & 1) || (e == 0);
9702 e_conv = DecodeError_clone(&e_conv);
9703 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9704 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
9705 return (long)ret_conv;
9708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9709 if ((_res & 1) != 0) return;
9710 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9712 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
9715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9716 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
9717 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
9718 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
9719 return (long)ret_conv;
9722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9723 LDKUnsignedChannelUpdate o_conv;
9724 o_conv.inner = (void*)(o & (~1));
9725 o_conv.is_owned = (o & 1) || (o == 0);
9726 o_conv = UnsignedChannelUpdate_clone(&o_conv);
9727 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9728 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
9729 return (long)ret_conv;
9732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9733 LDKDecodeError e_conv;
9734 e_conv.inner = (void*)(e & (~1));
9735 e_conv.is_owned = (e & 1) || (e == 0);
9736 e_conv = DecodeError_clone(&e_conv);
9737 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9738 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
9739 return (long)ret_conv;
9742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9743 if ((_res & 1) != 0) return;
9744 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9746 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
9749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9750 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
9751 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
9752 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
9753 return (long)ret_conv;
9756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9757 LDKChannelUpdate o_conv;
9758 o_conv.inner = (void*)(o & (~1));
9759 o_conv.is_owned = (o & 1) || (o == 0);
9760 o_conv = ChannelUpdate_clone(&o_conv);
9761 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9762 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
9763 return (long)ret_conv;
9766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9767 LDKDecodeError e_conv;
9768 e_conv.inner = (void*)(e & (~1));
9769 e_conv.is_owned = (e & 1) || (e == 0);
9770 e_conv = DecodeError_clone(&e_conv);
9771 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9772 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
9773 return (long)ret_conv;
9776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9777 if ((_res & 1) != 0) return;
9778 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
9780 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
9783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9784 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
9785 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
9786 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
9787 return (long)ret_conv;
9790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9791 LDKErrorMessage o_conv;
9792 o_conv.inner = (void*)(o & (~1));
9793 o_conv.is_owned = (o & 1) || (o == 0);
9794 o_conv = ErrorMessage_clone(&o_conv);
9795 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9796 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
9797 return (long)ret_conv;
9800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9801 LDKDecodeError e_conv;
9802 e_conv.inner = (void*)(e & (~1));
9803 e_conv.is_owned = (e & 1) || (e == 0);
9804 e_conv = DecodeError_clone(&e_conv);
9805 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9806 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
9807 return (long)ret_conv;
9810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9811 if ((_res & 1) != 0) return;
9812 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
9814 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
9817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9818 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
9819 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
9820 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
9821 return (long)ret_conv;
9824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9825 LDKUnsignedNodeAnnouncement o_conv;
9826 o_conv.inner = (void*)(o & (~1));
9827 o_conv.is_owned = (o & 1) || (o == 0);
9828 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
9829 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9830 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
9831 return (long)ret_conv;
9834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9835 LDKDecodeError e_conv;
9836 e_conv.inner = (void*)(e & (~1));
9837 e_conv.is_owned = (e & 1) || (e == 0);
9838 e_conv = DecodeError_clone(&e_conv);
9839 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9840 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
9841 return (long)ret_conv;
9844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9845 if ((_res & 1) != 0) return;
9846 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9848 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
9851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9852 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
9853 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
9854 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
9855 return (long)ret_conv;
9858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9859 LDKNodeAnnouncement o_conv;
9860 o_conv.inner = (void*)(o & (~1));
9861 o_conv.is_owned = (o & 1) || (o == 0);
9862 o_conv = NodeAnnouncement_clone(&o_conv);
9863 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9864 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
9865 return (long)ret_conv;
9868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9869 LDKDecodeError e_conv;
9870 e_conv.inner = (void*)(e & (~1));
9871 e_conv.is_owned = (e & 1) || (e == 0);
9872 e_conv = DecodeError_clone(&e_conv);
9873 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9874 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
9875 return (long)ret_conv;
9878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9879 if ((_res & 1) != 0) return;
9880 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
9882 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
9885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9886 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
9887 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9888 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
9889 return (long)ret_conv;
9892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9893 LDKQueryShortChannelIds o_conv;
9894 o_conv.inner = (void*)(o & (~1));
9895 o_conv.is_owned = (o & 1) || (o == 0);
9896 o_conv = QueryShortChannelIds_clone(&o_conv);
9897 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9898 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
9899 return (long)ret_conv;
9902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9903 LDKDecodeError e_conv;
9904 e_conv.inner = (void*)(e & (~1));
9905 e_conv.is_owned = (e & 1) || (e == 0);
9906 e_conv = DecodeError_clone(&e_conv);
9907 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9908 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
9909 return (long)ret_conv;
9912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9913 if ((_res & 1) != 0) return;
9914 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
9916 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
9919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9920 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
9921 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9922 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
9923 return (long)ret_conv;
9926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9927 LDKReplyShortChannelIdsEnd o_conv;
9928 o_conv.inner = (void*)(o & (~1));
9929 o_conv.is_owned = (o & 1) || (o == 0);
9930 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
9931 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9932 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
9933 return (long)ret_conv;
9936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9937 LDKDecodeError e_conv;
9938 e_conv.inner = (void*)(e & (~1));
9939 e_conv.is_owned = (e & 1) || (e == 0);
9940 e_conv = DecodeError_clone(&e_conv);
9941 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9942 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
9943 return (long)ret_conv;
9946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9947 if ((_res & 1) != 0) return;
9948 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
9950 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
9953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9954 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
9955 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9956 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
9957 return (long)ret_conv;
9960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9961 LDKQueryChannelRange o_conv;
9962 o_conv.inner = (void*)(o & (~1));
9963 o_conv.is_owned = (o & 1) || (o == 0);
9964 o_conv = QueryChannelRange_clone(&o_conv);
9965 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9966 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
9967 return (long)ret_conv;
9970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9971 LDKDecodeError e_conv;
9972 e_conv.inner = (void*)(e & (~1));
9973 e_conv.is_owned = (e & 1) || (e == 0);
9974 e_conv = DecodeError_clone(&e_conv);
9975 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9976 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
9977 return (long)ret_conv;
9980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9981 if ((_res & 1) != 0) return;
9982 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9984 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
9987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9988 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
9989 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9990 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
9991 return (long)ret_conv;
9994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9995 LDKReplyChannelRange o_conv;
9996 o_conv.inner = (void*)(o & (~1));
9997 o_conv.is_owned = (o & 1) || (o == 0);
9998 o_conv = ReplyChannelRange_clone(&o_conv);
9999 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10000 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
10001 return (long)ret_conv;
10004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10005 LDKDecodeError e_conv;
10006 e_conv.inner = (void*)(e & (~1));
10007 e_conv.is_owned = (e & 1) || (e == 0);
10008 e_conv = DecodeError_clone(&e_conv);
10009 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10010 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
10011 return (long)ret_conv;
10014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10015 if ((_res & 1) != 0) return;
10016 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
10018 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
10021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10022 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
10023 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
10024 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
10025 return (long)ret_conv;
10028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10029 LDKGossipTimestampFilter o_conv;
10030 o_conv.inner = (void*)(o & (~1));
10031 o_conv.is_owned = (o & 1) || (o == 0);
10032 o_conv = GossipTimestampFilter_clone(&o_conv);
10033 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10034 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
10035 return (long)ret_conv;
10038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10039 LDKDecodeError e_conv;
10040 e_conv.inner = (void*)(e & (~1));
10041 e_conv.is_owned = (e & 1) || (e == 0);
10042 e_conv = DecodeError_clone(&e_conv);
10043 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10044 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
10045 return (long)ret_conv;
10048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10049 if ((_res & 1) != 0) return;
10050 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
10052 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
10055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10056 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
10057 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
10058 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
10059 return (long)ret_conv;
10062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10063 if ((this_ptr & 1) != 0) return;
10064 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
10065 FREE((void*)this_ptr);
10066 Event_free(this_ptr_conv);
10069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10070 LDKEvent* orig_conv = (LDKEvent*)orig;
10071 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10072 *ret_copy = Event_clone(orig_conv);
10073 long ret_ref = (long)ret_copy;
10077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
10078 LDKEvent* obj_conv = (LDKEvent*)obj;
10079 LDKCVec_u8Z ret_var = Event_write(obj_conv);
10080 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10081 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10082 CVec_u8Z_free(ret_var);
10086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10087 if ((this_ptr & 1) != 0) return;
10088 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
10089 FREE((void*)this_ptr);
10090 MessageSendEvent_free(this_ptr_conv);
10093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10094 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
10095 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10096 *ret_copy = MessageSendEvent_clone(orig_conv);
10097 long ret_ref = (long)ret_copy;
10101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10102 if ((this_ptr & 1) != 0) return;
10103 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
10104 FREE((void*)this_ptr);
10105 MessageSendEventsProvider_free(this_ptr_conv);
10108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10109 if ((this_ptr & 1) != 0) return;
10110 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
10111 FREE((void*)this_ptr);
10112 EventsProvider_free(this_ptr_conv);
10115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10116 if ((this_ptr & 1) != 0) return;
10117 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
10118 FREE((void*)this_ptr);
10119 APIError_free(this_ptr_conv);
10122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10123 LDKAPIError* orig_conv = (LDKAPIError*)orig;
10124 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
10125 *ret_copy = APIError_clone(orig_conv);
10126 long ret_ref = (long)ret_copy;
10130 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10131 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
10132 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
10136 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
10137 jclass ret_conv = LDKLevel_to_java(env, Level_max());
10141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10142 if ((this_ptr & 1) != 0) return;
10143 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
10144 FREE((void*)this_ptr);
10145 Logger_free(this_ptr_conv);
10148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10149 LDKChannelHandshakeConfig this_obj_conv;
10150 this_obj_conv.inner = (void*)(this_obj & (~1));
10151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10152 ChannelHandshakeConfig_free(this_obj_conv);
10155 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
10156 LDKChannelHandshakeConfig this_ptr_conv;
10157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10158 this_ptr_conv.is_owned = false;
10159 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
10163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10164 LDKChannelHandshakeConfig this_ptr_conv;
10165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10166 this_ptr_conv.is_owned = false;
10167 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
10170 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10171 LDKChannelHandshakeConfig this_ptr_conv;
10172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10173 this_ptr_conv.is_owned = false;
10174 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
10178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10179 LDKChannelHandshakeConfig this_ptr_conv;
10180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10181 this_ptr_conv.is_owned = false;
10182 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
10185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10186 LDKChannelHandshakeConfig this_ptr_conv;
10187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10188 this_ptr_conv.is_owned = false;
10189 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
10193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10194 LDKChannelHandshakeConfig this_ptr_conv;
10195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10196 this_ptr_conv.is_owned = false;
10197 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
10200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
10201 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
10202 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10203 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10204 long ret_ref = (long)ret_var.inner;
10205 if (ret_var.is_owned) {
10211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10212 LDKChannelHandshakeConfig orig_conv;
10213 orig_conv.inner = (void*)(orig & (~1));
10214 orig_conv.is_owned = false;
10215 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
10216 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10217 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10218 long ret_ref = (long)ret_var.inner;
10219 if (ret_var.is_owned) {
10225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
10226 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
10227 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10228 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10229 long ret_ref = (long)ret_var.inner;
10230 if (ret_var.is_owned) {
10236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10237 LDKChannelHandshakeLimits this_obj_conv;
10238 this_obj_conv.inner = (void*)(this_obj & (~1));
10239 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10240 ChannelHandshakeLimits_free(this_obj_conv);
10243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10244 LDKChannelHandshakeLimits this_ptr_conv;
10245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10246 this_ptr_conv.is_owned = false;
10247 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
10251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10252 LDKChannelHandshakeLimits this_ptr_conv;
10253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10254 this_ptr_conv.is_owned = false;
10255 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
10258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10259 LDKChannelHandshakeLimits this_ptr_conv;
10260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10261 this_ptr_conv.is_owned = false;
10262 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
10266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10267 LDKChannelHandshakeLimits this_ptr_conv;
10268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10269 this_ptr_conv.is_owned = false;
10270 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
10273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10274 LDKChannelHandshakeLimits this_ptr_conv;
10275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10276 this_ptr_conv.is_owned = false;
10277 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
10281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10282 LDKChannelHandshakeLimits this_ptr_conv;
10283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10284 this_ptr_conv.is_owned = false;
10285 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10289 LDKChannelHandshakeLimits this_ptr_conv;
10290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10291 this_ptr_conv.is_owned = false;
10292 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
10296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10297 LDKChannelHandshakeLimits this_ptr_conv;
10298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10299 this_ptr_conv.is_owned = false;
10300 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
10303 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
10304 LDKChannelHandshakeLimits this_ptr_conv;
10305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10306 this_ptr_conv.is_owned = false;
10307 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
10311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10312 LDKChannelHandshakeLimits this_ptr_conv;
10313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10314 this_ptr_conv.is_owned = false;
10315 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
10318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10319 LDKChannelHandshakeLimits this_ptr_conv;
10320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10321 this_ptr_conv.is_owned = false;
10322 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
10326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10327 LDKChannelHandshakeLimits this_ptr_conv;
10328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10329 this_ptr_conv.is_owned = false;
10330 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
10333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10334 LDKChannelHandshakeLimits this_ptr_conv;
10335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10336 this_ptr_conv.is_owned = false;
10337 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
10341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10342 LDKChannelHandshakeLimits this_ptr_conv;
10343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10344 this_ptr_conv.is_owned = false;
10345 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
10348 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
10349 LDKChannelHandshakeLimits this_ptr_conv;
10350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10351 this_ptr_conv.is_owned = false;
10352 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
10356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10357 LDKChannelHandshakeLimits this_ptr_conv;
10358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10359 this_ptr_conv.is_owned = false;
10360 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
10363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
10364 LDKChannelHandshakeLimits this_ptr_conv;
10365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10366 this_ptr_conv.is_owned = false;
10367 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
10371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10372 LDKChannelHandshakeLimits this_ptr_conv;
10373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10374 this_ptr_conv.is_owned = false;
10375 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
10378 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10379 LDKChannelHandshakeLimits this_ptr_conv;
10380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10381 this_ptr_conv.is_owned = false;
10382 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
10386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10387 LDKChannelHandshakeLimits this_ptr_conv;
10388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10389 this_ptr_conv.is_owned = false;
10390 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
10393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int64_t min_dust_limit_satoshis_arg, int64_t max_dust_limit_satoshis_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
10394 LDKChannelHandshakeLimits ret_var = 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);
10395 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10396 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10397 long ret_ref = (long)ret_var.inner;
10398 if (ret_var.is_owned) {
10404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10405 LDKChannelHandshakeLimits orig_conv;
10406 orig_conv.inner = (void*)(orig & (~1));
10407 orig_conv.is_owned = false;
10408 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
10409 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10410 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10411 long ret_ref = (long)ret_var.inner;
10412 if (ret_var.is_owned) {
10418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
10419 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
10420 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10421 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10422 long ret_ref = (long)ret_var.inner;
10423 if (ret_var.is_owned) {
10429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10430 LDKChannelConfig this_obj_conv;
10431 this_obj_conv.inner = (void*)(this_obj & (~1));
10432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10433 ChannelConfig_free(this_obj_conv);
10436 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
10437 LDKChannelConfig this_ptr_conv;
10438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10439 this_ptr_conv.is_owned = false;
10440 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
10444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10445 LDKChannelConfig this_ptr_conv;
10446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10447 this_ptr_conv.is_owned = false;
10448 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
10451 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
10452 LDKChannelConfig this_ptr_conv;
10453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10454 this_ptr_conv.is_owned = false;
10455 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
10459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10460 LDKChannelConfig this_ptr_conv;
10461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10462 this_ptr_conv.is_owned = false;
10463 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
10466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
10467 LDKChannelConfig this_ptr_conv;
10468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10469 this_ptr_conv.is_owned = false;
10470 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
10474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10475 LDKChannelConfig this_ptr_conv;
10476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10477 this_ptr_conv.is_owned = false;
10478 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
10481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10482 LDKChannelConfig this_ptr_conv;
10483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10484 this_ptr_conv.is_owned = false;
10485 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
10489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10490 LDKChannelConfig this_ptr_conv;
10491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10492 this_ptr_conv.is_owned = false;
10493 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
10496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
10497 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
10498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10500 long ret_ref = (long)ret_var.inner;
10501 if (ret_var.is_owned) {
10507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10508 LDKChannelConfig orig_conv;
10509 orig_conv.inner = (void*)(orig & (~1));
10510 orig_conv.is_owned = false;
10511 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
10512 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10513 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10514 long ret_ref = (long)ret_var.inner;
10515 if (ret_var.is_owned) {
10521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
10522 LDKChannelConfig ret_var = ChannelConfig_default();
10523 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10524 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10525 long ret_ref = (long)ret_var.inner;
10526 if (ret_var.is_owned) {
10532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
10533 LDKChannelConfig obj_conv;
10534 obj_conv.inner = (void*)(obj & (~1));
10535 obj_conv.is_owned = false;
10536 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
10537 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10538 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10539 CVec_u8Z_free(ret_var);
10543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10544 LDKu8slice ser_ref;
10545 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10546 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10547 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10548 *ret_conv = ChannelConfig_read(ser_ref);
10549 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10550 return (long)ret_conv;
10553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10554 LDKUserConfig this_obj_conv;
10555 this_obj_conv.inner = (void*)(this_obj & (~1));
10556 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10557 UserConfig_free(this_obj_conv);
10560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
10561 LDKUserConfig this_ptr_conv;
10562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10563 this_ptr_conv.is_owned = false;
10564 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
10565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10567 long ret_ref = (long)ret_var.inner;
10568 if (ret_var.is_owned) {
10574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10575 LDKUserConfig this_ptr_conv;
10576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10577 this_ptr_conv.is_owned = false;
10578 LDKChannelHandshakeConfig val_conv;
10579 val_conv.inner = (void*)(val & (~1));
10580 val_conv.is_owned = (val & 1) || (val == 0);
10581 val_conv = ChannelHandshakeConfig_clone(&val_conv);
10582 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
10585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
10586 LDKUserConfig this_ptr_conv;
10587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10588 this_ptr_conv.is_owned = false;
10589 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
10590 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10591 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10592 long ret_ref = (long)ret_var.inner;
10593 if (ret_var.is_owned) {
10599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10600 LDKUserConfig this_ptr_conv;
10601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10602 this_ptr_conv.is_owned = false;
10603 LDKChannelHandshakeLimits val_conv;
10604 val_conv.inner = (void*)(val & (~1));
10605 val_conv.is_owned = (val & 1) || (val == 0);
10606 val_conv = ChannelHandshakeLimits_clone(&val_conv);
10607 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
10610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
10611 LDKUserConfig this_ptr_conv;
10612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10613 this_ptr_conv.is_owned = false;
10614 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
10615 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10616 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10617 long ret_ref = (long)ret_var.inner;
10618 if (ret_var.is_owned) {
10624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10625 LDKUserConfig this_ptr_conv;
10626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10627 this_ptr_conv.is_owned = false;
10628 LDKChannelConfig val_conv;
10629 val_conv.inner = (void*)(val & (~1));
10630 val_conv.is_owned = (val & 1) || (val == 0);
10631 val_conv = ChannelConfig_clone(&val_conv);
10632 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
10635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg) {
10636 LDKChannelHandshakeConfig own_channel_config_arg_conv;
10637 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
10638 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
10639 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
10640 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
10641 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
10642 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
10643 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
10644 LDKChannelConfig channel_options_arg_conv;
10645 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
10646 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
10647 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
10648 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
10649 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10650 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10651 long ret_ref = (long)ret_var.inner;
10652 if (ret_var.is_owned) {
10658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10659 LDKUserConfig orig_conv;
10660 orig_conv.inner = (void*)(orig & (~1));
10661 orig_conv.is_owned = false;
10662 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
10663 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10664 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10665 long ret_ref = (long)ret_var.inner;
10666 if (ret_var.is_owned) {
10672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
10673 LDKUserConfig ret_var = UserConfig_default();
10674 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10675 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10676 long ret_ref = (long)ret_var.inner;
10677 if (ret_var.is_owned) {
10683 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10684 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
10685 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
10689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10690 if ((this_ptr & 1) != 0) return;
10691 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
10692 FREE((void*)this_ptr);
10693 Access_free(this_ptr_conv);
10696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10697 if ((this_ptr & 1) != 0) return;
10698 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
10699 FREE((void*)this_ptr);
10700 Listen_free(this_ptr_conv);
10703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10704 if ((this_ptr & 1) != 0) return;
10705 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
10706 FREE((void*)this_ptr);
10707 Watch_free(this_ptr_conv);
10710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10711 if ((this_ptr & 1) != 0) return;
10712 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
10713 FREE((void*)this_ptr);
10714 Filter_free(this_ptr_conv);
10717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10718 LDKWatchedOutput this_obj_conv;
10719 this_obj_conv.inner = (void*)(this_obj & (~1));
10720 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10721 WatchedOutput_free(this_obj_conv);
10724 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
10725 LDKWatchedOutput this_ptr_conv;
10726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10727 this_ptr_conv.is_owned = false;
10728 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10729 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
10733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10734 LDKWatchedOutput this_ptr_conv;
10735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10736 this_ptr_conv.is_owned = false;
10737 LDKThirtyTwoBytes val_ref;
10738 CHECK((*env)->GetArrayLength(env, val) == 32);
10739 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10740 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
10743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10744 LDKWatchedOutput this_ptr_conv;
10745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10746 this_ptr_conv.is_owned = false;
10747 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
10748 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10749 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10750 long ret_ref = (long)ret_var.inner;
10751 if (ret_var.is_owned) {
10757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10758 LDKWatchedOutput this_ptr_conv;
10759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10760 this_ptr_conv.is_owned = false;
10761 LDKOutPoint val_conv;
10762 val_conv.inner = (void*)(val & (~1));
10763 val_conv.is_owned = (val & 1) || (val == 0);
10764 val_conv = OutPoint_clone(&val_conv);
10765 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
10768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10769 LDKWatchedOutput this_ptr_conv;
10770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10771 this_ptr_conv.is_owned = false;
10772 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
10773 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10774 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10779 LDKWatchedOutput this_ptr_conv;
10780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10781 this_ptr_conv.is_owned = false;
10782 LDKCVec_u8Z val_ref;
10783 val_ref.datalen = (*env)->GetArrayLength(env, val);
10784 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
10785 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
10786 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
10789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
10790 LDKThirtyTwoBytes block_hash_arg_ref;
10791 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
10792 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
10793 LDKOutPoint outpoint_arg_conv;
10794 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10795 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10796 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10797 LDKCVec_u8Z script_pubkey_arg_ref;
10798 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
10799 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
10800 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
10801 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
10802 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10803 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10804 long ret_ref = (long)ret_var.inner;
10805 if (ret_var.is_owned) {
10811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10812 if ((this_ptr & 1) != 0) return;
10813 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
10814 FREE((void*)this_ptr);
10815 BroadcasterInterface_free(this_ptr_conv);
10818 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10819 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
10820 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
10824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10825 if ((this_ptr & 1) != 0) return;
10826 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
10827 FREE((void*)this_ptr);
10828 FeeEstimator_free(this_ptr_conv);
10831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10832 LDKChainMonitor this_obj_conv;
10833 this_obj_conv.inner = (void*)(this_obj & (~1));
10834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10835 ChainMonitor_free(this_obj_conv);
10838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
10839 LDKChainMonitor this_arg_conv;
10840 this_arg_conv.inner = (void*)(this_arg & (~1));
10841 this_arg_conv.is_owned = false;
10842 unsigned char header_arr[80];
10843 CHECK((*env)->GetArrayLength(env, header) == 80);
10844 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10845 unsigned char (*header_ref)[80] = &header_arr;
10846 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10847 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10848 if (txdata_constr.datalen > 0)
10849 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10851 txdata_constr.data = NULL;
10852 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10853 for (size_t y = 0; y < txdata_constr.datalen; y++) {
10854 int64_t txdata_conv_24 = txdata_vals[y];
10855 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
10856 FREE((void*)txdata_conv_24);
10857 txdata_constr.data[y] = txdata_conv_24_conv;
10859 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10860 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
10863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t disconnected_height) {
10864 LDKChainMonitor this_arg_conv;
10865 this_arg_conv.inner = (void*)(this_arg & (~1));
10866 this_arg_conv.is_owned = false;
10867 unsigned char header_arr[80];
10868 CHECK((*env)->GetArrayLength(env, header) == 80);
10869 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10870 unsigned char (*header_ref)[80] = &header_arr;
10871 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
10874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *env, jclass clz, int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
10875 LDKFilter *chain_source_conv_ptr = NULL;
10876 if (chain_source != 0) {
10877 LDKFilter chain_source_conv;
10878 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
10879 if (chain_source_conv.free == LDKFilter_JCalls_free) {
10880 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10881 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
10883 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10884 *chain_source_conv_ptr = chain_source_conv;
10886 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10887 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10888 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10889 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10891 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10892 if (logger_conv.free == LDKLogger_JCalls_free) {
10893 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10894 LDKLogger_JCalls_clone(logger_conv.this_arg);
10896 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
10897 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
10898 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10899 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
10901 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
10902 if (persister_conv.free == LDKPersist_JCalls_free) {
10903 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10904 LDKPersist_JCalls_clone(persister_conv.this_arg);
10906 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
10907 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10908 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10909 long ret_ref = (long)ret_var.inner;
10910 if (ret_var.is_owned) {
10916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
10917 LDKChainMonitor this_arg_conv;
10918 this_arg_conv.inner = (void*)(this_arg & (~1));
10919 this_arg_conv.is_owned = false;
10920 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
10921 *ret = ChainMonitor_as_Watch(&this_arg_conv);
10925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
10926 LDKChainMonitor this_arg_conv;
10927 this_arg_conv.inner = (void*)(this_arg & (~1));
10928 this_arg_conv.is_owned = false;
10929 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10930 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
10934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10935 LDKChannelMonitorUpdate this_obj_conv;
10936 this_obj_conv.inner = (void*)(this_obj & (~1));
10937 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10938 ChannelMonitorUpdate_free(this_obj_conv);
10941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10942 LDKChannelMonitorUpdate this_ptr_conv;
10943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10944 this_ptr_conv.is_owned = false;
10945 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
10949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10950 LDKChannelMonitorUpdate this_ptr_conv;
10951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10952 this_ptr_conv.is_owned = false;
10953 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
10956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10957 LDKChannelMonitorUpdate orig_conv;
10958 orig_conv.inner = (void*)(orig & (~1));
10959 orig_conv.is_owned = false;
10960 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
10961 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10962 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10963 long ret_ref = (long)ret_var.inner;
10964 if (ret_var.is_owned) {
10970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
10971 LDKChannelMonitorUpdate obj_conv;
10972 obj_conv.inner = (void*)(obj & (~1));
10973 obj_conv.is_owned = false;
10974 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
10975 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10976 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10977 CVec_u8Z_free(ret_var);
10981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10982 LDKu8slice ser_ref;
10983 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10984 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10985 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10986 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
10987 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10988 return (long)ret_conv;
10991 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10992 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
10993 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
10997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
10998 LDKMonitorUpdateError this_obj_conv;
10999 this_obj_conv.inner = (void*)(this_obj & (~1));
11000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11001 MonitorUpdateError_free(this_obj_conv);
11004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11005 LDKMonitorUpdateError orig_conv;
11006 orig_conv.inner = (void*)(orig & (~1));
11007 orig_conv.is_owned = false;
11008 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
11009 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11010 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11011 long ret_ref = (long)ret_var.inner;
11012 if (ret_var.is_owned) {
11018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11019 if ((this_ptr & 1) != 0) return;
11020 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
11021 FREE((void*)this_ptr);
11022 MonitorEvent_free(this_ptr_conv);
11025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11026 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
11027 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
11028 *ret_copy = MonitorEvent_clone(orig_conv);
11029 long ret_ref = (long)ret_copy;
11033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11034 LDKHTLCUpdate this_obj_conv;
11035 this_obj_conv.inner = (void*)(this_obj & (~1));
11036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11037 HTLCUpdate_free(this_obj_conv);
11040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11041 LDKHTLCUpdate orig_conv;
11042 orig_conv.inner = (void*)(orig & (~1));
11043 orig_conv.is_owned = false;
11044 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
11045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11047 long ret_ref = (long)ret_var.inner;
11048 if (ret_var.is_owned) {
11054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
11055 LDKHTLCUpdate obj_conv;
11056 obj_conv.inner = (void*)(obj & (~1));
11057 obj_conv.is_owned = false;
11058 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
11059 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11060 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11061 CVec_u8Z_free(ret_var);
11065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11066 LDKu8slice ser_ref;
11067 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11068 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11069 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11070 *ret_conv = HTLCUpdate_read(ser_ref);
11071 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11072 return (long)ret_conv;
11075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11076 LDKChannelMonitor this_obj_conv;
11077 this_obj_conv.inner = (void*)(this_obj & (~1));
11078 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11079 ChannelMonitor_free(this_obj_conv);
11082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11083 LDKChannelMonitor orig_conv;
11084 orig_conv.inner = (void*)(orig & (~1));
11085 orig_conv.is_owned = false;
11086 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
11087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11089 long ret_ref = (long)ret_var.inner;
11090 if (ret_var.is_owned) {
11096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
11097 LDKChannelMonitor obj_conv;
11098 obj_conv.inner = (void*)(obj & (~1));
11099 obj_conv.is_owned = false;
11100 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
11101 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11102 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11103 CVec_u8Z_free(ret_var);
11107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
11108 LDKChannelMonitor this_arg_conv;
11109 this_arg_conv.inner = (void*)(this_arg & (~1));
11110 this_arg_conv.is_owned = false;
11111 LDKChannelMonitorUpdate updates_conv;
11112 updates_conv.inner = (void*)(updates & (~1));
11113 updates_conv.is_owned = false;
11114 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
11115 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
11116 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
11117 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11118 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
11119 return (long)ret_conv;
11122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11123 LDKChannelMonitor this_arg_conv;
11124 this_arg_conv.inner = (void*)(this_arg & (~1));
11125 this_arg_conv.is_owned = false;
11126 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
11130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
11131 LDKChannelMonitor this_arg_conv;
11132 this_arg_conv.inner = (void*)(this_arg & (~1));
11133 this_arg_conv.is_owned = false;
11134 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11135 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
11136 return (long)ret_ref;
11139 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
11140 LDKChannelMonitor this_arg_conv;
11141 this_arg_conv.inner = (void*)(this_arg & (~1));
11142 this_arg_conv.is_owned = false;
11143 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
11144 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11145 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11146 for (size_t v = 0; v < ret_var.datalen; v++) {
11147 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11148 *ret_conv_47_ref = ret_var.data[v];
11149 ret_arr_ptr[v] = (long)ret_conv_47_ref;
11151 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11152 FREE(ret_var.data);
11156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
11157 LDKChannelMonitor this_arg_conv;
11158 this_arg_conv.inner = (void*)(this_arg & (~1));
11159 this_arg_conv.is_owned = false;
11160 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
11161 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
11164 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
11165 LDKChannelMonitor this_arg_conv;
11166 this_arg_conv.inner = (void*)(this_arg & (~1));
11167 this_arg_conv.is_owned = false;
11168 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
11169 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11170 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11171 for (size_t o = 0; o < ret_var.datalen; o++) {
11172 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
11173 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
11174 long ret_conv_14_ref = (long)ret_conv_14_copy;
11175 ret_arr_ptr[o] = ret_conv_14_ref;
11177 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11178 FREE(ret_var.data);
11182 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
11183 LDKChannelMonitor this_arg_conv;
11184 this_arg_conv.inner = (void*)(this_arg & (~1));
11185 this_arg_conv.is_owned = false;
11186 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
11187 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11188 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11189 for (size_t h = 0; h < ret_var.datalen; h++) {
11190 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11191 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
11192 long ret_conv_7_ref = (long)ret_conv_7_copy;
11193 ret_arr_ptr[h] = ret_conv_7_ref;
11195 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11196 FREE(ret_var.data);
11200 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
11201 LDKChannelMonitor this_arg_conv;
11202 this_arg_conv.inner = (void*)(this_arg & (~1));
11203 this_arg_conv.is_owned = false;
11204 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
11205 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
11206 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11208 for (size_t i = 0; i < ret_var.datalen; i++) {
11209 LDKTransaction ret_conv_8_var = ret_var.data[i];
11210 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
11211 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
11212 Transaction_free(ret_conv_8_var);
11213 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
11215 FREE(ret_var.data);
11219 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
11220 LDKChannelMonitor this_arg_conv;
11221 this_arg_conv.inner = (void*)(this_arg & (~1));
11222 this_arg_conv.is_owned = false;
11223 unsigned char header_arr[80];
11224 CHECK((*env)->GetArrayLength(env, header) == 80);
11225 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11226 unsigned char (*header_ref)[80] = &header_arr;
11227 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11228 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11229 if (txdata_constr.datalen > 0)
11230 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11232 txdata_constr.data = NULL;
11233 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11234 for (size_t y = 0; y < txdata_constr.datalen; y++) {
11235 int64_t txdata_conv_24 = txdata_vals[y];
11236 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
11237 FREE((void*)txdata_conv_24);
11238 txdata_constr.data[y] = txdata_conv_24_conv;
11240 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11241 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
11242 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
11243 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11244 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
11246 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
11247 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
11248 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11249 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
11251 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11252 if (logger_conv.free == LDKLogger_JCalls_free) {
11253 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11254 LDKLogger_JCalls_clone(logger_conv.this_arg);
11256 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
11257 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11258 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11259 for (size_t u = 0; u < ret_var.datalen; u++) {
11260 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11261 *ret_conv_46_ref = ret_var.data[u];
11262 ret_arr_ptr[u] = (long)ret_conv_46_ref;
11264 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11265 FREE(ret_var.data);
11269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
11270 LDKChannelMonitor this_arg_conv;
11271 this_arg_conv.inner = (void*)(this_arg & (~1));
11272 this_arg_conv.is_owned = false;
11273 unsigned char header_arr[80];
11274 CHECK((*env)->GetArrayLength(env, header) == 80);
11275 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11276 unsigned char (*header_ref)[80] = &header_arr;
11277 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
11278 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
11279 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11280 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
11282 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
11283 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
11284 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11285 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
11287 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11288 if (logger_conv.free == LDKLogger_JCalls_free) {
11289 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11290 LDKLogger_JCalls_clone(logger_conv.this_arg);
11292 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
11295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11296 if ((this_ptr & 1) != 0) return;
11297 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
11298 FREE((void*)this_ptr);
11299 Persist_free(this_ptr_conv);
11302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
11303 LDKu8slice ser_ref;
11304 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11305 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11306 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
11307 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11308 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
11309 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11310 return (long)ret_conv;
11313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11314 LDKOutPoint this_obj_conv;
11315 this_obj_conv.inner = (void*)(this_obj & (~1));
11316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11317 OutPoint_free(this_obj_conv);
11320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
11321 LDKOutPoint this_ptr_conv;
11322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11323 this_ptr_conv.is_owned = false;
11324 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11325 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
11329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11330 LDKOutPoint this_ptr_conv;
11331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11332 this_ptr_conv.is_owned = false;
11333 LDKThirtyTwoBytes val_ref;
11334 CHECK((*env)->GetArrayLength(env, val) == 32);
11335 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11336 OutPoint_set_txid(&this_ptr_conv, val_ref);
11339 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
11340 LDKOutPoint this_ptr_conv;
11341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11342 this_ptr_conv.is_owned = false;
11343 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
11347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11348 LDKOutPoint this_ptr_conv;
11349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11350 this_ptr_conv.is_owned = false;
11351 OutPoint_set_index(&this_ptr_conv, val);
11354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
11355 LDKThirtyTwoBytes txid_arg_ref;
11356 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
11357 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
11358 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
11359 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11360 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11361 long ret_ref = (long)ret_var.inner;
11362 if (ret_var.is_owned) {
11368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11369 LDKOutPoint orig_conv;
11370 orig_conv.inner = (void*)(orig & (~1));
11371 orig_conv.is_owned = false;
11372 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
11373 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11374 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11375 long ret_ref = (long)ret_var.inner;
11376 if (ret_var.is_owned) {
11382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11383 LDKOutPoint this_arg_conv;
11384 this_arg_conv.inner = (void*)(this_arg & (~1));
11385 this_arg_conv.is_owned = false;
11386 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11387 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
11391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
11392 LDKOutPoint obj_conv;
11393 obj_conv.inner = (void*)(obj & (~1));
11394 obj_conv.is_owned = false;
11395 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
11396 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11397 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11398 CVec_u8Z_free(ret_var);
11402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11403 LDKu8slice ser_ref;
11404 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11405 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11406 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11407 *ret_conv = OutPoint_read(ser_ref);
11408 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11409 return (long)ret_conv;
11412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11413 LDKDelayedPaymentOutputDescriptor this_obj_conv;
11414 this_obj_conv.inner = (void*)(this_obj & (~1));
11415 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11416 DelayedPaymentOutputDescriptor_free(this_obj_conv);
11419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11420 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11422 this_ptr_conv.is_owned = false;
11423 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
11424 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11425 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11426 long ret_ref = (long)ret_var.inner;
11427 if (ret_var.is_owned) {
11433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11434 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11436 this_ptr_conv.is_owned = false;
11437 LDKOutPoint val_conv;
11438 val_conv.inner = (void*)(val & (~1));
11439 val_conv.is_owned = (val & 1) || (val == 0);
11440 val_conv = OutPoint_clone(&val_conv);
11441 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
11444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11445 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11447 this_ptr_conv.is_owned = false;
11448 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11449 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
11453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11454 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11456 this_ptr_conv.is_owned = false;
11457 LDKPublicKey val_ref;
11458 CHECK((*env)->GetArrayLength(env, val) == 33);
11459 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11460 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
11463 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
11464 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11466 this_ptr_conv.is_owned = false;
11467 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
11471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11472 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11474 this_ptr_conv.is_owned = false;
11475 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
11478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11479 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11481 this_ptr_conv.is_owned = false;
11482 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
11484 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
11487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
11488 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11490 this_ptr_conv.is_owned = false;
11491 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11492 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
11496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11497 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11499 this_ptr_conv.is_owned = false;
11500 LDKPublicKey val_ref;
11501 CHECK((*env)->GetArrayLength(env, val) == 33);
11502 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11503 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
11506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11507 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11509 this_ptr_conv.is_owned = false;
11510 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11511 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
11515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11516 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11518 this_ptr_conv.is_owned = false;
11519 LDKThirtyTwoBytes val_ref;
11520 CHECK((*env)->GetArrayLength(env, val) == 32);
11521 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11522 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
11525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11526 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11528 this_ptr_conv.is_owned = false;
11529 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
11533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11534 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
11535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11536 this_ptr_conv.is_owned = false;
11537 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
11540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
11541 LDKOutPoint outpoint_arg_conv;
11542 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11543 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11544 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11545 LDKPublicKey per_commitment_point_arg_ref;
11546 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
11547 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
11548 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
11549 FREE((void*)output_arg);
11550 LDKPublicKey revocation_pubkey_arg_ref;
11551 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
11552 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
11553 LDKThirtyTwoBytes channel_keys_id_arg_ref;
11554 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
11555 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
11556 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
11557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11559 long ret_ref = (long)ret_var.inner;
11560 if (ret_var.is_owned) {
11566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11567 LDKDelayedPaymentOutputDescriptor orig_conv;
11568 orig_conv.inner = (void*)(orig & (~1));
11569 orig_conv.is_owned = false;
11570 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
11571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11573 long ret_ref = (long)ret_var.inner;
11574 if (ret_var.is_owned) {
11580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11581 LDKStaticPaymentOutputDescriptor this_obj_conv;
11582 this_obj_conv.inner = (void*)(this_obj & (~1));
11583 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11584 StaticPaymentOutputDescriptor_free(this_obj_conv);
11587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11588 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11590 this_ptr_conv.is_owned = false;
11591 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
11592 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11593 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11594 long ret_ref = (long)ret_var.inner;
11595 if (ret_var.is_owned) {
11601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11602 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11604 this_ptr_conv.is_owned = false;
11605 LDKOutPoint val_conv;
11606 val_conv.inner = (void*)(val & (~1));
11607 val_conv.is_owned = (val & 1) || (val == 0);
11608 val_conv = OutPoint_clone(&val_conv);
11609 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
11612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11613 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11615 this_ptr_conv.is_owned = false;
11616 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
11618 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
11621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11622 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11624 this_ptr_conv.is_owned = false;
11625 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11626 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
11630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11631 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11633 this_ptr_conv.is_owned = false;
11634 LDKThirtyTwoBytes val_ref;
11635 CHECK((*env)->GetArrayLength(env, val) == 32);
11636 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11637 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
11640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11641 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11643 this_ptr_conv.is_owned = false;
11644 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
11648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11649 LDKStaticPaymentOutputDescriptor this_ptr_conv;
11650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11651 this_ptr_conv.is_owned = false;
11652 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
11655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
11656 LDKOutPoint outpoint_arg_conv;
11657 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
11658 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
11659 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
11660 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
11661 FREE((void*)output_arg);
11662 LDKThirtyTwoBytes channel_keys_id_arg_ref;
11663 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
11664 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
11665 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
11666 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11667 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11668 long ret_ref = (long)ret_var.inner;
11669 if (ret_var.is_owned) {
11675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11676 LDKStaticPaymentOutputDescriptor orig_conv;
11677 orig_conv.inner = (void*)(orig & (~1));
11678 orig_conv.is_owned = false;
11679 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
11680 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11681 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11682 long ret_ref = (long)ret_var.inner;
11683 if (ret_var.is_owned) {
11689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11690 if ((this_ptr & 1) != 0) return;
11691 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
11692 FREE((void*)this_ptr);
11693 SpendableOutputDescriptor_free(this_ptr_conv);
11696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11697 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
11698 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
11699 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
11700 long ret_ref = (long)ret_copy;
11704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
11705 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
11706 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
11707 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11708 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11709 CVec_u8Z_free(ret_var);
11713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11714 LDKu8slice ser_ref;
11715 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11716 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11717 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11718 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
11719 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11720 return (long)ret_conv;
11723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11724 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
11725 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
11726 *ret = Sign_clone(orig_conv);
11730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11731 if ((this_ptr & 1) != 0) return;
11732 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
11733 FREE((void*)this_ptr);
11734 Sign_free(this_ptr_conv);
11737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11738 if ((this_ptr & 1) != 0) return;
11739 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
11740 FREE((void*)this_ptr);
11741 KeysInterface_free(this_ptr_conv);
11744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
11745 LDKInMemorySigner this_obj_conv;
11746 this_obj_conv.inner = (void*)(this_obj & (~1));
11747 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11748 InMemorySigner_free(this_obj_conv);
11751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11752 LDKInMemorySigner this_ptr_conv;
11753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11754 this_ptr_conv.is_owned = false;
11755 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11756 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
11760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11761 LDKInMemorySigner this_ptr_conv;
11762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11763 this_ptr_conv.is_owned = false;
11764 LDKSecretKey val_ref;
11765 CHECK((*env)->GetArrayLength(env, val) == 32);
11766 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11767 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
11770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11771 LDKInMemorySigner this_ptr_conv;
11772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11773 this_ptr_conv.is_owned = false;
11774 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11775 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
11779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11780 LDKInMemorySigner this_ptr_conv;
11781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11782 this_ptr_conv.is_owned = false;
11783 LDKSecretKey val_ref;
11784 CHECK((*env)->GetArrayLength(env, val) == 32);
11785 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11786 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
11789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11790 LDKInMemorySigner this_ptr_conv;
11791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11792 this_ptr_conv.is_owned = false;
11793 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11794 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
11798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11799 LDKInMemorySigner this_ptr_conv;
11800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11801 this_ptr_conv.is_owned = false;
11802 LDKSecretKey val_ref;
11803 CHECK((*env)->GetArrayLength(env, val) == 32);
11804 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11805 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
11808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11809 LDKInMemorySigner this_ptr_conv;
11810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11811 this_ptr_conv.is_owned = false;
11812 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11813 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
11817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11818 LDKInMemorySigner this_ptr_conv;
11819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11820 this_ptr_conv.is_owned = false;
11821 LDKSecretKey val_ref;
11822 CHECK((*env)->GetArrayLength(env, val) == 32);
11823 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11824 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
11827 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
11828 LDKInMemorySigner this_ptr_conv;
11829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11830 this_ptr_conv.is_owned = false;
11831 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11832 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
11836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11837 LDKInMemorySigner this_ptr_conv;
11838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11839 this_ptr_conv.is_owned = false;
11840 LDKSecretKey val_ref;
11841 CHECK((*env)->GetArrayLength(env, val) == 32);
11842 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
11843 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
11846 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
11847 LDKInMemorySigner this_ptr_conv;
11848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11849 this_ptr_conv.is_owned = false;
11850 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11851 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
11855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11856 LDKInMemorySigner this_ptr_conv;
11857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11858 this_ptr_conv.is_owned = false;
11859 LDKThirtyTwoBytes val_ref;
11860 CHECK((*env)->GetArrayLength(env, val) == 32);
11861 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11862 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
11865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11866 LDKInMemorySigner orig_conv;
11867 orig_conv.inner = (void*)(orig & (~1));
11868 orig_conv.is_owned = false;
11869 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
11870 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11871 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11872 long ret_ref = (long)ret_var.inner;
11873 if (ret_var.is_owned) {
11879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
11880 LDKSecretKey funding_key_ref;
11881 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
11882 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
11883 LDKSecretKey revocation_base_key_ref;
11884 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
11885 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
11886 LDKSecretKey payment_key_ref;
11887 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
11888 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
11889 LDKSecretKey delayed_payment_base_key_ref;
11890 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
11891 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
11892 LDKSecretKey htlc_base_key_ref;
11893 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
11894 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
11895 LDKThirtyTwoBytes commitment_seed_ref;
11896 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
11897 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
11898 LDKThirtyTwoBytes channel_keys_id_ref;
11899 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
11900 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
11901 LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref);
11902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11904 long ret_ref = (long)ret_var.inner;
11905 if (ret_var.is_owned) {
11911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
11912 LDKInMemorySigner this_arg_conv;
11913 this_arg_conv.inner = (void*)(this_arg & (~1));
11914 this_arg_conv.is_owned = false;
11915 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
11916 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11917 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11918 long ret_ref = (long)ret_var.inner;
11919 if (ret_var.is_owned) {
11925 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
11926 LDKInMemorySigner this_arg_conv;
11927 this_arg_conv.inner = (void*)(this_arg & (~1));
11928 this_arg_conv.is_owned = false;
11929 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
11933 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
11934 LDKInMemorySigner this_arg_conv;
11935 this_arg_conv.inner = (void*)(this_arg & (~1));
11936 this_arg_conv.is_owned = false;
11937 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
11941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
11942 LDKInMemorySigner this_arg_conv;
11943 this_arg_conv.inner = (void*)(this_arg & (~1));
11944 this_arg_conv.is_owned = false;
11945 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
11949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
11950 LDKInMemorySigner this_arg_conv;
11951 this_arg_conv.inner = (void*)(this_arg & (~1));
11952 this_arg_conv.is_owned = false;
11953 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
11954 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11955 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11956 long ret_ref = (long)ret_var.inner;
11957 if (ret_var.is_owned) {
11963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
11964 LDKInMemorySigner this_arg_conv;
11965 this_arg_conv.inner = (void*)(this_arg & (~1));
11966 this_arg_conv.is_owned = false;
11967 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
11968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11970 long ret_ref = (long)ret_var.inner;
11971 if (ret_var.is_owned) {
11977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
11978 LDKInMemorySigner this_arg_conv;
11979 this_arg_conv.inner = (void*)(this_arg & (~1));
11980 this_arg_conv.is_owned = false;
11981 LDKTransaction spend_tx_ref;
11982 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
11983 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
11984 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
11985 spend_tx_ref.data_is_owned = true;
11986 LDKStaticPaymentOutputDescriptor descriptor_conv;
11987 descriptor_conv.inner = (void*)(descriptor & (~1));
11988 descriptor_conv.is_owned = false;
11989 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11990 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
11991 return (long)ret_conv;
11994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
11995 LDKInMemorySigner this_arg_conv;
11996 this_arg_conv.inner = (void*)(this_arg & (~1));
11997 this_arg_conv.is_owned = false;
11998 LDKTransaction spend_tx_ref;
11999 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
12000 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
12001 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
12002 spend_tx_ref.data_is_owned = true;
12003 LDKDelayedPaymentOutputDescriptor descriptor_conv;
12004 descriptor_conv.inner = (void*)(descriptor & (~1));
12005 descriptor_conv.is_owned = false;
12006 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
12007 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
12008 return (long)ret_conv;
12011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
12012 LDKInMemorySigner this_arg_conv;
12013 this_arg_conv.inner = (void*)(this_arg & (~1));
12014 this_arg_conv.is_owned = false;
12015 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
12016 *ret = InMemorySigner_as_Sign(&this_arg_conv);
12020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
12021 LDKInMemorySigner obj_conv;
12022 obj_conv.inner = (void*)(obj & (~1));
12023 obj_conv.is_owned = false;
12024 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
12025 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12026 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12027 CVec_u8Z_free(ret_var);
12031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
12032 LDKu8slice ser_ref;
12033 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
12034 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
12035 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
12036 *ret_conv = InMemorySigner_read(ser_ref);
12037 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
12038 return (long)ret_conv;
12041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12042 LDKKeysManager this_obj_conv;
12043 this_obj_conv.inner = (void*)(this_obj & (~1));
12044 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12045 KeysManager_free(this_obj_conv);
12048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
12049 unsigned char seed_arr[32];
12050 CHECK((*env)->GetArrayLength(env, seed) == 32);
12051 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
12052 unsigned char (*seed_ref)[32] = &seed_arr;
12053 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
12054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12056 long ret_ref = (long)ret_var.inner;
12057 if (ret_var.is_owned) {
12063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
12064 LDKKeysManager this_arg_conv;
12065 this_arg_conv.inner = (void*)(this_arg & (~1));
12066 this_arg_conv.is_owned = false;
12067 unsigned char params_arr[32];
12068 CHECK((*env)->GetArrayLength(env, params) == 32);
12069 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
12070 unsigned char (*params_ref)[32] = ¶ms_arr;
12071 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
12072 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12073 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12074 long ret_ref = (long)ret_var.inner;
12075 if (ret_var.is_owned) {
12081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
12082 LDKKeysManager this_arg_conv;
12083 this_arg_conv.inner = (void*)(this_arg & (~1));
12084 this_arg_conv.is_owned = false;
12085 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
12086 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
12087 if (descriptors_constr.datalen > 0)
12088 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12090 descriptors_constr.data = NULL;
12091 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
12092 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
12093 int64_t descriptors_conv_27 = descriptors_vals[b];
12094 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
12095 FREE((void*)descriptors_conv_27);
12096 descriptors_constr.data[b] = descriptors_conv_27_conv;
12098 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
12099 LDKCVec_TxOutZ outputs_constr;
12100 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
12101 if (outputs_constr.datalen > 0)
12102 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
12104 outputs_constr.data = NULL;
12105 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
12106 for (size_t h = 0; h < outputs_constr.datalen; h++) {
12107 int64_t outputs_conv_7 = outputs_vals[h];
12108 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
12109 FREE((void*)outputs_conv_7);
12110 outputs_constr.data[h] = outputs_conv_7_conv;
12112 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
12113 LDKCVec_u8Z change_destination_script_ref;
12114 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
12115 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
12116 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
12117 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
12118 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
12119 return (long)ret_conv;
12122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
12123 LDKKeysManager this_arg_conv;
12124 this_arg_conv.inner = (void*)(this_arg & (~1));
12125 this_arg_conv.is_owned = false;
12126 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
12127 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
12131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12132 LDKChannelManager this_obj_conv;
12133 this_obj_conv.inner = (void*)(this_obj & (~1));
12134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12135 ChannelManager_free(this_obj_conv);
12138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12139 LDKChainParameters this_obj_conv;
12140 this_obj_conv.inner = (void*)(this_obj & (~1));
12141 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12142 ChainParameters_free(this_obj_conv);
12145 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
12146 LDKChainParameters this_ptr_conv;
12147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12148 this_ptr_conv.is_owned = false;
12149 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
12153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
12154 LDKChainParameters this_ptr_conv;
12155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12156 this_ptr_conv.is_owned = false;
12157 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
12158 ChainParameters_set_network(&this_ptr_conv, val_conv);
12161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1latest_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12162 LDKChainParameters this_ptr_conv;
12163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12164 this_ptr_conv.is_owned = false;
12165 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12166 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChainParameters_get_latest_hash(&this_ptr_conv));
12170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1latest_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12171 LDKChainParameters this_ptr_conv;
12172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12173 this_ptr_conv.is_owned = false;
12174 LDKThirtyTwoBytes val_ref;
12175 CHECK((*env)->GetArrayLength(env, val) == 32);
12176 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12177 ChainParameters_set_latest_hash(&this_ptr_conv, val_ref);
12180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1latest_1height(JNIEnv *env, jclass clz, int64_t this_ptr) {
12181 LDKChainParameters this_ptr_conv;
12182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12183 this_ptr_conv.is_owned = false;
12184 int64_t ret_val = ChainParameters_get_latest_height(&this_ptr_conv);
12188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1latest_1height(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12189 LDKChainParameters this_ptr_conv;
12190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12191 this_ptr_conv.is_owned = false;
12192 ChainParameters_set_latest_height(&this_ptr_conv, val);
12195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int8_tArray latest_hash_arg, int64_t latest_height_arg) {
12196 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
12197 LDKThirtyTwoBytes latest_hash_arg_ref;
12198 CHECK((*env)->GetArrayLength(env, latest_hash_arg) == 32);
12199 (*env)->GetByteArrayRegion(env, latest_hash_arg, 0, 32, latest_hash_arg_ref.data);
12200 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, latest_hash_arg_ref, latest_height_arg);
12201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12203 long ret_ref = (long)ret_var.inner;
12204 if (ret_var.is_owned) {
12210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12211 LDKChannelDetails this_obj_conv;
12212 this_obj_conv.inner = (void*)(this_obj & (~1));
12213 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12214 ChannelDetails_free(this_obj_conv);
12217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12218 LDKChannelDetails this_ptr_conv;
12219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12220 this_ptr_conv.is_owned = false;
12221 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12222 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
12226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12227 LDKChannelDetails this_ptr_conv;
12228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12229 this_ptr_conv.is_owned = false;
12230 LDKThirtyTwoBytes val_ref;
12231 CHECK((*env)->GetArrayLength(env, val) == 32);
12232 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12233 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
12236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12237 LDKChannelDetails this_ptr_conv;
12238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12239 this_ptr_conv.is_owned = false;
12240 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12241 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
12242 long ret_ref = (long)ret_copy;
12246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12247 LDKChannelDetails this_ptr_conv;
12248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12249 this_ptr_conv.is_owned = false;
12250 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
12252 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
12255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12256 LDKChannelDetails this_ptr_conv;
12257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12258 this_ptr_conv.is_owned = false;
12259 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12260 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
12264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12265 LDKChannelDetails this_ptr_conv;
12266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12267 this_ptr_conv.is_owned = false;
12268 LDKPublicKey val_ref;
12269 CHECK((*env)->GetArrayLength(env, val) == 33);
12270 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12271 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
12274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
12275 LDKChannelDetails this_ptr_conv;
12276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12277 this_ptr_conv.is_owned = false;
12278 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
12279 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12280 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12281 long ret_ref = (long)ret_var.inner;
12282 if (ret_var.is_owned) {
12288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12289 LDKChannelDetails this_ptr_conv;
12290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12291 this_ptr_conv.is_owned = false;
12292 LDKInitFeatures val_conv;
12293 val_conv.inner = (void*)(val & (~1));
12294 val_conv.is_owned = (val & 1) || (val == 0);
12295 val_conv = InitFeatures_clone(&val_conv);
12296 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
12299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12300 LDKChannelDetails this_ptr_conv;
12301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12302 this_ptr_conv.is_owned = false;
12303 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
12307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12308 LDKChannelDetails this_ptr_conv;
12309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12310 this_ptr_conv.is_owned = false;
12311 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
12314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12315 LDKChannelDetails this_ptr_conv;
12316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12317 this_ptr_conv.is_owned = false;
12318 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
12322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12323 LDKChannelDetails this_ptr_conv;
12324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12325 this_ptr_conv.is_owned = false;
12326 ChannelDetails_set_user_id(&this_ptr_conv, val);
12329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12330 LDKChannelDetails this_ptr_conv;
12331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12332 this_ptr_conv.is_owned = false;
12333 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
12337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12338 LDKChannelDetails this_ptr_conv;
12339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12340 this_ptr_conv.is_owned = false;
12341 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
12344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12345 LDKChannelDetails this_ptr_conv;
12346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12347 this_ptr_conv.is_owned = false;
12348 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
12352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12353 LDKChannelDetails this_ptr_conv;
12354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12355 this_ptr_conv.is_owned = false;
12356 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
12359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
12360 LDKChannelDetails this_ptr_conv;
12361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12362 this_ptr_conv.is_owned = false;
12363 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
12367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12368 LDKChannelDetails this_ptr_conv;
12369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12370 this_ptr_conv.is_owned = false;
12371 ChannelDetails_set_is_live(&this_ptr_conv, val);
12374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12375 LDKChannelDetails orig_conv;
12376 orig_conv.inner = (void*)(orig & (~1));
12377 orig_conv.is_owned = false;
12378 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
12379 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12380 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12381 long ret_ref = (long)ret_var.inner;
12382 if (ret_var.is_owned) {
12388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12389 if ((this_ptr & 1) != 0) return;
12390 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
12391 FREE((void*)this_ptr);
12392 PaymentSendFailure_free(this_ptr_conv);
12395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12396 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
12397 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
12398 *ret_copy = PaymentSendFailure_clone(orig_conv);
12399 long ret_ref = (long)ret_copy;
12403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t params) {
12404 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
12405 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
12406 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12407 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
12409 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12410 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
12411 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12412 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
12414 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12415 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
12416 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12417 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
12419 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12420 if (logger_conv.free == LDKLogger_JCalls_free) {
12421 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12422 LDKLogger_JCalls_clone(logger_conv.this_arg);
12424 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12425 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
12426 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12427 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
12429 LDKUserConfig config_conv;
12430 config_conv.inner = (void*)(config & (~1));
12431 config_conv.is_owned = (config & 1) || (config == 0);
12432 config_conv = UserConfig_clone(&config_conv);
12433 LDKChainParameters params_conv;
12434 params_conv.inner = (void*)(params & (~1));
12435 params_conv.is_owned = (params & 1) || (params == 0);
12436 // Warning: we need a move here but no clone is available for LDKChainParameters
12437 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
12438 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12439 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12440 long ret_ref = (long)ret_var.inner;
12441 if (ret_var.is_owned) {
12447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, int64_t override_config) {
12448 LDKChannelManager this_arg_conv;
12449 this_arg_conv.inner = (void*)(this_arg & (~1));
12450 this_arg_conv.is_owned = false;
12451 LDKPublicKey their_network_key_ref;
12452 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
12453 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
12454 LDKUserConfig override_config_conv;
12455 override_config_conv.inner = (void*)(override_config & (~1));
12456 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
12457 override_config_conv = UserConfig_clone(&override_config_conv);
12458 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12459 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
12460 return (long)ret_conv;
12463 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12464 LDKChannelManager this_arg_conv;
12465 this_arg_conv.inner = (void*)(this_arg & (~1));
12466 this_arg_conv.is_owned = false;
12467 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
12468 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12469 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12470 for (size_t q = 0; q < ret_var.datalen; q++) {
12471 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
12472 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12473 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12474 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
12475 if (ret_conv_16_var.is_owned) {
12476 ret_conv_16_ref |= 1;
12478 ret_arr_ptr[q] = ret_conv_16_ref;
12480 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12481 FREE(ret_var.data);
12485 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12486 LDKChannelManager this_arg_conv;
12487 this_arg_conv.inner = (void*)(this_arg & (~1));
12488 this_arg_conv.is_owned = false;
12489 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
12490 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12491 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12492 for (size_t q = 0; q < ret_var.datalen; q++) {
12493 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
12494 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12495 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12496 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
12497 if (ret_conv_16_var.is_owned) {
12498 ret_conv_16_ref |= 1;
12500 ret_arr_ptr[q] = ret_conv_16_ref;
12502 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12503 FREE(ret_var.data);
12507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
12508 LDKChannelManager this_arg_conv;
12509 this_arg_conv.inner = (void*)(this_arg & (~1));
12510 this_arg_conv.is_owned = false;
12511 unsigned char channel_id_arr[32];
12512 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
12513 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
12514 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
12515 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12516 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
12517 return (long)ret_conv;
12520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
12521 LDKChannelManager this_arg_conv;
12522 this_arg_conv.inner = (void*)(this_arg & (~1));
12523 this_arg_conv.is_owned = false;
12524 unsigned char channel_id_arr[32];
12525 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
12526 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
12527 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
12528 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12529 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
12530 return (long)ret_conv;
12533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
12534 LDKChannelManager this_arg_conv;
12535 this_arg_conv.inner = (void*)(this_arg & (~1));
12536 this_arg_conv.is_owned = false;
12537 ChannelManager_force_close_all_channels(&this_arg_conv);
12540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
12541 LDKChannelManager this_arg_conv;
12542 this_arg_conv.inner = (void*)(this_arg & (~1));
12543 this_arg_conv.is_owned = false;
12544 LDKRoute route_conv;
12545 route_conv.inner = (void*)(route & (~1));
12546 route_conv.is_owned = false;
12547 LDKThirtyTwoBytes payment_hash_ref;
12548 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
12549 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
12550 LDKThirtyTwoBytes payment_secret_ref;
12551 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12552 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12553 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12554 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
12555 return (long)ret_conv;
12558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int64_t funding_txo) {
12559 LDKChannelManager this_arg_conv;
12560 this_arg_conv.inner = (void*)(this_arg & (~1));
12561 this_arg_conv.is_owned = false;
12562 unsigned char temporary_channel_id_arr[32];
12563 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
12564 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
12565 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
12566 LDKOutPoint funding_txo_conv;
12567 funding_txo_conv.inner = (void*)(funding_txo & (~1));
12568 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
12569 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
12570 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
12573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
12574 LDKChannelManager this_arg_conv;
12575 this_arg_conv.inner = (void*)(this_arg & (~1));
12576 this_arg_conv.is_owned = false;
12577 LDKThreeBytes rgb_ref;
12578 CHECK((*env)->GetArrayLength(env, rgb) == 3);
12579 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
12580 LDKThirtyTwoBytes alias_ref;
12581 CHECK((*env)->GetArrayLength(env, alias) == 32);
12582 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
12583 LDKCVec_NetAddressZ addresses_constr;
12584 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
12585 if (addresses_constr.datalen > 0)
12586 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12588 addresses_constr.data = NULL;
12589 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
12590 for (size_t m = 0; m < addresses_constr.datalen; m++) {
12591 int64_t addresses_conv_12 = addresses_vals[m];
12592 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
12593 FREE((void*)addresses_conv_12);
12594 addresses_constr.data[m] = addresses_conv_12_conv;
12596 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
12597 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
12600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
12601 LDKChannelManager this_arg_conv;
12602 this_arg_conv.inner = (void*)(this_arg & (~1));
12603 this_arg_conv.is_owned = false;
12604 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
12607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
12608 LDKChannelManager this_arg_conv;
12609 this_arg_conv.inner = (void*)(this_arg & (~1));
12610 this_arg_conv.is_owned = false;
12611 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
12614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
12615 LDKChannelManager this_arg_conv;
12616 this_arg_conv.inner = (void*)(this_arg & (~1));
12617 this_arg_conv.is_owned = false;
12618 unsigned char payment_hash_arr[32];
12619 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
12620 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
12621 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
12622 LDKThirtyTwoBytes payment_secret_ref;
12623 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12624 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12625 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
12629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
12630 LDKChannelManager this_arg_conv;
12631 this_arg_conv.inner = (void*)(this_arg & (~1));
12632 this_arg_conv.is_owned = false;
12633 LDKThirtyTwoBytes payment_preimage_ref;
12634 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
12635 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
12636 LDKThirtyTwoBytes payment_secret_ref;
12637 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12638 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12639 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
12643 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
12644 LDKChannelManager this_arg_conv;
12645 this_arg_conv.inner = (void*)(this_arg & (~1));
12646 this_arg_conv.is_owned = false;
12647 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12648 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
12652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) {
12653 LDKChannelManager this_arg_conv;
12654 this_arg_conv.inner = (void*)(this_arg & (~1));
12655 this_arg_conv.is_owned = false;
12656 LDKOutPoint funding_txo_conv;
12657 funding_txo_conv.inner = (void*)(funding_txo & (~1));
12658 funding_txo_conv.is_owned = false;
12659 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
12662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
12663 LDKChannelManager this_arg_conv;
12664 this_arg_conv.inner = (void*)(this_arg & (~1));
12665 this_arg_conv.is_owned = false;
12666 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
12667 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
12671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
12672 LDKChannelManager this_arg_conv;
12673 this_arg_conv.inner = (void*)(this_arg & (~1));
12674 this_arg_conv.is_owned = false;
12675 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12676 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
12680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
12681 LDKChannelManager this_arg_conv;
12682 this_arg_conv.inner = (void*)(this_arg & (~1));
12683 this_arg_conv.is_owned = false;
12684 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
12685 *ret = ChannelManager_as_Listen(&this_arg_conv);
12689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
12690 LDKChannelManager this_arg_conv;
12691 this_arg_conv.inner = (void*)(this_arg & (~1));
12692 this_arg_conv.is_owned = false;
12693 unsigned char header_arr[80];
12694 CHECK((*env)->GetArrayLength(env, header) == 80);
12695 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12696 unsigned char (*header_ref)[80] = &header_arr;
12697 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12698 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
12699 if (txdata_constr.datalen > 0)
12700 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12702 txdata_constr.data = NULL;
12703 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
12704 for (size_t y = 0; y < txdata_constr.datalen; y++) {
12705 int64_t txdata_conv_24 = txdata_vals[y];
12706 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
12707 FREE((void*)txdata_conv_24);
12708 txdata_constr.data[y] = txdata_conv_24_conv;
12710 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
12711 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
12714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
12715 LDKChannelManager this_arg_conv;
12716 this_arg_conv.inner = (void*)(this_arg & (~1));
12717 this_arg_conv.is_owned = false;
12718 unsigned char header_arr[80];
12719 CHECK((*env)->GetArrayLength(env, header) == 80);
12720 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12721 unsigned char (*header_ref)[80] = &header_arr;
12722 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
12725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
12726 LDKChannelManager this_arg_conv;
12727 this_arg_conv.inner = (void*)(this_arg & (~1));
12728 this_arg_conv.is_owned = false;
12729 ChannelManager_await_persistable_update(&this_arg_conv);
12732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
12733 LDKChannelManager this_arg_conv;
12734 this_arg_conv.inner = (void*)(this_arg & (~1));
12735 this_arg_conv.is_owned = false;
12736 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12737 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
12741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
12742 LDKChannelManager obj_conv;
12743 obj_conv.inner = (void*)(obj & (~1));
12744 obj_conv.is_owned = false;
12745 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
12746 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12747 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12748 CVec_u8Z_free(ret_var);
12752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12753 LDKChannelManagerReadArgs this_obj_conv;
12754 this_obj_conv.inner = (void*)(this_obj & (~1));
12755 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12756 ChannelManagerReadArgs_free(this_obj_conv);
12759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
12760 LDKChannelManagerReadArgs this_ptr_conv;
12761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12762 this_ptr_conv.is_owned = false;
12763 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
12767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12768 LDKChannelManagerReadArgs this_ptr_conv;
12769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12770 this_ptr_conv.is_owned = false;
12771 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
12772 if (val_conv.free == LDKKeysInterface_JCalls_free) {
12773 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12774 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
12776 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
12779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
12780 LDKChannelManagerReadArgs this_ptr_conv;
12781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12782 this_ptr_conv.is_owned = false;
12783 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
12787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12788 LDKChannelManagerReadArgs this_ptr_conv;
12789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12790 this_ptr_conv.is_owned = false;
12791 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
12792 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
12793 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12794 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
12796 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
12799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
12800 LDKChannelManagerReadArgs this_ptr_conv;
12801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12802 this_ptr_conv.is_owned = false;
12803 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
12807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12808 LDKChannelManagerReadArgs this_ptr_conv;
12809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12810 this_ptr_conv.is_owned = false;
12811 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
12812 if (val_conv.free == LDKWatch_JCalls_free) {
12813 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12814 LDKWatch_JCalls_clone(val_conv.this_arg);
12816 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
12819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
12820 LDKChannelManagerReadArgs this_ptr_conv;
12821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12822 this_ptr_conv.is_owned = false;
12823 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
12827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12828 LDKChannelManagerReadArgs this_ptr_conv;
12829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12830 this_ptr_conv.is_owned = false;
12831 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
12832 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
12833 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12834 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
12836 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
12839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
12840 LDKChannelManagerReadArgs this_ptr_conv;
12841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12842 this_ptr_conv.is_owned = false;
12843 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
12847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12848 LDKChannelManagerReadArgs this_ptr_conv;
12849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12850 this_ptr_conv.is_owned = false;
12851 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
12852 if (val_conv.free == LDKLogger_JCalls_free) {
12853 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12854 LDKLogger_JCalls_clone(val_conv.this_arg);
12856 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
12859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
12860 LDKChannelManagerReadArgs this_ptr_conv;
12861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12862 this_ptr_conv.is_owned = false;
12863 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
12864 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12865 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12866 long ret_ref = (long)ret_var.inner;
12867 if (ret_var.is_owned) {
12873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12874 LDKChannelManagerReadArgs this_ptr_conv;
12875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12876 this_ptr_conv.is_owned = false;
12877 LDKUserConfig val_conv;
12878 val_conv.inner = (void*)(val & (~1));
12879 val_conv.is_owned = (val & 1) || (val == 0);
12880 val_conv = UserConfig_clone(&val_conv);
12881 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
12884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t default_config, int64_tArray channel_monitors) {
12885 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
12886 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
12887 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12888 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
12890 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
12891 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
12892 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12893 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
12895 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
12896 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
12897 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12898 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
12900 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
12901 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
12902 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12903 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
12905 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
12906 if (logger_conv.free == LDKLogger_JCalls_free) {
12907 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12908 LDKLogger_JCalls_clone(logger_conv.this_arg);
12910 LDKUserConfig default_config_conv;
12911 default_config_conv.inner = (void*)(default_config & (~1));
12912 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
12913 default_config_conv = UserConfig_clone(&default_config_conv);
12914 LDKCVec_ChannelMonitorZ channel_monitors_constr;
12915 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
12916 if (channel_monitors_constr.datalen > 0)
12917 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12919 channel_monitors_constr.data = NULL;
12920 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
12921 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
12922 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
12923 LDKChannelMonitor channel_monitors_conv_16_conv;
12924 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
12925 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
12926 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
12928 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
12929 LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
12930 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12931 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12932 long ret_ref = (long)ret_var.inner;
12933 if (ret_var.is_owned) {
12939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
12940 LDKu8slice ser_ref;
12941 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
12942 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
12943 LDKChannelManagerReadArgs arg_conv;
12944 arg_conv.inner = (void*)(arg & (~1));
12945 arg_conv.is_owned = (arg & 1) || (arg == 0);
12946 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
12947 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12948 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
12949 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
12950 return (long)ret_conv;
12953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12954 LDKDecodeError this_obj_conv;
12955 this_obj_conv.inner = (void*)(this_obj & (~1));
12956 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12957 DecodeError_free(this_obj_conv);
12960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12961 LDKDecodeError orig_conv;
12962 orig_conv.inner = (void*)(orig & (~1));
12963 orig_conv.is_owned = false;
12964 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
12965 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12966 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12967 long ret_ref = (long)ret_var.inner;
12968 if (ret_var.is_owned) {
12974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
12975 LDKInit this_obj_conv;
12976 this_obj_conv.inner = (void*)(this_obj & (~1));
12977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12978 Init_free(this_obj_conv);
12981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
12982 LDKInit this_ptr_conv;
12983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12984 this_ptr_conv.is_owned = false;
12985 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
12986 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12987 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12988 long ret_ref = (long)ret_var.inner;
12989 if (ret_var.is_owned) {
12995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12996 LDKInit this_ptr_conv;
12997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12998 this_ptr_conv.is_owned = false;
12999 LDKInitFeatures val_conv;
13000 val_conv.inner = (void*)(val & (~1));
13001 val_conv.is_owned = (val & 1) || (val == 0);
13002 val_conv = InitFeatures_clone(&val_conv);
13003 Init_set_features(&this_ptr_conv, val_conv);
13006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
13007 LDKInitFeatures features_arg_conv;
13008 features_arg_conv.inner = (void*)(features_arg & (~1));
13009 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
13010 features_arg_conv = InitFeatures_clone(&features_arg_conv);
13011 LDKInit ret_var = Init_new(features_arg_conv);
13012 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13013 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13014 long ret_ref = (long)ret_var.inner;
13015 if (ret_var.is_owned) {
13021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13023 orig_conv.inner = (void*)(orig & (~1));
13024 orig_conv.is_owned = false;
13025 LDKInit ret_var = Init_clone(&orig_conv);
13026 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13027 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13028 long ret_ref = (long)ret_var.inner;
13029 if (ret_var.is_owned) {
13035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13036 LDKErrorMessage this_obj_conv;
13037 this_obj_conv.inner = (void*)(this_obj & (~1));
13038 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13039 ErrorMessage_free(this_obj_conv);
13042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13043 LDKErrorMessage this_ptr_conv;
13044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13045 this_ptr_conv.is_owned = false;
13046 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13047 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
13051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13052 LDKErrorMessage this_ptr_conv;
13053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13054 this_ptr_conv.is_owned = false;
13055 LDKThirtyTwoBytes val_ref;
13056 CHECK((*env)->GetArrayLength(env, val) == 32);
13057 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13058 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
13061 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
13062 LDKErrorMessage this_ptr_conv;
13063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13064 this_ptr_conv.is_owned = false;
13065 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
13066 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
13070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13071 LDKErrorMessage this_ptr_conv;
13072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13073 this_ptr_conv.is_owned = false;
13074 LDKCVec_u8Z val_ref;
13075 val_ref.datalen = (*env)->GetArrayLength(env, val);
13076 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13077 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13078 ErrorMessage_set_data(&this_ptr_conv, val_ref);
13081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
13082 LDKThirtyTwoBytes channel_id_arg_ref;
13083 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13084 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13085 LDKCVec_u8Z data_arg_ref;
13086 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
13087 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13088 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
13089 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
13090 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13091 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13092 long ret_ref = (long)ret_var.inner;
13093 if (ret_var.is_owned) {
13099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13100 LDKErrorMessage orig_conv;
13101 orig_conv.inner = (void*)(orig & (~1));
13102 orig_conv.is_owned = false;
13103 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
13104 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13105 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13106 long ret_ref = (long)ret_var.inner;
13107 if (ret_var.is_owned) {
13113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13114 LDKPing this_obj_conv;
13115 this_obj_conv.inner = (void*)(this_obj & (~1));
13116 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13117 Ping_free(this_obj_conv);
13120 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
13121 LDKPing this_ptr_conv;
13122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13123 this_ptr_conv.is_owned = false;
13124 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
13128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13129 LDKPing this_ptr_conv;
13130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13131 this_ptr_conv.is_owned = false;
13132 Ping_set_ponglen(&this_ptr_conv, val);
13135 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
13136 LDKPing this_ptr_conv;
13137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13138 this_ptr_conv.is_owned = false;
13139 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
13143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13144 LDKPing this_ptr_conv;
13145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13146 this_ptr_conv.is_owned = false;
13147 Ping_set_byteslen(&this_ptr_conv, val);
13150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
13151 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
13152 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13153 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13154 long ret_ref = (long)ret_var.inner;
13155 if (ret_var.is_owned) {
13161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13163 orig_conv.inner = (void*)(orig & (~1));
13164 orig_conv.is_owned = false;
13165 LDKPing ret_var = Ping_clone(&orig_conv);
13166 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13167 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13168 long ret_ref = (long)ret_var.inner;
13169 if (ret_var.is_owned) {
13175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13176 LDKPong this_obj_conv;
13177 this_obj_conv.inner = (void*)(this_obj & (~1));
13178 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13179 Pong_free(this_obj_conv);
13182 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
13183 LDKPong this_ptr_conv;
13184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13185 this_ptr_conv.is_owned = false;
13186 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
13190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13191 LDKPong this_ptr_conv;
13192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13193 this_ptr_conv.is_owned = false;
13194 Pong_set_byteslen(&this_ptr_conv, val);
13197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
13198 LDKPong ret_var = Pong_new(byteslen_arg);
13199 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13200 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13201 long ret_ref = (long)ret_var.inner;
13202 if (ret_var.is_owned) {
13208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13210 orig_conv.inner = (void*)(orig & (~1));
13211 orig_conv.is_owned = false;
13212 LDKPong ret_var = Pong_clone(&orig_conv);
13213 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13214 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13215 long ret_ref = (long)ret_var.inner;
13216 if (ret_var.is_owned) {
13222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13223 LDKOpenChannel this_obj_conv;
13224 this_obj_conv.inner = (void*)(this_obj & (~1));
13225 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13226 OpenChannel_free(this_obj_conv);
13229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13230 LDKOpenChannel this_ptr_conv;
13231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13232 this_ptr_conv.is_owned = false;
13233 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13234 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
13238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13239 LDKOpenChannel this_ptr_conv;
13240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13241 this_ptr_conv.is_owned = false;
13242 LDKThirtyTwoBytes val_ref;
13243 CHECK((*env)->GetArrayLength(env, val) == 32);
13244 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13245 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
13248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13249 LDKOpenChannel this_ptr_conv;
13250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13251 this_ptr_conv.is_owned = false;
13252 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13253 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
13257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13258 LDKOpenChannel this_ptr_conv;
13259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13260 this_ptr_conv.is_owned = false;
13261 LDKThirtyTwoBytes val_ref;
13262 CHECK((*env)->GetArrayLength(env, val) == 32);
13263 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13264 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
13267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13268 LDKOpenChannel this_ptr_conv;
13269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13270 this_ptr_conv.is_owned = false;
13271 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
13275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13276 LDKOpenChannel this_ptr_conv;
13277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13278 this_ptr_conv.is_owned = false;
13279 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
13282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13283 LDKOpenChannel this_ptr_conv;
13284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13285 this_ptr_conv.is_owned = false;
13286 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
13290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13291 LDKOpenChannel this_ptr_conv;
13292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13293 this_ptr_conv.is_owned = false;
13294 OpenChannel_set_push_msat(&this_ptr_conv, val);
13297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13298 LDKOpenChannel this_ptr_conv;
13299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13300 this_ptr_conv.is_owned = false;
13301 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
13305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13306 LDKOpenChannel this_ptr_conv;
13307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13308 this_ptr_conv.is_owned = false;
13309 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
13312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13313 LDKOpenChannel this_ptr_conv;
13314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13315 this_ptr_conv.is_owned = false;
13316 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
13320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13321 LDKOpenChannel this_ptr_conv;
13322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13323 this_ptr_conv.is_owned = false;
13324 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13328 LDKOpenChannel this_ptr_conv;
13329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13330 this_ptr_conv.is_owned = false;
13331 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
13335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13336 LDKOpenChannel this_ptr_conv;
13337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13338 this_ptr_conv.is_owned = false;
13339 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
13342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13343 LDKOpenChannel this_ptr_conv;
13344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13345 this_ptr_conv.is_owned = false;
13346 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
13350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13351 LDKOpenChannel this_ptr_conv;
13352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13353 this_ptr_conv.is_owned = false;
13354 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
13357 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
13358 LDKOpenChannel this_ptr_conv;
13359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13360 this_ptr_conv.is_owned = false;
13361 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
13365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13366 LDKOpenChannel this_ptr_conv;
13367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13368 this_ptr_conv.is_owned = false;
13369 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
13372 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13373 LDKOpenChannel this_ptr_conv;
13374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13375 this_ptr_conv.is_owned = false;
13376 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
13380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13381 LDKOpenChannel this_ptr_conv;
13382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13383 this_ptr_conv.is_owned = false;
13384 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
13387 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13388 LDKOpenChannel this_ptr_conv;
13389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13390 this_ptr_conv.is_owned = false;
13391 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
13395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13396 LDKOpenChannel this_ptr_conv;
13397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13398 this_ptr_conv.is_owned = false;
13399 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
13402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13403 LDKOpenChannel this_ptr_conv;
13404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13405 this_ptr_conv.is_owned = false;
13406 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13407 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
13411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13412 LDKOpenChannel this_ptr_conv;
13413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13414 this_ptr_conv.is_owned = false;
13415 LDKPublicKey val_ref;
13416 CHECK((*env)->GetArrayLength(env, val) == 33);
13417 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13418 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
13421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13422 LDKOpenChannel this_ptr_conv;
13423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13424 this_ptr_conv.is_owned = false;
13425 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13426 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
13430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13431 LDKOpenChannel this_ptr_conv;
13432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13433 this_ptr_conv.is_owned = false;
13434 LDKPublicKey val_ref;
13435 CHECK((*env)->GetArrayLength(env, val) == 33);
13436 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13437 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
13440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13441 LDKOpenChannel this_ptr_conv;
13442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13443 this_ptr_conv.is_owned = false;
13444 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13445 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
13449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13450 LDKOpenChannel this_ptr_conv;
13451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13452 this_ptr_conv.is_owned = false;
13453 LDKPublicKey val_ref;
13454 CHECK((*env)->GetArrayLength(env, val) == 33);
13455 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13456 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
13459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13460 LDKOpenChannel this_ptr_conv;
13461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13462 this_ptr_conv.is_owned = false;
13463 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13464 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
13468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13469 LDKOpenChannel this_ptr_conv;
13470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13471 this_ptr_conv.is_owned = false;
13472 LDKPublicKey val_ref;
13473 CHECK((*env)->GetArrayLength(env, val) == 33);
13474 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13475 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13479 LDKOpenChannel this_ptr_conv;
13480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13481 this_ptr_conv.is_owned = false;
13482 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13483 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
13487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13488 LDKOpenChannel this_ptr_conv;
13489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13490 this_ptr_conv.is_owned = false;
13491 LDKPublicKey val_ref;
13492 CHECK((*env)->GetArrayLength(env, val) == 33);
13493 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13494 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
13497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13498 LDKOpenChannel this_ptr_conv;
13499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13500 this_ptr_conv.is_owned = false;
13501 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13502 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
13506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13507 LDKOpenChannel this_ptr_conv;
13508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13509 this_ptr_conv.is_owned = false;
13510 LDKPublicKey val_ref;
13511 CHECK((*env)->GetArrayLength(env, val) == 33);
13512 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13513 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
13516 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
13517 LDKOpenChannel this_ptr_conv;
13518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13519 this_ptr_conv.is_owned = false;
13520 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
13524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
13525 LDKOpenChannel this_ptr_conv;
13526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13527 this_ptr_conv.is_owned = false;
13528 OpenChannel_set_channel_flags(&this_ptr_conv, val);
13531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13532 LDKOpenChannel orig_conv;
13533 orig_conv.inner = (void*)(orig & (~1));
13534 orig_conv.is_owned = false;
13535 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
13536 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13537 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13538 long ret_ref = (long)ret_var.inner;
13539 if (ret_var.is_owned) {
13545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13546 LDKAcceptChannel this_obj_conv;
13547 this_obj_conv.inner = (void*)(this_obj & (~1));
13548 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13549 AcceptChannel_free(this_obj_conv);
13552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13553 LDKAcceptChannel this_ptr_conv;
13554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13555 this_ptr_conv.is_owned = false;
13556 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13557 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
13561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13562 LDKAcceptChannel this_ptr_conv;
13563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13564 this_ptr_conv.is_owned = false;
13565 LDKThirtyTwoBytes val_ref;
13566 CHECK((*env)->GetArrayLength(env, val) == 32);
13567 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13568 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
13571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13572 LDKAcceptChannel this_ptr_conv;
13573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13574 this_ptr_conv.is_owned = false;
13575 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
13579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13580 LDKAcceptChannel this_ptr_conv;
13581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13582 this_ptr_conv.is_owned = false;
13583 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
13586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13587 LDKAcceptChannel this_ptr_conv;
13588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13589 this_ptr_conv.is_owned = false;
13590 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
13594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13595 LDKAcceptChannel this_ptr_conv;
13596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13597 this_ptr_conv.is_owned = false;
13598 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13602 LDKAcceptChannel this_ptr_conv;
13603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13604 this_ptr_conv.is_owned = false;
13605 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
13609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13610 LDKAcceptChannel this_ptr_conv;
13611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13612 this_ptr_conv.is_owned = false;
13613 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
13616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13617 LDKAcceptChannel this_ptr_conv;
13618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13619 this_ptr_conv.is_owned = false;
13620 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
13624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13625 LDKAcceptChannel this_ptr_conv;
13626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13627 this_ptr_conv.is_owned = false;
13628 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
13631 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13632 LDKAcceptChannel this_ptr_conv;
13633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13634 this_ptr_conv.is_owned = false;
13635 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
13639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13640 LDKAcceptChannel this_ptr_conv;
13641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13642 this_ptr_conv.is_owned = false;
13643 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
13646 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13647 LDKAcceptChannel this_ptr_conv;
13648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13649 this_ptr_conv.is_owned = false;
13650 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
13654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13655 LDKAcceptChannel this_ptr_conv;
13656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13657 this_ptr_conv.is_owned = false;
13658 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
13661 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13662 LDKAcceptChannel this_ptr_conv;
13663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13664 this_ptr_conv.is_owned = false;
13665 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
13669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13670 LDKAcceptChannel this_ptr_conv;
13671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13672 this_ptr_conv.is_owned = false;
13673 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
13676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13677 LDKAcceptChannel this_ptr_conv;
13678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13679 this_ptr_conv.is_owned = false;
13680 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13681 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
13685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13686 LDKAcceptChannel this_ptr_conv;
13687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13688 this_ptr_conv.is_owned = false;
13689 LDKPublicKey val_ref;
13690 CHECK((*env)->GetArrayLength(env, val) == 33);
13691 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13692 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
13695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13696 LDKAcceptChannel this_ptr_conv;
13697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13698 this_ptr_conv.is_owned = false;
13699 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13700 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
13704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13705 LDKAcceptChannel this_ptr_conv;
13706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13707 this_ptr_conv.is_owned = false;
13708 LDKPublicKey val_ref;
13709 CHECK((*env)->GetArrayLength(env, val) == 33);
13710 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13711 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
13714 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13715 LDKAcceptChannel this_ptr_conv;
13716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13717 this_ptr_conv.is_owned = false;
13718 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13719 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
13723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13724 LDKAcceptChannel this_ptr_conv;
13725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13726 this_ptr_conv.is_owned = false;
13727 LDKPublicKey val_ref;
13728 CHECK((*env)->GetArrayLength(env, val) == 33);
13729 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13730 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
13733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13734 LDKAcceptChannel this_ptr_conv;
13735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13736 this_ptr_conv.is_owned = false;
13737 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13738 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
13742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13743 LDKAcceptChannel this_ptr_conv;
13744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13745 this_ptr_conv.is_owned = false;
13746 LDKPublicKey val_ref;
13747 CHECK((*env)->GetArrayLength(env, val) == 33);
13748 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13749 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13753 LDKAcceptChannel this_ptr_conv;
13754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13755 this_ptr_conv.is_owned = false;
13756 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13757 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
13761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13762 LDKAcceptChannel this_ptr_conv;
13763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13764 this_ptr_conv.is_owned = false;
13765 LDKPublicKey val_ref;
13766 CHECK((*env)->GetArrayLength(env, val) == 33);
13767 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13768 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
13771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13772 LDKAcceptChannel this_ptr_conv;
13773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13774 this_ptr_conv.is_owned = false;
13775 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13776 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
13780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13781 LDKAcceptChannel this_ptr_conv;
13782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13783 this_ptr_conv.is_owned = false;
13784 LDKPublicKey val_ref;
13785 CHECK((*env)->GetArrayLength(env, val) == 33);
13786 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13787 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
13790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13791 LDKAcceptChannel orig_conv;
13792 orig_conv.inner = (void*)(orig & (~1));
13793 orig_conv.is_owned = false;
13794 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
13795 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13796 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13797 long ret_ref = (long)ret_var.inner;
13798 if (ret_var.is_owned) {
13804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13805 LDKFundingCreated this_obj_conv;
13806 this_obj_conv.inner = (void*)(this_obj & (~1));
13807 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13808 FundingCreated_free(this_obj_conv);
13811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13812 LDKFundingCreated this_ptr_conv;
13813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13814 this_ptr_conv.is_owned = false;
13815 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13816 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
13820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13821 LDKFundingCreated this_ptr_conv;
13822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13823 this_ptr_conv.is_owned = false;
13824 LDKThirtyTwoBytes val_ref;
13825 CHECK((*env)->GetArrayLength(env, val) == 32);
13826 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13827 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
13830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
13831 LDKFundingCreated this_ptr_conv;
13832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13833 this_ptr_conv.is_owned = false;
13834 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13835 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
13839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13840 LDKFundingCreated this_ptr_conv;
13841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13842 this_ptr_conv.is_owned = false;
13843 LDKThirtyTwoBytes val_ref;
13844 CHECK((*env)->GetArrayLength(env, val) == 32);
13845 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13846 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
13849 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
13850 LDKFundingCreated this_ptr_conv;
13851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13852 this_ptr_conv.is_owned = false;
13853 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
13857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13858 LDKFundingCreated this_ptr_conv;
13859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13860 this_ptr_conv.is_owned = false;
13861 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
13864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13865 LDKFundingCreated this_ptr_conv;
13866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13867 this_ptr_conv.is_owned = false;
13868 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13869 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
13873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13874 LDKFundingCreated this_ptr_conv;
13875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13876 this_ptr_conv.is_owned = false;
13877 LDKSignature val_ref;
13878 CHECK((*env)->GetArrayLength(env, val) == 64);
13879 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13880 FundingCreated_set_signature(&this_ptr_conv, val_ref);
13883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
13884 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
13885 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
13886 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
13887 LDKThirtyTwoBytes funding_txid_arg_ref;
13888 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
13889 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
13890 LDKSignature signature_arg_ref;
13891 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13892 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13893 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
13894 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13895 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13896 long ret_ref = (long)ret_var.inner;
13897 if (ret_var.is_owned) {
13903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13904 LDKFundingCreated orig_conv;
13905 orig_conv.inner = (void*)(orig & (~1));
13906 orig_conv.is_owned = false;
13907 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
13908 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13909 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13910 long ret_ref = (long)ret_var.inner;
13911 if (ret_var.is_owned) {
13917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13918 LDKFundingSigned this_obj_conv;
13919 this_obj_conv.inner = (void*)(this_obj & (~1));
13920 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13921 FundingSigned_free(this_obj_conv);
13924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13925 LDKFundingSigned this_ptr_conv;
13926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13927 this_ptr_conv.is_owned = false;
13928 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13929 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
13933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13934 LDKFundingSigned this_ptr_conv;
13935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13936 this_ptr_conv.is_owned = false;
13937 LDKThirtyTwoBytes val_ref;
13938 CHECK((*env)->GetArrayLength(env, val) == 32);
13939 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13940 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
13943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13944 LDKFundingSigned this_ptr_conv;
13945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13946 this_ptr_conv.is_owned = false;
13947 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
13948 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
13952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13953 LDKFundingSigned this_ptr_conv;
13954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13955 this_ptr_conv.is_owned = false;
13956 LDKSignature val_ref;
13957 CHECK((*env)->GetArrayLength(env, val) == 64);
13958 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13959 FundingSigned_set_signature(&this_ptr_conv, val_ref);
13962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
13963 LDKThirtyTwoBytes channel_id_arg_ref;
13964 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13965 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13966 LDKSignature signature_arg_ref;
13967 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13968 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13969 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
13970 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13971 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13972 long ret_ref = (long)ret_var.inner;
13973 if (ret_var.is_owned) {
13979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13980 LDKFundingSigned orig_conv;
13981 orig_conv.inner = (void*)(orig & (~1));
13982 orig_conv.is_owned = false;
13983 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
13984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13986 long ret_ref = (long)ret_var.inner;
13987 if (ret_var.is_owned) {
13993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13994 LDKFundingLocked this_obj_conv;
13995 this_obj_conv.inner = (void*)(this_obj & (~1));
13996 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13997 FundingLocked_free(this_obj_conv);
14000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14001 LDKFundingLocked this_ptr_conv;
14002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14003 this_ptr_conv.is_owned = false;
14004 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14005 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
14009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14010 LDKFundingLocked this_ptr_conv;
14011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14012 this_ptr_conv.is_owned = false;
14013 LDKThirtyTwoBytes val_ref;
14014 CHECK((*env)->GetArrayLength(env, val) == 32);
14015 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14016 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
14019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14020 LDKFundingLocked this_ptr_conv;
14021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14022 this_ptr_conv.is_owned = false;
14023 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14024 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
14028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14029 LDKFundingLocked this_ptr_conv;
14030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14031 this_ptr_conv.is_owned = false;
14032 LDKPublicKey val_ref;
14033 CHECK((*env)->GetArrayLength(env, val) == 33);
14034 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14035 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
14038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
14039 LDKThirtyTwoBytes channel_id_arg_ref;
14040 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14041 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14042 LDKPublicKey next_per_commitment_point_arg_ref;
14043 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
14044 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
14045 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
14046 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14047 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14048 long ret_ref = (long)ret_var.inner;
14049 if (ret_var.is_owned) {
14055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14056 LDKFundingLocked orig_conv;
14057 orig_conv.inner = (void*)(orig & (~1));
14058 orig_conv.is_owned = false;
14059 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
14060 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14061 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14062 long ret_ref = (long)ret_var.inner;
14063 if (ret_var.is_owned) {
14069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14070 LDKShutdown this_obj_conv;
14071 this_obj_conv.inner = (void*)(this_obj & (~1));
14072 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14073 Shutdown_free(this_obj_conv);
14076 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14077 LDKShutdown this_ptr_conv;
14078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14079 this_ptr_conv.is_owned = false;
14080 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14081 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
14085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14086 LDKShutdown this_ptr_conv;
14087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14088 this_ptr_conv.is_owned = false;
14089 LDKThirtyTwoBytes val_ref;
14090 CHECK((*env)->GetArrayLength(env, val) == 32);
14091 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14092 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
14095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14096 LDKShutdown this_ptr_conv;
14097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14098 this_ptr_conv.is_owned = false;
14099 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
14100 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14101 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14106 LDKShutdown this_ptr_conv;
14107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14108 this_ptr_conv.is_owned = false;
14109 LDKCVec_u8Z val_ref;
14110 val_ref.datalen = (*env)->GetArrayLength(env, val);
14111 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14112 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
14113 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
14116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
14117 LDKThirtyTwoBytes channel_id_arg_ref;
14118 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14119 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14120 LDKCVec_u8Z scriptpubkey_arg_ref;
14121 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
14122 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14123 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
14124 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
14125 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14126 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14127 long ret_ref = (long)ret_var.inner;
14128 if (ret_var.is_owned) {
14134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14135 LDKShutdown orig_conv;
14136 orig_conv.inner = (void*)(orig & (~1));
14137 orig_conv.is_owned = false;
14138 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
14139 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14140 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14141 long ret_ref = (long)ret_var.inner;
14142 if (ret_var.is_owned) {
14148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14149 LDKClosingSigned this_obj_conv;
14150 this_obj_conv.inner = (void*)(this_obj & (~1));
14151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14152 ClosingSigned_free(this_obj_conv);
14155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14156 LDKClosingSigned this_ptr_conv;
14157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14158 this_ptr_conv.is_owned = false;
14159 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14160 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
14164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14165 LDKClosingSigned this_ptr_conv;
14166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14167 this_ptr_conv.is_owned = false;
14168 LDKThirtyTwoBytes val_ref;
14169 CHECK((*env)->GetArrayLength(env, val) == 32);
14170 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14171 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
14174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14175 LDKClosingSigned this_ptr_conv;
14176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14177 this_ptr_conv.is_owned = false;
14178 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
14182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14183 LDKClosingSigned this_ptr_conv;
14184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14185 this_ptr_conv.is_owned = false;
14186 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
14189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14190 LDKClosingSigned this_ptr_conv;
14191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14192 this_ptr_conv.is_owned = false;
14193 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14194 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
14198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14199 LDKClosingSigned this_ptr_conv;
14200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14201 this_ptr_conv.is_owned = false;
14202 LDKSignature val_ref;
14203 CHECK((*env)->GetArrayLength(env, val) == 64);
14204 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14205 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
14208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
14209 LDKThirtyTwoBytes channel_id_arg_ref;
14210 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14211 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14212 LDKSignature signature_arg_ref;
14213 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
14214 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
14215 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
14216 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14217 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14218 long ret_ref = (long)ret_var.inner;
14219 if (ret_var.is_owned) {
14225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14226 LDKClosingSigned orig_conv;
14227 orig_conv.inner = (void*)(orig & (~1));
14228 orig_conv.is_owned = false;
14229 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
14230 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14231 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14232 long ret_ref = (long)ret_var.inner;
14233 if (ret_var.is_owned) {
14239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14240 LDKUpdateAddHTLC this_obj_conv;
14241 this_obj_conv.inner = (void*)(this_obj & (~1));
14242 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14243 UpdateAddHTLC_free(this_obj_conv);
14246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14247 LDKUpdateAddHTLC this_ptr_conv;
14248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14249 this_ptr_conv.is_owned = false;
14250 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14251 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
14255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14256 LDKUpdateAddHTLC this_ptr_conv;
14257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14258 this_ptr_conv.is_owned = false;
14259 LDKThirtyTwoBytes val_ref;
14260 CHECK((*env)->GetArrayLength(env, val) == 32);
14261 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14262 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
14265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14266 LDKUpdateAddHTLC this_ptr_conv;
14267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14268 this_ptr_conv.is_owned = false;
14269 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
14273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14274 LDKUpdateAddHTLC this_ptr_conv;
14275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14276 this_ptr_conv.is_owned = false;
14277 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
14280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14281 LDKUpdateAddHTLC this_ptr_conv;
14282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14283 this_ptr_conv.is_owned = false;
14284 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
14288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14289 LDKUpdateAddHTLC this_ptr_conv;
14290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14291 this_ptr_conv.is_owned = false;
14292 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
14295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14296 LDKUpdateAddHTLC this_ptr_conv;
14297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14298 this_ptr_conv.is_owned = false;
14299 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14300 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
14304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14305 LDKUpdateAddHTLC this_ptr_conv;
14306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14307 this_ptr_conv.is_owned = false;
14308 LDKThirtyTwoBytes val_ref;
14309 CHECK((*env)->GetArrayLength(env, val) == 32);
14310 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14311 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
14314 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
14315 LDKUpdateAddHTLC this_ptr_conv;
14316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14317 this_ptr_conv.is_owned = false;
14318 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
14322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14323 LDKUpdateAddHTLC this_ptr_conv;
14324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14325 this_ptr_conv.is_owned = false;
14326 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
14329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14330 LDKUpdateAddHTLC orig_conv;
14331 orig_conv.inner = (void*)(orig & (~1));
14332 orig_conv.is_owned = false;
14333 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
14334 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14335 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14336 long ret_ref = (long)ret_var.inner;
14337 if (ret_var.is_owned) {
14343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14344 LDKUpdateFulfillHTLC this_obj_conv;
14345 this_obj_conv.inner = (void*)(this_obj & (~1));
14346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14347 UpdateFulfillHTLC_free(this_obj_conv);
14350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14351 LDKUpdateFulfillHTLC this_ptr_conv;
14352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14353 this_ptr_conv.is_owned = false;
14354 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14355 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
14359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14360 LDKUpdateFulfillHTLC this_ptr_conv;
14361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14362 this_ptr_conv.is_owned = false;
14363 LDKThirtyTwoBytes val_ref;
14364 CHECK((*env)->GetArrayLength(env, val) == 32);
14365 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14366 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
14369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14370 LDKUpdateFulfillHTLC this_ptr_conv;
14371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14372 this_ptr_conv.is_owned = false;
14373 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
14377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14378 LDKUpdateFulfillHTLC this_ptr_conv;
14379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14380 this_ptr_conv.is_owned = false;
14381 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
14384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
14385 LDKUpdateFulfillHTLC this_ptr_conv;
14386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14387 this_ptr_conv.is_owned = false;
14388 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14389 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
14393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14394 LDKUpdateFulfillHTLC this_ptr_conv;
14395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14396 this_ptr_conv.is_owned = false;
14397 LDKThirtyTwoBytes val_ref;
14398 CHECK((*env)->GetArrayLength(env, val) == 32);
14399 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14400 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
14403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
14404 LDKThirtyTwoBytes channel_id_arg_ref;
14405 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14406 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14407 LDKThirtyTwoBytes payment_preimage_arg_ref;
14408 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
14409 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
14410 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
14411 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14412 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14413 long ret_ref = (long)ret_var.inner;
14414 if (ret_var.is_owned) {
14420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14421 LDKUpdateFulfillHTLC orig_conv;
14422 orig_conv.inner = (void*)(orig & (~1));
14423 orig_conv.is_owned = false;
14424 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
14425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14427 long ret_ref = (long)ret_var.inner;
14428 if (ret_var.is_owned) {
14434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14435 LDKUpdateFailHTLC this_obj_conv;
14436 this_obj_conv.inner = (void*)(this_obj & (~1));
14437 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14438 UpdateFailHTLC_free(this_obj_conv);
14441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14442 LDKUpdateFailHTLC this_ptr_conv;
14443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14444 this_ptr_conv.is_owned = false;
14445 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14446 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
14450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14451 LDKUpdateFailHTLC this_ptr_conv;
14452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14453 this_ptr_conv.is_owned = false;
14454 LDKThirtyTwoBytes val_ref;
14455 CHECK((*env)->GetArrayLength(env, val) == 32);
14456 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14457 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
14460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14461 LDKUpdateFailHTLC this_ptr_conv;
14462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14463 this_ptr_conv.is_owned = false;
14464 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
14468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14469 LDKUpdateFailHTLC this_ptr_conv;
14470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14471 this_ptr_conv.is_owned = false;
14472 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
14475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14476 LDKUpdateFailHTLC orig_conv;
14477 orig_conv.inner = (void*)(orig & (~1));
14478 orig_conv.is_owned = false;
14479 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
14480 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14481 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14482 long ret_ref = (long)ret_var.inner;
14483 if (ret_var.is_owned) {
14489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14490 LDKUpdateFailMalformedHTLC this_obj_conv;
14491 this_obj_conv.inner = (void*)(this_obj & (~1));
14492 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14493 UpdateFailMalformedHTLC_free(this_obj_conv);
14496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14497 LDKUpdateFailMalformedHTLC this_ptr_conv;
14498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14499 this_ptr_conv.is_owned = false;
14500 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14501 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
14505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14506 LDKUpdateFailMalformedHTLC this_ptr_conv;
14507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14508 this_ptr_conv.is_owned = false;
14509 LDKThirtyTwoBytes val_ref;
14510 CHECK((*env)->GetArrayLength(env, val) == 32);
14511 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14512 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
14515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14516 LDKUpdateFailMalformedHTLC this_ptr_conv;
14517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14518 this_ptr_conv.is_owned = false;
14519 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
14523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14524 LDKUpdateFailMalformedHTLC this_ptr_conv;
14525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14526 this_ptr_conv.is_owned = false;
14527 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
14530 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
14531 LDKUpdateFailMalformedHTLC this_ptr_conv;
14532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14533 this_ptr_conv.is_owned = false;
14534 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
14538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14539 LDKUpdateFailMalformedHTLC this_ptr_conv;
14540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14541 this_ptr_conv.is_owned = false;
14542 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
14545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14546 LDKUpdateFailMalformedHTLC orig_conv;
14547 orig_conv.inner = (void*)(orig & (~1));
14548 orig_conv.is_owned = false;
14549 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
14550 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14551 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14552 long ret_ref = (long)ret_var.inner;
14553 if (ret_var.is_owned) {
14559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14560 LDKCommitmentSigned this_obj_conv;
14561 this_obj_conv.inner = (void*)(this_obj & (~1));
14562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14563 CommitmentSigned_free(this_obj_conv);
14566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14567 LDKCommitmentSigned this_ptr_conv;
14568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14569 this_ptr_conv.is_owned = false;
14570 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14571 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
14575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14576 LDKCommitmentSigned this_ptr_conv;
14577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14578 this_ptr_conv.is_owned = false;
14579 LDKThirtyTwoBytes val_ref;
14580 CHECK((*env)->GetArrayLength(env, val) == 32);
14581 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14582 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
14585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14586 LDKCommitmentSigned this_ptr_conv;
14587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14588 this_ptr_conv.is_owned = false;
14589 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
14590 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
14594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14595 LDKCommitmentSigned this_ptr_conv;
14596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14597 this_ptr_conv.is_owned = false;
14598 LDKSignature val_ref;
14599 CHECK((*env)->GetArrayLength(env, val) == 64);
14600 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14601 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
14604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
14605 LDKCommitmentSigned this_ptr_conv;
14606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14607 this_ptr_conv.is_owned = false;
14608 LDKCVec_SignatureZ val_constr;
14609 val_constr.datalen = (*env)->GetArrayLength(env, val);
14610 if (val_constr.datalen > 0)
14611 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14613 val_constr.data = NULL;
14614 for (size_t i = 0; i < val_constr.datalen; i++) {
14615 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
14616 LDKSignature val_conv_8_ref;
14617 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
14618 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
14619 val_constr.data[i] = val_conv_8_ref;
14621 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
14624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
14625 LDKThirtyTwoBytes channel_id_arg_ref;
14626 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14627 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14628 LDKSignature signature_arg_ref;
14629 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
14630 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
14631 LDKCVec_SignatureZ htlc_signatures_arg_constr;
14632 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
14633 if (htlc_signatures_arg_constr.datalen > 0)
14634 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14636 htlc_signatures_arg_constr.data = NULL;
14637 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
14638 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
14639 LDKSignature htlc_signatures_arg_conv_8_ref;
14640 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
14641 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
14642 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
14644 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
14645 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14646 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14647 long ret_ref = (long)ret_var.inner;
14648 if (ret_var.is_owned) {
14654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14655 LDKCommitmentSigned orig_conv;
14656 orig_conv.inner = (void*)(orig & (~1));
14657 orig_conv.is_owned = false;
14658 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
14659 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14660 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14661 long ret_ref = (long)ret_var.inner;
14662 if (ret_var.is_owned) {
14668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14669 LDKRevokeAndACK this_obj_conv;
14670 this_obj_conv.inner = (void*)(this_obj & (~1));
14671 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14672 RevokeAndACK_free(this_obj_conv);
14675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14676 LDKRevokeAndACK this_ptr_conv;
14677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14678 this_ptr_conv.is_owned = false;
14679 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14680 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
14684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14685 LDKRevokeAndACK this_ptr_conv;
14686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14687 this_ptr_conv.is_owned = false;
14688 LDKThirtyTwoBytes val_ref;
14689 CHECK((*env)->GetArrayLength(env, val) == 32);
14690 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14691 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
14694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
14695 LDKRevokeAndACK this_ptr_conv;
14696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14697 this_ptr_conv.is_owned = false;
14698 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14699 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
14703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14704 LDKRevokeAndACK this_ptr_conv;
14705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14706 this_ptr_conv.is_owned = false;
14707 LDKThirtyTwoBytes val_ref;
14708 CHECK((*env)->GetArrayLength(env, val) == 32);
14709 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14710 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
14713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14714 LDKRevokeAndACK this_ptr_conv;
14715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14716 this_ptr_conv.is_owned = false;
14717 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14718 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
14722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14723 LDKRevokeAndACK this_ptr_conv;
14724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14725 this_ptr_conv.is_owned = false;
14726 LDKPublicKey val_ref;
14727 CHECK((*env)->GetArrayLength(env, val) == 33);
14728 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14729 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
14732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
14733 LDKThirtyTwoBytes channel_id_arg_ref;
14734 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14735 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14736 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
14737 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
14738 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
14739 LDKPublicKey next_per_commitment_point_arg_ref;
14740 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
14741 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
14742 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
14743 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14744 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14745 long ret_ref = (long)ret_var.inner;
14746 if (ret_var.is_owned) {
14752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14753 LDKRevokeAndACK orig_conv;
14754 orig_conv.inner = (void*)(orig & (~1));
14755 orig_conv.is_owned = false;
14756 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
14757 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14758 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14759 long ret_ref = (long)ret_var.inner;
14760 if (ret_var.is_owned) {
14766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14767 LDKUpdateFee this_obj_conv;
14768 this_obj_conv.inner = (void*)(this_obj & (~1));
14769 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14770 UpdateFee_free(this_obj_conv);
14773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14774 LDKUpdateFee this_ptr_conv;
14775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14776 this_ptr_conv.is_owned = false;
14777 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14778 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
14782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14783 LDKUpdateFee this_ptr_conv;
14784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14785 this_ptr_conv.is_owned = false;
14786 LDKThirtyTwoBytes val_ref;
14787 CHECK((*env)->GetArrayLength(env, val) == 32);
14788 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14789 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
14792 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
14793 LDKUpdateFee this_ptr_conv;
14794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14795 this_ptr_conv.is_owned = false;
14796 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
14800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14801 LDKUpdateFee this_ptr_conv;
14802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14803 this_ptr_conv.is_owned = false;
14804 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
14808 LDKThirtyTwoBytes channel_id_arg_ref;
14809 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
14810 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
14811 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
14812 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14813 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14814 long ret_ref = (long)ret_var.inner;
14815 if (ret_var.is_owned) {
14821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14822 LDKUpdateFee orig_conv;
14823 orig_conv.inner = (void*)(orig & (~1));
14824 orig_conv.is_owned = false;
14825 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
14826 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14827 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14828 long ret_ref = (long)ret_var.inner;
14829 if (ret_var.is_owned) {
14835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14836 LDKDataLossProtect this_obj_conv;
14837 this_obj_conv.inner = (void*)(this_obj & (~1));
14838 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14839 DataLossProtect_free(this_obj_conv);
14842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
14843 LDKDataLossProtect this_ptr_conv;
14844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14845 this_ptr_conv.is_owned = false;
14846 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14847 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
14851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14852 LDKDataLossProtect this_ptr_conv;
14853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14854 this_ptr_conv.is_owned = false;
14855 LDKThirtyTwoBytes val_ref;
14856 CHECK((*env)->GetArrayLength(env, val) == 32);
14857 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14858 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
14861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14862 LDKDataLossProtect this_ptr_conv;
14863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14864 this_ptr_conv.is_owned = false;
14865 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14866 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
14870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14871 LDKDataLossProtect this_ptr_conv;
14872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14873 this_ptr_conv.is_owned = false;
14874 LDKPublicKey val_ref;
14875 CHECK((*env)->GetArrayLength(env, val) == 33);
14876 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14877 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
14880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv *env, jclass clz, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
14881 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
14882 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
14883 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
14884 LDKPublicKey my_current_per_commitment_point_arg_ref;
14885 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
14886 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
14887 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
14888 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14889 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14890 long ret_ref = (long)ret_var.inner;
14891 if (ret_var.is_owned) {
14897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14898 LDKDataLossProtect orig_conv;
14899 orig_conv.inner = (void*)(orig & (~1));
14900 orig_conv.is_owned = false;
14901 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
14902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14904 long ret_ref = (long)ret_var.inner;
14905 if (ret_var.is_owned) {
14911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14912 LDKChannelReestablish this_obj_conv;
14913 this_obj_conv.inner = (void*)(this_obj & (~1));
14914 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14915 ChannelReestablish_free(this_obj_conv);
14918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14919 LDKChannelReestablish this_ptr_conv;
14920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14921 this_ptr_conv.is_owned = false;
14922 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14923 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
14927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14928 LDKChannelReestablish this_ptr_conv;
14929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14930 this_ptr_conv.is_owned = false;
14931 LDKThirtyTwoBytes val_ref;
14932 CHECK((*env)->GetArrayLength(env, val) == 32);
14933 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14934 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
14937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
14938 LDKChannelReestablish this_ptr_conv;
14939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14940 this_ptr_conv.is_owned = false;
14941 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
14945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14946 LDKChannelReestablish this_ptr_conv;
14947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14948 this_ptr_conv.is_owned = false;
14949 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
14952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
14953 LDKChannelReestablish this_ptr_conv;
14954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14955 this_ptr_conv.is_owned = false;
14956 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
14960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14961 LDKChannelReestablish this_ptr_conv;
14962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14963 this_ptr_conv.is_owned = false;
14964 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
14967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14968 LDKChannelReestablish orig_conv;
14969 orig_conv.inner = (void*)(orig & (~1));
14970 orig_conv.is_owned = false;
14971 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
14972 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14973 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14974 long ret_ref = (long)ret_var.inner;
14975 if (ret_var.is_owned) {
14981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14982 LDKAnnouncementSignatures this_obj_conv;
14983 this_obj_conv.inner = (void*)(this_obj & (~1));
14984 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14985 AnnouncementSignatures_free(this_obj_conv);
14988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14989 LDKAnnouncementSignatures this_ptr_conv;
14990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14991 this_ptr_conv.is_owned = false;
14992 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14993 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
14997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14998 LDKAnnouncementSignatures this_ptr_conv;
14999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15000 this_ptr_conv.is_owned = false;
15001 LDKThirtyTwoBytes val_ref;
15002 CHECK((*env)->GetArrayLength(env, val) == 32);
15003 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15004 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
15007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15008 LDKAnnouncementSignatures this_ptr_conv;
15009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15010 this_ptr_conv.is_owned = false;
15011 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
15015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15016 LDKAnnouncementSignatures this_ptr_conv;
15017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15018 this_ptr_conv.is_owned = false;
15019 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
15022 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
15023 LDKAnnouncementSignatures this_ptr_conv;
15024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15025 this_ptr_conv.is_owned = false;
15026 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15027 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
15031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15032 LDKAnnouncementSignatures this_ptr_conv;
15033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15034 this_ptr_conv.is_owned = false;
15035 LDKSignature val_ref;
15036 CHECK((*env)->GetArrayLength(env, val) == 64);
15037 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15038 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
15041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
15042 LDKAnnouncementSignatures this_ptr_conv;
15043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15044 this_ptr_conv.is_owned = false;
15045 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15046 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
15050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15051 LDKAnnouncementSignatures this_ptr_conv;
15052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15053 this_ptr_conv.is_owned = false;
15054 LDKSignature val_ref;
15055 CHECK((*env)->GetArrayLength(env, val) == 64);
15056 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15057 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
15060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
15061 LDKThirtyTwoBytes channel_id_arg_ref;
15062 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
15063 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
15064 LDKSignature node_signature_arg_ref;
15065 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
15066 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
15067 LDKSignature bitcoin_signature_arg_ref;
15068 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
15069 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
15070 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
15071 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15072 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15073 long ret_ref = (long)ret_var.inner;
15074 if (ret_var.is_owned) {
15080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15081 LDKAnnouncementSignatures orig_conv;
15082 orig_conv.inner = (void*)(orig & (~1));
15083 orig_conv.is_owned = false;
15084 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
15085 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15086 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15087 long ret_ref = (long)ret_var.inner;
15088 if (ret_var.is_owned) {
15094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15095 if ((this_ptr & 1) != 0) return;
15096 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
15097 FREE((void*)this_ptr);
15098 NetAddress_free(this_ptr_conv);
15101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15102 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
15103 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
15104 *ret_copy = NetAddress_clone(orig_conv);
15105 long ret_ref = (long)ret_copy;
15109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
15110 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
15111 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
15112 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15113 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15114 CVec_u8Z_free(ret_var);
15118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15119 LDKu8slice ser_ref;
15120 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15121 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15122 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
15123 *ret_conv = Result_read(ser_ref);
15124 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15125 return (long)ret_conv;
15128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15129 LDKUnsignedNodeAnnouncement this_obj_conv;
15130 this_obj_conv.inner = (void*)(this_obj & (~1));
15131 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15132 UnsignedNodeAnnouncement_free(this_obj_conv);
15135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15136 LDKUnsignedNodeAnnouncement this_ptr_conv;
15137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15138 this_ptr_conv.is_owned = false;
15139 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
15140 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15141 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15142 long ret_ref = (long)ret_var.inner;
15143 if (ret_var.is_owned) {
15149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15150 LDKUnsignedNodeAnnouncement this_ptr_conv;
15151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15152 this_ptr_conv.is_owned = false;
15153 LDKNodeFeatures val_conv;
15154 val_conv.inner = (void*)(val & (~1));
15155 val_conv.is_owned = (val & 1) || (val == 0);
15156 val_conv = NodeFeatures_clone(&val_conv);
15157 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
15160 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
15161 LDKUnsignedNodeAnnouncement this_ptr_conv;
15162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15163 this_ptr_conv.is_owned = false;
15164 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
15168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15169 LDKUnsignedNodeAnnouncement this_ptr_conv;
15170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15171 this_ptr_conv.is_owned = false;
15172 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
15175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15176 LDKUnsignedNodeAnnouncement this_ptr_conv;
15177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15178 this_ptr_conv.is_owned = false;
15179 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15180 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
15184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15185 LDKUnsignedNodeAnnouncement this_ptr_conv;
15186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15187 this_ptr_conv.is_owned = false;
15188 LDKPublicKey val_ref;
15189 CHECK((*env)->GetArrayLength(env, val) == 33);
15190 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15191 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
15194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
15195 LDKUnsignedNodeAnnouncement this_ptr_conv;
15196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15197 this_ptr_conv.is_owned = false;
15198 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
15199 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
15203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15204 LDKUnsignedNodeAnnouncement this_ptr_conv;
15205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15206 this_ptr_conv.is_owned = false;
15207 LDKThreeBytes val_ref;
15208 CHECK((*env)->GetArrayLength(env, val) == 3);
15209 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
15210 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
15213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
15214 LDKUnsignedNodeAnnouncement this_ptr_conv;
15215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15216 this_ptr_conv.is_owned = false;
15217 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
15222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15223 LDKUnsignedNodeAnnouncement this_ptr_conv;
15224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15225 this_ptr_conv.is_owned = false;
15226 LDKThirtyTwoBytes val_ref;
15227 CHECK((*env)->GetArrayLength(env, val) == 32);
15228 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15229 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
15232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
15233 LDKUnsignedNodeAnnouncement this_ptr_conv;
15234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15235 this_ptr_conv.is_owned = false;
15236 LDKCVec_NetAddressZ val_constr;
15237 val_constr.datalen = (*env)->GetArrayLength(env, val);
15238 if (val_constr.datalen > 0)
15239 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15241 val_constr.data = NULL;
15242 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
15243 for (size_t m = 0; m < val_constr.datalen; m++) {
15244 int64_t val_conv_12 = val_vals[m];
15245 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
15246 FREE((void*)val_conv_12);
15247 val_constr.data[m] = val_conv_12_conv;
15249 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
15250 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
15253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15254 LDKUnsignedNodeAnnouncement orig_conv;
15255 orig_conv.inner = (void*)(orig & (~1));
15256 orig_conv.is_owned = false;
15257 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
15258 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15259 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15260 long ret_ref = (long)ret_var.inner;
15261 if (ret_var.is_owned) {
15267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15268 LDKNodeAnnouncement this_obj_conv;
15269 this_obj_conv.inner = (void*)(this_obj & (~1));
15270 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15271 NodeAnnouncement_free(this_obj_conv);
15274 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
15275 LDKNodeAnnouncement this_ptr_conv;
15276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15277 this_ptr_conv.is_owned = false;
15278 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15279 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
15283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15284 LDKNodeAnnouncement this_ptr_conv;
15285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15286 this_ptr_conv.is_owned = false;
15287 LDKSignature val_ref;
15288 CHECK((*env)->GetArrayLength(env, val) == 64);
15289 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15290 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
15293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
15294 LDKNodeAnnouncement this_ptr_conv;
15295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15296 this_ptr_conv.is_owned = false;
15297 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
15298 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15299 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15300 long ret_ref = (long)ret_var.inner;
15301 if (ret_var.is_owned) {
15307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15308 LDKNodeAnnouncement this_ptr_conv;
15309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15310 this_ptr_conv.is_owned = false;
15311 LDKUnsignedNodeAnnouncement val_conv;
15312 val_conv.inner = (void*)(val & (~1));
15313 val_conv.is_owned = (val & 1) || (val == 0);
15314 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
15315 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
15318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
15319 LDKSignature signature_arg_ref;
15320 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
15321 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
15322 LDKUnsignedNodeAnnouncement contents_arg_conv;
15323 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15324 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15325 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
15326 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
15327 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15328 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15329 long ret_ref = (long)ret_var.inner;
15330 if (ret_var.is_owned) {
15336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15337 LDKNodeAnnouncement orig_conv;
15338 orig_conv.inner = (void*)(orig & (~1));
15339 orig_conv.is_owned = false;
15340 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
15341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15343 long ret_ref = (long)ret_var.inner;
15344 if (ret_var.is_owned) {
15350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15351 LDKUnsignedChannelAnnouncement this_obj_conv;
15352 this_obj_conv.inner = (void*)(this_obj & (~1));
15353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15354 UnsignedChannelAnnouncement_free(this_obj_conv);
15357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15358 LDKUnsignedChannelAnnouncement this_ptr_conv;
15359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15360 this_ptr_conv.is_owned = false;
15361 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
15362 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15363 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15364 long ret_ref = (long)ret_var.inner;
15365 if (ret_var.is_owned) {
15371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15372 LDKUnsignedChannelAnnouncement this_ptr_conv;
15373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15374 this_ptr_conv.is_owned = false;
15375 LDKChannelFeatures val_conv;
15376 val_conv.inner = (void*)(val & (~1));
15377 val_conv.is_owned = (val & 1) || (val == 0);
15378 val_conv = ChannelFeatures_clone(&val_conv);
15379 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
15382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15383 LDKUnsignedChannelAnnouncement this_ptr_conv;
15384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15385 this_ptr_conv.is_owned = false;
15386 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15387 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
15391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15392 LDKUnsignedChannelAnnouncement this_ptr_conv;
15393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15394 this_ptr_conv.is_owned = false;
15395 LDKThirtyTwoBytes val_ref;
15396 CHECK((*env)->GetArrayLength(env, val) == 32);
15397 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15398 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
15401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15402 LDKUnsignedChannelAnnouncement this_ptr_conv;
15403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15404 this_ptr_conv.is_owned = false;
15405 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
15409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15410 LDKUnsignedChannelAnnouncement this_ptr_conv;
15411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15412 this_ptr_conv.is_owned = false;
15413 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
15416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15417 LDKUnsignedChannelAnnouncement this_ptr_conv;
15418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15419 this_ptr_conv.is_owned = false;
15420 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15421 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
15425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15426 LDKUnsignedChannelAnnouncement this_ptr_conv;
15427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15428 this_ptr_conv.is_owned = false;
15429 LDKPublicKey val_ref;
15430 CHECK((*env)->GetArrayLength(env, val) == 33);
15431 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15432 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
15435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15436 LDKUnsignedChannelAnnouncement this_ptr_conv;
15437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15438 this_ptr_conv.is_owned = false;
15439 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15440 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
15444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15445 LDKUnsignedChannelAnnouncement this_ptr_conv;
15446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15447 this_ptr_conv.is_owned = false;
15448 LDKPublicKey val_ref;
15449 CHECK((*env)->GetArrayLength(env, val) == 33);
15450 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15451 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
15454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15455 LDKUnsignedChannelAnnouncement this_ptr_conv;
15456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15457 this_ptr_conv.is_owned = false;
15458 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15459 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
15463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15464 LDKUnsignedChannelAnnouncement this_ptr_conv;
15465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15466 this_ptr_conv.is_owned = false;
15467 LDKPublicKey val_ref;
15468 CHECK((*env)->GetArrayLength(env, val) == 33);
15469 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15470 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
15473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15474 LDKUnsignedChannelAnnouncement this_ptr_conv;
15475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15476 this_ptr_conv.is_owned = false;
15477 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15478 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
15482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15483 LDKUnsignedChannelAnnouncement this_ptr_conv;
15484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15485 this_ptr_conv.is_owned = false;
15486 LDKPublicKey val_ref;
15487 CHECK((*env)->GetArrayLength(env, val) == 33);
15488 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15489 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
15492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15493 LDKUnsignedChannelAnnouncement orig_conv;
15494 orig_conv.inner = (void*)(orig & (~1));
15495 orig_conv.is_owned = false;
15496 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
15497 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15498 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15499 long ret_ref = (long)ret_var.inner;
15500 if (ret_var.is_owned) {
15506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15507 LDKChannelAnnouncement this_obj_conv;
15508 this_obj_conv.inner = (void*)(this_obj & (~1));
15509 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15510 ChannelAnnouncement_free(this_obj_conv);
15513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15514 LDKChannelAnnouncement this_ptr_conv;
15515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15516 this_ptr_conv.is_owned = false;
15517 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15518 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
15522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15523 LDKChannelAnnouncement this_ptr_conv;
15524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15525 this_ptr_conv.is_owned = false;
15526 LDKSignature val_ref;
15527 CHECK((*env)->GetArrayLength(env, val) == 64);
15528 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15529 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
15532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15533 LDKChannelAnnouncement this_ptr_conv;
15534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15535 this_ptr_conv.is_owned = false;
15536 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15537 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
15541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15542 LDKChannelAnnouncement this_ptr_conv;
15543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15544 this_ptr_conv.is_owned = false;
15545 LDKSignature val_ref;
15546 CHECK((*env)->GetArrayLength(env, val) == 64);
15547 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15548 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
15551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
15552 LDKChannelAnnouncement this_ptr_conv;
15553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15554 this_ptr_conv.is_owned = false;
15555 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15556 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
15560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15561 LDKChannelAnnouncement this_ptr_conv;
15562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15563 this_ptr_conv.is_owned = false;
15564 LDKSignature val_ref;
15565 CHECK((*env)->GetArrayLength(env, val) == 64);
15566 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15567 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
15570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
15571 LDKChannelAnnouncement this_ptr_conv;
15572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15573 this_ptr_conv.is_owned = false;
15574 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15575 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
15579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15580 LDKChannelAnnouncement this_ptr_conv;
15581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15582 this_ptr_conv.is_owned = false;
15583 LDKSignature val_ref;
15584 CHECK((*env)->GetArrayLength(env, val) == 64);
15585 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15586 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
15589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
15590 LDKChannelAnnouncement this_ptr_conv;
15591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15592 this_ptr_conv.is_owned = false;
15593 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
15594 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15595 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15596 long ret_ref = (long)ret_var.inner;
15597 if (ret_var.is_owned) {
15603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15604 LDKChannelAnnouncement this_ptr_conv;
15605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15606 this_ptr_conv.is_owned = false;
15607 LDKUnsignedChannelAnnouncement val_conv;
15608 val_conv.inner = (void*)(val & (~1));
15609 val_conv.is_owned = (val & 1) || (val == 0);
15610 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
15611 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
15614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray node_signature_1_arg, int8_tArray node_signature_2_arg, int8_tArray bitcoin_signature_1_arg, int8_tArray bitcoin_signature_2_arg, int64_t contents_arg) {
15615 LDKSignature node_signature_1_arg_ref;
15616 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
15617 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
15618 LDKSignature node_signature_2_arg_ref;
15619 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
15620 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
15621 LDKSignature bitcoin_signature_1_arg_ref;
15622 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
15623 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
15624 LDKSignature bitcoin_signature_2_arg_ref;
15625 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
15626 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
15627 LDKUnsignedChannelAnnouncement contents_arg_conv;
15628 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15629 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15630 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
15631 LDKChannelAnnouncement ret_var = ChannelAnnouncement_new(node_signature_1_arg_ref, node_signature_2_arg_ref, bitcoin_signature_1_arg_ref, bitcoin_signature_2_arg_ref, contents_arg_conv);
15632 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15633 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15634 long ret_ref = (long)ret_var.inner;
15635 if (ret_var.is_owned) {
15641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15642 LDKChannelAnnouncement orig_conv;
15643 orig_conv.inner = (void*)(orig & (~1));
15644 orig_conv.is_owned = false;
15645 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
15646 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15647 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15648 long ret_ref = (long)ret_var.inner;
15649 if (ret_var.is_owned) {
15655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15656 LDKUnsignedChannelUpdate this_obj_conv;
15657 this_obj_conv.inner = (void*)(this_obj & (~1));
15658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15659 UnsignedChannelUpdate_free(this_obj_conv);
15662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15663 LDKUnsignedChannelUpdate this_ptr_conv;
15664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15665 this_ptr_conv.is_owned = false;
15666 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15667 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
15671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15672 LDKUnsignedChannelUpdate this_ptr_conv;
15673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15674 this_ptr_conv.is_owned = false;
15675 LDKThirtyTwoBytes val_ref;
15676 CHECK((*env)->GetArrayLength(env, val) == 32);
15677 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15678 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
15681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15682 LDKUnsignedChannelUpdate this_ptr_conv;
15683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15684 this_ptr_conv.is_owned = false;
15685 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
15689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15690 LDKUnsignedChannelUpdate this_ptr_conv;
15691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15692 this_ptr_conv.is_owned = false;
15693 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
15696 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
15697 LDKUnsignedChannelUpdate this_ptr_conv;
15698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15699 this_ptr_conv.is_owned = false;
15700 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
15704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15705 LDKUnsignedChannelUpdate this_ptr_conv;
15706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15707 this_ptr_conv.is_owned = false;
15708 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
15711 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
15712 LDKUnsignedChannelUpdate this_ptr_conv;
15713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15714 this_ptr_conv.is_owned = false;
15715 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
15719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
15720 LDKUnsignedChannelUpdate this_ptr_conv;
15721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15722 this_ptr_conv.is_owned = false;
15723 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
15726 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15727 LDKUnsignedChannelUpdate this_ptr_conv;
15728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15729 this_ptr_conv.is_owned = false;
15730 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
15734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15735 LDKUnsignedChannelUpdate this_ptr_conv;
15736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15737 this_ptr_conv.is_owned = false;
15738 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
15741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15742 LDKUnsignedChannelUpdate this_ptr_conv;
15743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15744 this_ptr_conv.is_owned = false;
15745 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
15749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15750 LDKUnsignedChannelUpdate this_ptr_conv;
15751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15752 this_ptr_conv.is_owned = false;
15753 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
15756 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15757 LDKUnsignedChannelUpdate this_ptr_conv;
15758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15759 this_ptr_conv.is_owned = false;
15760 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
15764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15765 LDKUnsignedChannelUpdate this_ptr_conv;
15766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15767 this_ptr_conv.is_owned = false;
15768 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
15771 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
15772 LDKUnsignedChannelUpdate this_ptr_conv;
15773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15774 this_ptr_conv.is_owned = false;
15775 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
15779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15780 LDKUnsignedChannelUpdate this_ptr_conv;
15781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15782 this_ptr_conv.is_owned = false;
15783 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
15786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15787 LDKUnsignedChannelUpdate orig_conv;
15788 orig_conv.inner = (void*)(orig & (~1));
15789 orig_conv.is_owned = false;
15790 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
15791 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15792 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15793 long ret_ref = (long)ret_var.inner;
15794 if (ret_var.is_owned) {
15800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15801 LDKChannelUpdate this_obj_conv;
15802 this_obj_conv.inner = (void*)(this_obj & (~1));
15803 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15804 ChannelUpdate_free(this_obj_conv);
15807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
15808 LDKChannelUpdate this_ptr_conv;
15809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15810 this_ptr_conv.is_owned = false;
15811 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
15812 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
15816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15817 LDKChannelUpdate this_ptr_conv;
15818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15819 this_ptr_conv.is_owned = false;
15820 LDKSignature val_ref;
15821 CHECK((*env)->GetArrayLength(env, val) == 64);
15822 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15823 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
15826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
15827 LDKChannelUpdate this_ptr_conv;
15828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15829 this_ptr_conv.is_owned = false;
15830 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
15831 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15832 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15833 long ret_ref = (long)ret_var.inner;
15834 if (ret_var.is_owned) {
15840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15841 LDKChannelUpdate this_ptr_conv;
15842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15843 this_ptr_conv.is_owned = false;
15844 LDKUnsignedChannelUpdate val_conv;
15845 val_conv.inner = (void*)(val & (~1));
15846 val_conv.is_owned = (val & 1) || (val == 0);
15847 val_conv = UnsignedChannelUpdate_clone(&val_conv);
15848 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
15851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
15852 LDKSignature signature_arg_ref;
15853 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
15854 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
15855 LDKUnsignedChannelUpdate contents_arg_conv;
15856 contents_arg_conv.inner = (void*)(contents_arg & (~1));
15857 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
15858 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
15859 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
15860 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15861 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15862 long ret_ref = (long)ret_var.inner;
15863 if (ret_var.is_owned) {
15869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15870 LDKChannelUpdate orig_conv;
15871 orig_conv.inner = (void*)(orig & (~1));
15872 orig_conv.is_owned = false;
15873 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
15874 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15875 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15876 long ret_ref = (long)ret_var.inner;
15877 if (ret_var.is_owned) {
15883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15884 LDKQueryChannelRange this_obj_conv;
15885 this_obj_conv.inner = (void*)(this_obj & (~1));
15886 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15887 QueryChannelRange_free(this_obj_conv);
15890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15891 LDKQueryChannelRange this_ptr_conv;
15892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15893 this_ptr_conv.is_owned = false;
15894 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15895 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
15899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15900 LDKQueryChannelRange this_ptr_conv;
15901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15902 this_ptr_conv.is_owned = false;
15903 LDKThirtyTwoBytes val_ref;
15904 CHECK((*env)->GetArrayLength(env, val) == 32);
15905 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15906 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15909 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
15910 LDKQueryChannelRange this_ptr_conv;
15911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15912 this_ptr_conv.is_owned = false;
15913 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
15917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15918 LDKQueryChannelRange this_ptr_conv;
15919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15920 this_ptr_conv.is_owned = false;
15921 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
15924 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
15925 LDKQueryChannelRange this_ptr_conv;
15926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15927 this_ptr_conv.is_owned = false;
15928 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
15932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15933 LDKQueryChannelRange this_ptr_conv;
15934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15935 this_ptr_conv.is_owned = false;
15936 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
15939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
15940 LDKThirtyTwoBytes chain_hash_arg_ref;
15941 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
15942 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
15943 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
15944 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15945 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15946 long ret_ref = (long)ret_var.inner;
15947 if (ret_var.is_owned) {
15953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15954 LDKQueryChannelRange orig_conv;
15955 orig_conv.inner = (void*)(orig & (~1));
15956 orig_conv.is_owned = false;
15957 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
15958 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15959 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15960 long ret_ref = (long)ret_var.inner;
15961 if (ret_var.is_owned) {
15967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15968 LDKReplyChannelRange this_obj_conv;
15969 this_obj_conv.inner = (void*)(this_obj & (~1));
15970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15971 ReplyChannelRange_free(this_obj_conv);
15974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
15975 LDKReplyChannelRange this_ptr_conv;
15976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15977 this_ptr_conv.is_owned = false;
15978 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15979 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
15983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15984 LDKReplyChannelRange this_ptr_conv;
15985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15986 this_ptr_conv.is_owned = false;
15987 LDKThirtyTwoBytes val_ref;
15988 CHECK((*env)->GetArrayLength(env, val) == 32);
15989 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15990 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
15993 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
15994 LDKReplyChannelRange this_ptr_conv;
15995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15996 this_ptr_conv.is_owned = false;
15997 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
16001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16002 LDKReplyChannelRange this_ptr_conv;
16003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16004 this_ptr_conv.is_owned = false;
16005 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
16008 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
16009 LDKReplyChannelRange this_ptr_conv;
16010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16011 this_ptr_conv.is_owned = false;
16012 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
16016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16017 LDKReplyChannelRange this_ptr_conv;
16018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16019 this_ptr_conv.is_owned = false;
16020 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
16023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
16024 LDKReplyChannelRange this_ptr_conv;
16025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16026 this_ptr_conv.is_owned = false;
16027 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
16031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16032 LDKReplyChannelRange this_ptr_conv;
16033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16034 this_ptr_conv.is_owned = false;
16035 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
16038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16039 LDKReplyChannelRange this_ptr_conv;
16040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16041 this_ptr_conv.is_owned = false;
16042 LDKCVec_u64Z val_constr;
16043 val_constr.datalen = (*env)->GetArrayLength(env, val);
16044 if (val_constr.datalen > 0)
16045 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16047 val_constr.data = NULL;
16048 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16049 for (size_t g = 0; g < val_constr.datalen; g++) {
16050 int64_t val_conv_6 = val_vals[g];
16051 val_constr.data[g] = val_conv_6;
16053 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16054 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
16057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean sync_complete_arg, int64_tArray short_channel_ids_arg) {
16058 LDKThirtyTwoBytes chain_hash_arg_ref;
16059 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
16060 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
16061 LDKCVec_u64Z short_channel_ids_arg_constr;
16062 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
16063 if (short_channel_ids_arg_constr.datalen > 0)
16064 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16066 short_channel_ids_arg_constr.data = NULL;
16067 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
16068 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
16069 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
16070 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
16072 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
16073 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
16074 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16075 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16076 long ret_ref = (long)ret_var.inner;
16077 if (ret_var.is_owned) {
16083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16084 LDKReplyChannelRange orig_conv;
16085 orig_conv.inner = (void*)(orig & (~1));
16086 orig_conv.is_owned = false;
16087 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
16088 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16089 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16090 long ret_ref = (long)ret_var.inner;
16091 if (ret_var.is_owned) {
16097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16098 LDKQueryShortChannelIds this_obj_conv;
16099 this_obj_conv.inner = (void*)(this_obj & (~1));
16100 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16101 QueryShortChannelIds_free(this_obj_conv);
16104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16105 LDKQueryShortChannelIds this_ptr_conv;
16106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16107 this_ptr_conv.is_owned = false;
16108 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16109 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
16113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16114 LDKQueryShortChannelIds this_ptr_conv;
16115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16116 this_ptr_conv.is_owned = false;
16117 LDKThirtyTwoBytes val_ref;
16118 CHECK((*env)->GetArrayLength(env, val) == 32);
16119 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16120 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
16123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16124 LDKQueryShortChannelIds this_ptr_conv;
16125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16126 this_ptr_conv.is_owned = false;
16127 LDKCVec_u64Z val_constr;
16128 val_constr.datalen = (*env)->GetArrayLength(env, val);
16129 if (val_constr.datalen > 0)
16130 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16132 val_constr.data = NULL;
16133 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16134 for (size_t g = 0; g < val_constr.datalen; g++) {
16135 int64_t val_conv_6 = val_vals[g];
16136 val_constr.data[g] = val_conv_6;
16138 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16139 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
16142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
16143 LDKThirtyTwoBytes chain_hash_arg_ref;
16144 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
16145 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
16146 LDKCVec_u64Z short_channel_ids_arg_constr;
16147 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
16148 if (short_channel_ids_arg_constr.datalen > 0)
16149 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16151 short_channel_ids_arg_constr.data = NULL;
16152 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
16153 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
16154 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
16155 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
16157 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
16158 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
16159 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16160 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16161 long ret_ref = (long)ret_var.inner;
16162 if (ret_var.is_owned) {
16168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16169 LDKQueryShortChannelIds orig_conv;
16170 orig_conv.inner = (void*)(orig & (~1));
16171 orig_conv.is_owned = false;
16172 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
16173 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16174 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16175 long ret_ref = (long)ret_var.inner;
16176 if (ret_var.is_owned) {
16182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16183 LDKReplyShortChannelIdsEnd this_obj_conv;
16184 this_obj_conv.inner = (void*)(this_obj & (~1));
16185 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16186 ReplyShortChannelIdsEnd_free(this_obj_conv);
16189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16190 LDKReplyShortChannelIdsEnd this_ptr_conv;
16191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16192 this_ptr_conv.is_owned = false;
16193 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16194 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
16198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16199 LDKReplyShortChannelIdsEnd this_ptr_conv;
16200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16201 this_ptr_conv.is_owned = false;
16202 LDKThirtyTwoBytes val_ref;
16203 CHECK((*env)->GetArrayLength(env, val) == 32);
16204 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16205 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
16208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
16209 LDKReplyShortChannelIdsEnd this_ptr_conv;
16210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16211 this_ptr_conv.is_owned = false;
16212 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
16216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16217 LDKReplyShortChannelIdsEnd this_ptr_conv;
16218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16219 this_ptr_conv.is_owned = false;
16220 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
16223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
16224 LDKThirtyTwoBytes chain_hash_arg_ref;
16225 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
16226 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
16227 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
16228 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16229 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16230 long ret_ref = (long)ret_var.inner;
16231 if (ret_var.is_owned) {
16237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16238 LDKReplyShortChannelIdsEnd orig_conv;
16239 orig_conv.inner = (void*)(orig & (~1));
16240 orig_conv.is_owned = false;
16241 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
16242 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16243 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16244 long ret_ref = (long)ret_var.inner;
16245 if (ret_var.is_owned) {
16251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16252 LDKGossipTimestampFilter this_obj_conv;
16253 this_obj_conv.inner = (void*)(this_obj & (~1));
16254 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16255 GossipTimestampFilter_free(this_obj_conv);
16258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16259 LDKGossipTimestampFilter this_ptr_conv;
16260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16261 this_ptr_conv.is_owned = false;
16262 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16263 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
16267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16268 LDKGossipTimestampFilter this_ptr_conv;
16269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16270 this_ptr_conv.is_owned = false;
16271 LDKThirtyTwoBytes val_ref;
16272 CHECK((*env)->GetArrayLength(env, val) == 32);
16273 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16274 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
16277 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
16278 LDKGossipTimestampFilter this_ptr_conv;
16279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16280 this_ptr_conv.is_owned = false;
16281 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
16285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16286 LDKGossipTimestampFilter this_ptr_conv;
16287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16288 this_ptr_conv.is_owned = false;
16289 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
16292 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
16293 LDKGossipTimestampFilter this_ptr_conv;
16294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16295 this_ptr_conv.is_owned = false;
16296 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
16300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16301 LDKGossipTimestampFilter this_ptr_conv;
16302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16303 this_ptr_conv.is_owned = false;
16304 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
16307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
16308 LDKThirtyTwoBytes chain_hash_arg_ref;
16309 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
16310 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
16311 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
16312 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16313 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16314 long ret_ref = (long)ret_var.inner;
16315 if (ret_var.is_owned) {
16321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16322 LDKGossipTimestampFilter orig_conv;
16323 orig_conv.inner = (void*)(orig & (~1));
16324 orig_conv.is_owned = false;
16325 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
16326 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16327 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16328 long ret_ref = (long)ret_var.inner;
16329 if (ret_var.is_owned) {
16335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16336 if ((this_ptr & 1) != 0) return;
16337 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
16338 FREE((void*)this_ptr);
16339 ErrorAction_free(this_ptr_conv);
16342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16343 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
16344 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
16345 *ret_copy = ErrorAction_clone(orig_conv);
16346 long ret_ref = (long)ret_copy;
16350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16351 LDKLightningError this_obj_conv;
16352 this_obj_conv.inner = (void*)(this_obj & (~1));
16353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16354 LightningError_free(this_obj_conv);
16357 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
16358 LDKLightningError this_ptr_conv;
16359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16360 this_ptr_conv.is_owned = false;
16361 LDKStr _str = LightningError_get_err(&this_ptr_conv);
16362 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
16366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16367 LDKLightningError this_ptr_conv;
16368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16369 this_ptr_conv.is_owned = false;
16370 LDKCVec_u8Z val_ref;
16371 val_ref.datalen = (*env)->GetArrayLength(env, val);
16372 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
16373 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
16374 LightningError_set_err(&this_ptr_conv, val_ref);
16377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
16378 LDKLightningError this_ptr_conv;
16379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16380 this_ptr_conv.is_owned = false;
16381 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
16382 *ret_copy = LightningError_get_action(&this_ptr_conv);
16383 long ret_ref = (long)ret_copy;
16387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16388 LDKLightningError this_ptr_conv;
16389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16390 this_ptr_conv.is_owned = false;
16391 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
16393 LightningError_set_action(&this_ptr_conv, val_conv);
16396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
16397 LDKCVec_u8Z err_arg_ref;
16398 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
16399 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
16400 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
16401 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
16402 FREE((void*)action_arg);
16403 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
16404 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16405 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16406 long ret_ref = (long)ret_var.inner;
16407 if (ret_var.is_owned) {
16413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16414 LDKLightningError orig_conv;
16415 orig_conv.inner = (void*)(orig & (~1));
16416 orig_conv.is_owned = false;
16417 LDKLightningError ret_var = LightningError_clone(&orig_conv);
16418 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16419 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16420 long ret_ref = (long)ret_var.inner;
16421 if (ret_var.is_owned) {
16427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16428 LDKCommitmentUpdate this_obj_conv;
16429 this_obj_conv.inner = (void*)(this_obj & (~1));
16430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16431 CommitmentUpdate_free(this_obj_conv);
16434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16435 LDKCommitmentUpdate this_ptr_conv;
16436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16437 this_ptr_conv.is_owned = false;
16438 LDKCVec_UpdateAddHTLCZ val_constr;
16439 val_constr.datalen = (*env)->GetArrayLength(env, val);
16440 if (val_constr.datalen > 0)
16441 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
16443 val_constr.data = NULL;
16444 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16445 for (size_t p = 0; p < val_constr.datalen; p++) {
16446 int64_t val_conv_15 = val_vals[p];
16447 LDKUpdateAddHTLC val_conv_15_conv;
16448 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
16449 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
16450 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
16451 val_constr.data[p] = val_conv_15_conv;
16453 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16454 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
16457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16458 LDKCommitmentUpdate this_ptr_conv;
16459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16460 this_ptr_conv.is_owned = false;
16461 LDKCVec_UpdateFulfillHTLCZ val_constr;
16462 val_constr.datalen = (*env)->GetArrayLength(env, val);
16463 if (val_constr.datalen > 0)
16464 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
16466 val_constr.data = NULL;
16467 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16468 for (size_t t = 0; t < val_constr.datalen; t++) {
16469 int64_t val_conv_19 = val_vals[t];
16470 LDKUpdateFulfillHTLC val_conv_19_conv;
16471 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
16472 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
16473 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
16474 val_constr.data[t] = val_conv_19_conv;
16476 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16477 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
16480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16481 LDKCommitmentUpdate this_ptr_conv;
16482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16483 this_ptr_conv.is_owned = false;
16484 LDKCVec_UpdateFailHTLCZ val_constr;
16485 val_constr.datalen = (*env)->GetArrayLength(env, val);
16486 if (val_constr.datalen > 0)
16487 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
16489 val_constr.data = NULL;
16490 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16491 for (size_t q = 0; q < val_constr.datalen; q++) {
16492 int64_t val_conv_16 = val_vals[q];
16493 LDKUpdateFailHTLC val_conv_16_conv;
16494 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
16495 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
16496 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
16497 val_constr.data[q] = val_conv_16_conv;
16499 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16500 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
16503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16504 LDKCommitmentUpdate this_ptr_conv;
16505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16506 this_ptr_conv.is_owned = false;
16507 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
16508 val_constr.datalen = (*env)->GetArrayLength(env, val);
16509 if (val_constr.datalen > 0)
16510 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
16512 val_constr.data = NULL;
16513 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16514 for (size_t z = 0; z < val_constr.datalen; z++) {
16515 int64_t val_conv_25 = val_vals[z];
16516 LDKUpdateFailMalformedHTLC val_conv_25_conv;
16517 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
16518 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
16519 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
16520 val_constr.data[z] = val_conv_25_conv;
16522 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16523 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
16526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
16527 LDKCommitmentUpdate this_ptr_conv;
16528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16529 this_ptr_conv.is_owned = false;
16530 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
16531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16533 long ret_ref = (long)ret_var.inner;
16534 if (ret_var.is_owned) {
16540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16541 LDKCommitmentUpdate this_ptr_conv;
16542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16543 this_ptr_conv.is_owned = false;
16544 LDKUpdateFee val_conv;
16545 val_conv.inner = (void*)(val & (~1));
16546 val_conv.is_owned = (val & 1) || (val == 0);
16547 val_conv = UpdateFee_clone(&val_conv);
16548 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
16551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
16552 LDKCommitmentUpdate this_ptr_conv;
16553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16554 this_ptr_conv.is_owned = false;
16555 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
16556 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16557 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16558 long ret_ref = (long)ret_var.inner;
16559 if (ret_var.is_owned) {
16565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16566 LDKCommitmentUpdate this_ptr_conv;
16567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16568 this_ptr_conv.is_owned = false;
16569 LDKCommitmentSigned val_conv;
16570 val_conv.inner = (void*)(val & (~1));
16571 val_conv.is_owned = (val & 1) || (val == 0);
16572 val_conv = CommitmentSigned_clone(&val_conv);
16573 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
16576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv *env, jclass clz, int64_tArray update_add_htlcs_arg, int64_tArray update_fulfill_htlcs_arg, int64_tArray update_fail_htlcs_arg, int64_tArray update_fail_malformed_htlcs_arg, int64_t update_fee_arg, int64_t commitment_signed_arg) {
16577 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
16578 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
16579 if (update_add_htlcs_arg_constr.datalen > 0)
16580 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
16582 update_add_htlcs_arg_constr.data = NULL;
16583 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
16584 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
16585 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
16586 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
16587 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
16588 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
16589 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
16590 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
16592 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
16593 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
16594 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
16595 if (update_fulfill_htlcs_arg_constr.datalen > 0)
16596 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
16598 update_fulfill_htlcs_arg_constr.data = NULL;
16599 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
16600 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
16601 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
16602 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
16603 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
16604 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
16605 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
16606 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
16608 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
16609 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
16610 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
16611 if (update_fail_htlcs_arg_constr.datalen > 0)
16612 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
16614 update_fail_htlcs_arg_constr.data = NULL;
16615 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
16616 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
16617 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
16618 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
16619 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
16620 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
16621 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
16622 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
16624 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
16625 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
16626 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
16627 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
16628 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
16630 update_fail_malformed_htlcs_arg_constr.data = NULL;
16631 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
16632 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
16633 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
16634 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
16635 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
16636 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0);
16637 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
16638 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
16640 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
16641 LDKUpdateFee update_fee_arg_conv;
16642 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
16643 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
16644 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
16645 LDKCommitmentSigned commitment_signed_arg_conv;
16646 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
16647 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
16648 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
16649 LDKCommitmentUpdate ret_var = CommitmentUpdate_new(update_add_htlcs_arg_constr, update_fulfill_htlcs_arg_constr, update_fail_htlcs_arg_constr, update_fail_malformed_htlcs_arg_constr, update_fee_arg_conv, commitment_signed_arg_conv);
16650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16652 long ret_ref = (long)ret_var.inner;
16653 if (ret_var.is_owned) {
16659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16660 LDKCommitmentUpdate orig_conv;
16661 orig_conv.inner = (void*)(orig & (~1));
16662 orig_conv.is_owned = false;
16663 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
16664 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16665 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16666 long ret_ref = (long)ret_var.inner;
16667 if (ret_var.is_owned) {
16673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16674 if ((this_ptr & 1) != 0) return;
16675 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
16676 FREE((void*)this_ptr);
16677 HTLCFailChannelUpdate_free(this_ptr_conv);
16680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16681 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
16682 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
16683 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
16684 long ret_ref = (long)ret_copy;
16688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16689 if ((this_ptr & 1) != 0) return;
16690 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
16691 FREE((void*)this_ptr);
16692 ChannelMessageHandler_free(this_ptr_conv);
16695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16696 if ((this_ptr & 1) != 0) return;
16697 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
16698 FREE((void*)this_ptr);
16699 RoutingMessageHandler_free(this_ptr_conv);
16702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
16703 LDKAcceptChannel obj_conv;
16704 obj_conv.inner = (void*)(obj & (~1));
16705 obj_conv.is_owned = false;
16706 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
16707 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16708 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16709 CVec_u8Z_free(ret_var);
16713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16714 LDKu8slice ser_ref;
16715 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16716 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16717 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
16718 *ret_conv = AcceptChannel_read(ser_ref);
16719 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16720 return (long)ret_conv;
16723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
16724 LDKAnnouncementSignatures obj_conv;
16725 obj_conv.inner = (void*)(obj & (~1));
16726 obj_conv.is_owned = false;
16727 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
16728 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16729 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16730 CVec_u8Z_free(ret_var);
16734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16735 LDKu8slice ser_ref;
16736 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16737 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16738 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
16739 *ret_conv = AnnouncementSignatures_read(ser_ref);
16740 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16741 return (long)ret_conv;
16744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
16745 LDKChannelReestablish obj_conv;
16746 obj_conv.inner = (void*)(obj & (~1));
16747 obj_conv.is_owned = false;
16748 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
16749 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16750 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16751 CVec_u8Z_free(ret_var);
16755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16756 LDKu8slice ser_ref;
16757 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16758 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16759 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
16760 *ret_conv = ChannelReestablish_read(ser_ref);
16761 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16762 return (long)ret_conv;
16765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16766 LDKClosingSigned obj_conv;
16767 obj_conv.inner = (void*)(obj & (~1));
16768 obj_conv.is_owned = false;
16769 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
16770 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16771 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16772 CVec_u8Z_free(ret_var);
16776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16777 LDKu8slice ser_ref;
16778 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16779 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16780 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
16781 *ret_conv = ClosingSigned_read(ser_ref);
16782 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16783 return (long)ret_conv;
16786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16787 LDKCommitmentSigned obj_conv;
16788 obj_conv.inner = (void*)(obj & (~1));
16789 obj_conv.is_owned = false;
16790 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
16791 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16792 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16793 CVec_u8Z_free(ret_var);
16797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16798 LDKu8slice ser_ref;
16799 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16800 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16801 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
16802 *ret_conv = CommitmentSigned_read(ser_ref);
16803 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16804 return (long)ret_conv;
16807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
16808 LDKFundingCreated obj_conv;
16809 obj_conv.inner = (void*)(obj & (~1));
16810 obj_conv.is_owned = false;
16811 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
16812 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16813 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16814 CVec_u8Z_free(ret_var);
16818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16819 LDKu8slice ser_ref;
16820 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16821 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16822 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
16823 *ret_conv = FundingCreated_read(ser_ref);
16824 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16825 return (long)ret_conv;
16828 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
16829 LDKFundingSigned obj_conv;
16830 obj_conv.inner = (void*)(obj & (~1));
16831 obj_conv.is_owned = false;
16832 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
16833 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16834 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16835 CVec_u8Z_free(ret_var);
16839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16840 LDKu8slice ser_ref;
16841 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16842 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16843 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16844 *ret_conv = FundingSigned_read(ser_ref);
16845 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16846 return (long)ret_conv;
16849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
16850 LDKFundingLocked obj_conv;
16851 obj_conv.inner = (void*)(obj & (~1));
16852 obj_conv.is_owned = false;
16853 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
16854 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16855 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16856 CVec_u8Z_free(ret_var);
16860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16861 LDKu8slice ser_ref;
16862 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16863 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16864 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16865 *ret_conv = FundingLocked_read(ser_ref);
16866 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16867 return (long)ret_conv;
16870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
16872 obj_conv.inner = (void*)(obj & (~1));
16873 obj_conv.is_owned = false;
16874 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
16875 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16876 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16877 CVec_u8Z_free(ret_var);
16881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16882 LDKu8slice ser_ref;
16883 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16884 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16885 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16886 *ret_conv = Init_read(ser_ref);
16887 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16888 return (long)ret_conv;
16891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
16892 LDKOpenChannel obj_conv;
16893 obj_conv.inner = (void*)(obj & (~1));
16894 obj_conv.is_owned = false;
16895 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
16896 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16897 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16898 CVec_u8Z_free(ret_var);
16902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16903 LDKu8slice ser_ref;
16904 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16905 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16906 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16907 *ret_conv = OpenChannel_read(ser_ref);
16908 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16909 return (long)ret_conv;
16912 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
16913 LDKRevokeAndACK obj_conv;
16914 obj_conv.inner = (void*)(obj & (~1));
16915 obj_conv.is_owned = false;
16916 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
16917 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16918 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16919 CVec_u8Z_free(ret_var);
16923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16924 LDKu8slice ser_ref;
16925 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16926 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16927 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16928 *ret_conv = RevokeAndACK_read(ser_ref);
16929 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16930 return (long)ret_conv;
16933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
16934 LDKShutdown obj_conv;
16935 obj_conv.inner = (void*)(obj & (~1));
16936 obj_conv.is_owned = false;
16937 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
16938 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16939 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16940 CVec_u8Z_free(ret_var);
16944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16945 LDKu8slice ser_ref;
16946 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16947 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16948 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16949 *ret_conv = Shutdown_read(ser_ref);
16950 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16951 return (long)ret_conv;
16954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16955 LDKUpdateFailHTLC obj_conv;
16956 obj_conv.inner = (void*)(obj & (~1));
16957 obj_conv.is_owned = false;
16958 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
16959 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16960 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16961 CVec_u8Z_free(ret_var);
16965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16966 LDKu8slice ser_ref;
16967 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16968 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16969 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16970 *ret_conv = UpdateFailHTLC_read(ser_ref);
16971 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16972 return (long)ret_conv;
16975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
16976 LDKUpdateFailMalformedHTLC obj_conv;
16977 obj_conv.inner = (void*)(obj & (~1));
16978 obj_conv.is_owned = false;
16979 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
16980 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16981 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16982 CVec_u8Z_free(ret_var);
16986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16987 LDKu8slice ser_ref;
16988 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16989 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16990 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16991 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
16992 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16993 return (long)ret_conv;
16996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
16997 LDKUpdateFee obj_conv;
16998 obj_conv.inner = (void*)(obj & (~1));
16999 obj_conv.is_owned = false;
17000 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
17001 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17002 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17003 CVec_u8Z_free(ret_var);
17007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17008 LDKu8slice ser_ref;
17009 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17010 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17011 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
17012 *ret_conv = UpdateFee_read(ser_ref);
17013 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17014 return (long)ret_conv;
17017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
17018 LDKUpdateFulfillHTLC obj_conv;
17019 obj_conv.inner = (void*)(obj & (~1));
17020 obj_conv.is_owned = false;
17021 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
17022 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17023 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17024 CVec_u8Z_free(ret_var);
17028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17029 LDKu8slice ser_ref;
17030 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17031 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17032 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
17033 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
17034 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17035 return (long)ret_conv;
17038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
17039 LDKUpdateAddHTLC obj_conv;
17040 obj_conv.inner = (void*)(obj & (~1));
17041 obj_conv.is_owned = false;
17042 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
17043 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17044 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17045 CVec_u8Z_free(ret_var);
17049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17050 LDKu8slice ser_ref;
17051 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17052 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17053 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
17054 *ret_conv = UpdateAddHTLC_read(ser_ref);
17055 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17056 return (long)ret_conv;
17059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
17061 obj_conv.inner = (void*)(obj & (~1));
17062 obj_conv.is_owned = false;
17063 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
17064 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17065 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17066 CVec_u8Z_free(ret_var);
17070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17071 LDKu8slice ser_ref;
17072 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17073 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17074 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
17075 *ret_conv = Ping_read(ser_ref);
17076 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17077 return (long)ret_conv;
17080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
17082 obj_conv.inner = (void*)(obj & (~1));
17083 obj_conv.is_owned = false;
17084 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
17085 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17086 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17087 CVec_u8Z_free(ret_var);
17091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17092 LDKu8slice ser_ref;
17093 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17094 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17095 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
17096 *ret_conv = Pong_read(ser_ref);
17097 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17098 return (long)ret_conv;
17101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
17102 LDKUnsignedChannelAnnouncement obj_conv;
17103 obj_conv.inner = (void*)(obj & (~1));
17104 obj_conv.is_owned = false;
17105 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
17106 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17107 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17108 CVec_u8Z_free(ret_var);
17112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17113 LDKu8slice ser_ref;
17114 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17115 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17116 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
17117 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
17118 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17119 return (long)ret_conv;
17122 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
17123 LDKChannelAnnouncement obj_conv;
17124 obj_conv.inner = (void*)(obj & (~1));
17125 obj_conv.is_owned = false;
17126 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
17127 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17128 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17129 CVec_u8Z_free(ret_var);
17133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17134 LDKu8slice ser_ref;
17135 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17136 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17137 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
17138 *ret_conv = ChannelAnnouncement_read(ser_ref);
17139 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17140 return (long)ret_conv;
17143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
17144 LDKUnsignedChannelUpdate obj_conv;
17145 obj_conv.inner = (void*)(obj & (~1));
17146 obj_conv.is_owned = false;
17147 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
17148 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17149 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17150 CVec_u8Z_free(ret_var);
17154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17155 LDKu8slice ser_ref;
17156 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17157 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17158 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
17159 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
17160 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17161 return (long)ret_conv;
17164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
17165 LDKChannelUpdate obj_conv;
17166 obj_conv.inner = (void*)(obj & (~1));
17167 obj_conv.is_owned = false;
17168 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
17169 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17170 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17171 CVec_u8Z_free(ret_var);
17175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17176 LDKu8slice ser_ref;
17177 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17178 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17179 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
17180 *ret_conv = ChannelUpdate_read(ser_ref);
17181 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17182 return (long)ret_conv;
17185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
17186 LDKErrorMessage obj_conv;
17187 obj_conv.inner = (void*)(obj & (~1));
17188 obj_conv.is_owned = false;
17189 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
17190 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17191 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17192 CVec_u8Z_free(ret_var);
17196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17197 LDKu8slice ser_ref;
17198 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17199 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17200 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
17201 *ret_conv = ErrorMessage_read(ser_ref);
17202 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17203 return (long)ret_conv;
17206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
17207 LDKUnsignedNodeAnnouncement obj_conv;
17208 obj_conv.inner = (void*)(obj & (~1));
17209 obj_conv.is_owned = false;
17210 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
17211 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17212 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17213 CVec_u8Z_free(ret_var);
17217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17218 LDKu8slice ser_ref;
17219 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17220 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17221 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
17222 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
17223 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17224 return (long)ret_conv;
17227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
17228 LDKNodeAnnouncement obj_conv;
17229 obj_conv.inner = (void*)(obj & (~1));
17230 obj_conv.is_owned = false;
17231 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
17232 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17233 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17234 CVec_u8Z_free(ret_var);
17238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17239 LDKu8slice ser_ref;
17240 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17241 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17242 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
17243 *ret_conv = NodeAnnouncement_read(ser_ref);
17244 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17245 return (long)ret_conv;
17248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17249 LDKu8slice ser_ref;
17250 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17251 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17252 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
17253 *ret_conv = QueryShortChannelIds_read(ser_ref);
17254 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17255 return (long)ret_conv;
17258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
17259 LDKQueryShortChannelIds obj_conv;
17260 obj_conv.inner = (void*)(obj & (~1));
17261 obj_conv.is_owned = false;
17262 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
17263 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17264 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17265 CVec_u8Z_free(ret_var);
17269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17270 LDKu8slice ser_ref;
17271 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17272 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17273 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
17274 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
17275 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17276 return (long)ret_conv;
17279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
17280 LDKReplyShortChannelIdsEnd obj_conv;
17281 obj_conv.inner = (void*)(obj & (~1));
17282 obj_conv.is_owned = false;
17283 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
17284 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17285 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17286 CVec_u8Z_free(ret_var);
17290 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
17291 LDKQueryChannelRange this_arg_conv;
17292 this_arg_conv.inner = (void*)(this_arg & (~1));
17293 this_arg_conv.is_owned = false;
17294 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
17298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17299 LDKu8slice ser_ref;
17300 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17301 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17302 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
17303 *ret_conv = QueryChannelRange_read(ser_ref);
17304 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17305 return (long)ret_conv;
17308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
17309 LDKQueryChannelRange obj_conv;
17310 obj_conv.inner = (void*)(obj & (~1));
17311 obj_conv.is_owned = false;
17312 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
17313 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17314 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17315 CVec_u8Z_free(ret_var);
17319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17320 LDKu8slice ser_ref;
17321 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17322 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17323 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
17324 *ret_conv = ReplyChannelRange_read(ser_ref);
17325 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17326 return (long)ret_conv;
17329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
17330 LDKReplyChannelRange obj_conv;
17331 obj_conv.inner = (void*)(obj & (~1));
17332 obj_conv.is_owned = false;
17333 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
17334 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17335 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17336 CVec_u8Z_free(ret_var);
17340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17341 LDKu8slice ser_ref;
17342 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17343 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17344 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
17345 *ret_conv = GossipTimestampFilter_read(ser_ref);
17346 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17347 return (long)ret_conv;
17350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
17351 LDKGossipTimestampFilter obj_conv;
17352 obj_conv.inner = (void*)(obj & (~1));
17353 obj_conv.is_owned = false;
17354 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
17355 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17356 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17357 CVec_u8Z_free(ret_var);
17361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17362 LDKIgnoringMessageHandler this_obj_conv;
17363 this_obj_conv.inner = (void*)(this_obj & (~1));
17364 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17365 IgnoringMessageHandler_free(this_obj_conv);
17368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
17369 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
17370 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17371 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17372 long ret_ref = (long)ret_var.inner;
17373 if (ret_var.is_owned) {
17379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17380 LDKIgnoringMessageHandler this_arg_conv;
17381 this_arg_conv.inner = (void*)(this_arg & (~1));
17382 this_arg_conv.is_owned = false;
17383 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17384 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
17388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
17389 LDKIgnoringMessageHandler this_arg_conv;
17390 this_arg_conv.inner = (void*)(this_arg & (~1));
17391 this_arg_conv.is_owned = false;
17392 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
17393 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
17397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17398 LDKErroringMessageHandler this_obj_conv;
17399 this_obj_conv.inner = (void*)(this_obj & (~1));
17400 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17401 ErroringMessageHandler_free(this_obj_conv);
17404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
17405 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
17406 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17407 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17408 long ret_ref = (long)ret_var.inner;
17409 if (ret_var.is_owned) {
17415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17416 LDKErroringMessageHandler this_arg_conv;
17417 this_arg_conv.inner = (void*)(this_arg & (~1));
17418 this_arg_conv.is_owned = false;
17419 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17420 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
17424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
17425 LDKErroringMessageHandler this_arg_conv;
17426 this_arg_conv.inner = (void*)(this_arg & (~1));
17427 this_arg_conv.is_owned = false;
17428 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17429 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
17433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17434 LDKMessageHandler this_obj_conv;
17435 this_obj_conv.inner = (void*)(this_obj & (~1));
17436 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17437 MessageHandler_free(this_obj_conv);
17440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
17441 LDKMessageHandler this_ptr_conv;
17442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17443 this_ptr_conv.is_owned = false;
17444 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
17448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17449 LDKMessageHandler this_ptr_conv;
17450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17451 this_ptr_conv.is_owned = false;
17452 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
17453 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
17454 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17455 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
17457 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
17460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
17461 LDKMessageHandler this_ptr_conv;
17462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17463 this_ptr_conv.is_owned = false;
17464 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
17468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17469 LDKMessageHandler this_ptr_conv;
17470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17471 this_ptr_conv.is_owned = false;
17472 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
17473 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
17474 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17475 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
17477 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
17480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv *env, jclass clz, int64_t chan_handler_arg, int64_t route_handler_arg) {
17481 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
17482 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
17483 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17484 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
17486 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
17487 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
17488 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17489 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
17491 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
17492 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17493 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17494 long ret_ref = (long)ret_var.inner;
17495 if (ret_var.is_owned) {
17501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17502 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
17503 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17504 *ret = SocketDescriptor_clone(orig_conv);
17508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17509 if ((this_ptr & 1) != 0) return;
17510 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
17511 FREE((void*)this_ptr);
17512 SocketDescriptor_free(this_ptr_conv);
17515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17516 LDKPeerHandleError this_obj_conv;
17517 this_obj_conv.inner = (void*)(this_obj & (~1));
17518 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17519 PeerHandleError_free(this_obj_conv);
17522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
17523 LDKPeerHandleError this_ptr_conv;
17524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17525 this_ptr_conv.is_owned = false;
17526 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
17530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17531 LDKPeerHandleError this_ptr_conv;
17532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17533 this_ptr_conv.is_owned = false;
17534 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
17537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
17538 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
17539 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17540 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17541 long ret_ref = (long)ret_var.inner;
17542 if (ret_var.is_owned) {
17548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17549 LDKPeerHandleError orig_conv;
17550 orig_conv.inner = (void*)(orig & (~1));
17551 orig_conv.is_owned = false;
17552 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
17553 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17554 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17555 long ret_ref = (long)ret_var.inner;
17556 if (ret_var.is_owned) {
17562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17563 LDKPeerManager this_obj_conv;
17564 this_obj_conv.inner = (void*)(this_obj & (~1));
17565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17566 PeerManager_free(this_obj_conv);
17569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger) {
17570 LDKMessageHandler message_handler_conv;
17571 message_handler_conv.inner = (void*)(message_handler & (~1));
17572 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
17573 // Warning: we need a move here but no clone is available for LDKMessageHandler
17574 LDKSecretKey our_node_secret_ref;
17575 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
17576 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
17577 unsigned char ephemeral_random_data_arr[32];
17578 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
17579 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
17580 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
17581 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17582 if (logger_conv.free == LDKLogger_JCalls_free) {
17583 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17584 LDKLogger_JCalls_clone(logger_conv.this_arg);
17586 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
17587 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17588 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17589 long ret_ref = (long)ret_var.inner;
17590 if (ret_var.is_owned) {
17596 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
17597 LDKPeerManager this_arg_conv;
17598 this_arg_conv.inner = (void*)(this_arg & (~1));
17599 this_arg_conv.is_owned = false;
17600 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
17601 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
17603 for (size_t i = 0; i < ret_var.datalen; i++) {
17604 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
17605 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
17606 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
17608 FREE(ret_var.data);
17612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor) {
17613 LDKPeerManager this_arg_conv;
17614 this_arg_conv.inner = (void*)(this_arg & (~1));
17615 this_arg_conv.is_owned = false;
17616 LDKPublicKey their_node_id_ref;
17617 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17618 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17619 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17620 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
17621 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17622 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
17624 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17625 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
17626 return (long)ret_conv;
17629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
17630 LDKPeerManager this_arg_conv;
17631 this_arg_conv.inner = (void*)(this_arg & (~1));
17632 this_arg_conv.is_owned = false;
17633 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17634 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
17635 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17636 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
17638 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17639 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
17640 return (long)ret_conv;
17643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
17644 LDKPeerManager this_arg_conv;
17645 this_arg_conv.inner = (void*)(this_arg & (~1));
17646 this_arg_conv.is_owned = false;
17647 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17648 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17649 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
17650 return (long)ret_conv;
17653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
17654 LDKPeerManager this_arg_conv;
17655 this_arg_conv.inner = (void*)(this_arg & (~1));
17656 this_arg_conv.is_owned = false;
17657 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
17658 LDKu8slice data_ref;
17659 data_ref.datalen = (*env)->GetArrayLength(env, data);
17660 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
17661 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17662 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
17663 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
17664 return (long)ret_conv;
17667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17668 LDKPeerManager this_arg_conv;
17669 this_arg_conv.inner = (void*)(this_arg & (~1));
17670 this_arg_conv.is_owned = false;
17671 PeerManager_process_events(&this_arg_conv);
17674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
17675 LDKPeerManager this_arg_conv;
17676 this_arg_conv.inner = (void*)(this_arg & (~1));
17677 this_arg_conv.is_owned = false;
17678 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
17679 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
17682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
17683 LDKPeerManager this_arg_conv;
17684 this_arg_conv.inner = (void*)(this_arg & (~1));
17685 this_arg_conv.is_owned = false;
17686 LDKPublicKey node_id_ref;
17687 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17688 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17689 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
17692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
17693 LDKPeerManager this_arg_conv;
17694 this_arg_conv.inner = (void*)(this_arg & (~1));
17695 this_arg_conv.is_owned = false;
17696 PeerManager_timer_tick_occurred(&this_arg_conv);
17699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
17700 unsigned char commitment_seed_arr[32];
17701 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
17702 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
17703 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
17704 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17705 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
17709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
17710 LDKPublicKey per_commitment_point_ref;
17711 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17712 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17713 unsigned char base_secret_arr[32];
17714 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
17715 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
17716 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
17717 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
17718 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
17719 return (long)ret_conv;
17722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
17723 LDKPublicKey per_commitment_point_ref;
17724 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17725 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17726 LDKPublicKey base_point_ref;
17727 CHECK((*env)->GetArrayLength(env, base_point) == 33);
17728 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
17729 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17730 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
17731 return (long)ret_conv;
17734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
17735 unsigned char per_commitment_secret_arr[32];
17736 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
17737 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
17738 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
17739 unsigned char countersignatory_revocation_base_secret_arr[32];
17740 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
17741 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
17742 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
17743 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
17744 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
17745 return (long)ret_conv;
17748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
17749 LDKPublicKey per_commitment_point_ref;
17750 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
17751 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
17752 LDKPublicKey countersignatory_revocation_base_point_ref;
17753 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
17754 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
17755 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17756 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
17757 return (long)ret_conv;
17760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17761 LDKTxCreationKeys this_obj_conv;
17762 this_obj_conv.inner = (void*)(this_obj & (~1));
17763 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17764 TxCreationKeys_free(this_obj_conv);
17767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17768 LDKTxCreationKeys this_ptr_conv;
17769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17770 this_ptr_conv.is_owned = false;
17771 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17772 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
17776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17777 LDKTxCreationKeys this_ptr_conv;
17778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17779 this_ptr_conv.is_owned = false;
17780 LDKPublicKey val_ref;
17781 CHECK((*env)->GetArrayLength(env, val) == 33);
17782 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17783 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
17786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17787 LDKTxCreationKeys this_ptr_conv;
17788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17789 this_ptr_conv.is_owned = false;
17790 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17791 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
17795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17796 LDKTxCreationKeys this_ptr_conv;
17797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17798 this_ptr_conv.is_owned = false;
17799 LDKPublicKey val_ref;
17800 CHECK((*env)->GetArrayLength(env, val) == 33);
17801 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17802 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
17805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17806 LDKTxCreationKeys this_ptr_conv;
17807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17808 this_ptr_conv.is_owned = false;
17809 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17810 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
17814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17815 LDKTxCreationKeys this_ptr_conv;
17816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17817 this_ptr_conv.is_owned = false;
17818 LDKPublicKey val_ref;
17819 CHECK((*env)->GetArrayLength(env, val) == 33);
17820 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17821 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
17824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17825 LDKTxCreationKeys this_ptr_conv;
17826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17827 this_ptr_conv.is_owned = false;
17828 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17829 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
17833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17834 LDKTxCreationKeys this_ptr_conv;
17835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17836 this_ptr_conv.is_owned = false;
17837 LDKPublicKey val_ref;
17838 CHECK((*env)->GetArrayLength(env, val) == 33);
17839 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17840 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
17843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17844 LDKTxCreationKeys this_ptr_conv;
17845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17846 this_ptr_conv.is_owned = false;
17847 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17848 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
17852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17853 LDKTxCreationKeys this_ptr_conv;
17854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17855 this_ptr_conv.is_owned = false;
17856 LDKPublicKey val_ref;
17857 CHECK((*env)->GetArrayLength(env, val) == 33);
17858 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17859 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
17862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
17863 LDKPublicKey per_commitment_point_arg_ref;
17864 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
17865 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
17866 LDKPublicKey revocation_key_arg_ref;
17867 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
17868 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
17869 LDKPublicKey broadcaster_htlc_key_arg_ref;
17870 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
17871 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
17872 LDKPublicKey countersignatory_htlc_key_arg_ref;
17873 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
17874 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
17875 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
17876 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
17877 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
17878 LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
17879 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17880 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17881 long ret_ref = (long)ret_var.inner;
17882 if (ret_var.is_owned) {
17888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17889 LDKTxCreationKeys orig_conv;
17890 orig_conv.inner = (void*)(orig & (~1));
17891 orig_conv.is_owned = false;
17892 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
17893 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17894 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17895 long ret_ref = (long)ret_var.inner;
17896 if (ret_var.is_owned) {
17902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
17903 LDKTxCreationKeys obj_conv;
17904 obj_conv.inner = (void*)(obj & (~1));
17905 obj_conv.is_owned = false;
17906 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
17907 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17908 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17909 CVec_u8Z_free(ret_var);
17913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17914 LDKu8slice ser_ref;
17915 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17916 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17917 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
17918 *ret_conv = TxCreationKeys_read(ser_ref);
17919 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17920 return (long)ret_conv;
17923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17924 LDKChannelPublicKeys this_obj_conv;
17925 this_obj_conv.inner = (void*)(this_obj & (~1));
17926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17927 ChannelPublicKeys_free(this_obj_conv);
17930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17931 LDKChannelPublicKeys this_ptr_conv;
17932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17933 this_ptr_conv.is_owned = false;
17934 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17935 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
17939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17940 LDKChannelPublicKeys this_ptr_conv;
17941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17942 this_ptr_conv.is_owned = false;
17943 LDKPublicKey val_ref;
17944 CHECK((*env)->GetArrayLength(env, val) == 33);
17945 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17946 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
17949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17950 LDKChannelPublicKeys this_ptr_conv;
17951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17952 this_ptr_conv.is_owned = false;
17953 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17954 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
17958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17959 LDKChannelPublicKeys this_ptr_conv;
17960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17961 this_ptr_conv.is_owned = false;
17962 LDKPublicKey val_ref;
17963 CHECK((*env)->GetArrayLength(env, val) == 33);
17964 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17965 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
17968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17969 LDKChannelPublicKeys this_ptr_conv;
17970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17971 this_ptr_conv.is_owned = false;
17972 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17973 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
17977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17978 LDKChannelPublicKeys this_ptr_conv;
17979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17980 this_ptr_conv.is_owned = false;
17981 LDKPublicKey val_ref;
17982 CHECK((*env)->GetArrayLength(env, val) == 33);
17983 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17984 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
17987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17988 LDKChannelPublicKeys this_ptr_conv;
17989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17990 this_ptr_conv.is_owned = false;
17991 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17992 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
17996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17997 LDKChannelPublicKeys this_ptr_conv;
17998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17999 this_ptr_conv.is_owned = false;
18000 LDKPublicKey val_ref;
18001 CHECK((*env)->GetArrayLength(env, val) == 33);
18002 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18003 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
18006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18007 LDKChannelPublicKeys this_ptr_conv;
18008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18009 this_ptr_conv.is_owned = false;
18010 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18011 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
18015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18016 LDKChannelPublicKeys this_ptr_conv;
18017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18018 this_ptr_conv.is_owned = false;
18019 LDKPublicKey val_ref;
18020 CHECK((*env)->GetArrayLength(env, val) == 33);
18021 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18022 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
18025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg) {
18026 LDKPublicKey funding_pubkey_arg_ref;
18027 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
18028 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
18029 LDKPublicKey revocation_basepoint_arg_ref;
18030 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
18031 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
18032 LDKPublicKey payment_point_arg_ref;
18033 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
18034 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
18035 LDKPublicKey delayed_payment_basepoint_arg_ref;
18036 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
18037 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
18038 LDKPublicKey htlc_basepoint_arg_ref;
18039 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
18040 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
18041 LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
18042 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18043 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18044 long ret_ref = (long)ret_var.inner;
18045 if (ret_var.is_owned) {
18051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18052 LDKChannelPublicKeys orig_conv;
18053 orig_conv.inner = (void*)(orig & (~1));
18054 orig_conv.is_owned = false;
18055 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
18056 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18057 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18058 long ret_ref = (long)ret_var.inner;
18059 if (ret_var.is_owned) {
18065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
18066 LDKChannelPublicKeys obj_conv;
18067 obj_conv.inner = (void*)(obj & (~1));
18068 obj_conv.is_owned = false;
18069 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
18070 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18071 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18072 CVec_u8Z_free(ret_var);
18076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18077 LDKu8slice ser_ref;
18078 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18079 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18080 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
18081 *ret_conv = ChannelPublicKeys_read(ser_ref);
18082 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18083 return (long)ret_conv;
18086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
18087 LDKPublicKey per_commitment_point_ref;
18088 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
18089 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
18090 LDKPublicKey broadcaster_delayed_payment_base_ref;
18091 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
18092 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
18093 LDKPublicKey broadcaster_htlc_base_ref;
18094 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
18095 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
18096 LDKPublicKey countersignatory_revocation_base_ref;
18097 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
18098 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
18099 LDKPublicKey countersignatory_htlc_base_ref;
18100 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
18101 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
18102 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
18103 *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
18104 return (long)ret_conv;
18107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1from_1channel_1static_1keys(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
18108 LDKPublicKey per_commitment_point_ref;
18109 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
18110 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
18111 LDKChannelPublicKeys broadcaster_keys_conv;
18112 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
18113 broadcaster_keys_conv.is_owned = false;
18114 LDKChannelPublicKeys countersignatory_keys_conv;
18115 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
18116 countersignatory_keys_conv.is_owned = false;
18117 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
18118 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
18119 return (long)ret_conv;
18122 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
18123 LDKPublicKey revocation_key_ref;
18124 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
18125 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
18126 LDKPublicKey broadcaster_delayed_payment_key_ref;
18127 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
18128 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
18129 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
18130 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18131 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18132 CVec_u8Z_free(ret_var);
18136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18137 LDKHTLCOutputInCommitment this_obj_conv;
18138 this_obj_conv.inner = (void*)(this_obj & (~1));
18139 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18140 HTLCOutputInCommitment_free(this_obj_conv);
18143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
18144 LDKHTLCOutputInCommitment this_ptr_conv;
18145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18146 this_ptr_conv.is_owned = false;
18147 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
18151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18152 LDKHTLCOutputInCommitment this_ptr_conv;
18153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18154 this_ptr_conv.is_owned = false;
18155 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
18158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18159 LDKHTLCOutputInCommitment this_ptr_conv;
18160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18161 this_ptr_conv.is_owned = false;
18162 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
18166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18167 LDKHTLCOutputInCommitment this_ptr_conv;
18168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18169 this_ptr_conv.is_owned = false;
18170 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
18173 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
18174 LDKHTLCOutputInCommitment this_ptr_conv;
18175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18176 this_ptr_conv.is_owned = false;
18177 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
18181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18182 LDKHTLCOutputInCommitment this_ptr_conv;
18183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18184 this_ptr_conv.is_owned = false;
18185 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
18188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18189 LDKHTLCOutputInCommitment this_ptr_conv;
18190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18191 this_ptr_conv.is_owned = false;
18192 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18193 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
18197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18198 LDKHTLCOutputInCommitment this_ptr_conv;
18199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18200 this_ptr_conv.is_owned = false;
18201 LDKThirtyTwoBytes val_ref;
18202 CHECK((*env)->GetArrayLength(env, val) == 32);
18203 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18204 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
18207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
18208 LDKHTLCOutputInCommitment this_ptr_conv;
18209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18210 this_ptr_conv.is_owned = false;
18211 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
18212 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
18213 long ret_ref = (long)ret_copy;
18217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18218 LDKHTLCOutputInCommitment this_ptr_conv;
18219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18220 this_ptr_conv.is_owned = false;
18221 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
18223 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
18226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1new(JNIEnv *env, jclass clz, jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
18227 LDKThirtyTwoBytes payment_hash_arg_ref;
18228 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
18229 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
18230 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
18231 FREE((void*)transaction_output_index_arg);
18232 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
18233 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18234 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18235 long ret_ref = (long)ret_var.inner;
18236 if (ret_var.is_owned) {
18242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18243 LDKHTLCOutputInCommitment orig_conv;
18244 orig_conv.inner = (void*)(orig & (~1));
18245 orig_conv.is_owned = false;
18246 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
18247 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18248 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18249 long ret_ref = (long)ret_var.inner;
18250 if (ret_var.is_owned) {
18256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
18257 LDKHTLCOutputInCommitment obj_conv;
18258 obj_conv.inner = (void*)(obj & (~1));
18259 obj_conv.is_owned = false;
18260 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
18261 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18262 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18263 CVec_u8Z_free(ret_var);
18267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18268 LDKu8slice ser_ref;
18269 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18270 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18271 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
18272 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
18273 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18274 return (long)ret_conv;
18277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
18278 LDKHTLCOutputInCommitment htlc_conv;
18279 htlc_conv.inner = (void*)(htlc & (~1));
18280 htlc_conv.is_owned = false;
18281 LDKTxCreationKeys keys_conv;
18282 keys_conv.inner = (void*)(keys & (~1));
18283 keys_conv.is_owned = false;
18284 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
18285 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18286 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18287 CVec_u8Z_free(ret_var);
18291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
18292 LDKPublicKey broadcaster_ref;
18293 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
18294 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
18295 LDKPublicKey countersignatory_ref;
18296 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
18297 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
18298 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
18299 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18300 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18301 CVec_u8Z_free(ret_var);
18305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
18306 unsigned char prev_hash_arr[32];
18307 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
18308 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
18309 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
18310 LDKHTLCOutputInCommitment htlc_conv;
18311 htlc_conv.inner = (void*)(htlc & (~1));
18312 htlc_conv.is_owned = false;
18313 LDKPublicKey broadcaster_delayed_payment_key_ref;
18314 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
18315 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
18316 LDKPublicKey revocation_key_ref;
18317 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
18318 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
18319 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
18320 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18321 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18322 Transaction_free(ret_var);
18326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18327 LDKChannelTransactionParameters this_obj_conv;
18328 this_obj_conv.inner = (void*)(this_obj & (~1));
18329 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18330 ChannelTransactionParameters_free(this_obj_conv);
18333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
18334 LDKChannelTransactionParameters this_ptr_conv;
18335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18336 this_ptr_conv.is_owned = false;
18337 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
18338 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18339 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18340 long ret_ref = (long)ret_var.inner;
18341 if (ret_var.is_owned) {
18347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18348 LDKChannelTransactionParameters this_ptr_conv;
18349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18350 this_ptr_conv.is_owned = false;
18351 LDKChannelPublicKeys val_conv;
18352 val_conv.inner = (void*)(val & (~1));
18353 val_conv.is_owned = (val & 1) || (val == 0);
18354 val_conv = ChannelPublicKeys_clone(&val_conv);
18355 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
18358 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18359 LDKChannelTransactionParameters this_ptr_conv;
18360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18361 this_ptr_conv.is_owned = false;
18362 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
18366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18367 LDKChannelTransactionParameters this_ptr_conv;
18368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18369 this_ptr_conv.is_owned = false;
18370 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
18373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
18374 LDKChannelTransactionParameters this_ptr_conv;
18375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18376 this_ptr_conv.is_owned = false;
18377 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
18381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18382 LDKChannelTransactionParameters this_ptr_conv;
18383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18384 this_ptr_conv.is_owned = false;
18385 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
18388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
18389 LDKChannelTransactionParameters this_ptr_conv;
18390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18391 this_ptr_conv.is_owned = false;
18392 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
18393 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18394 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18395 long ret_ref = (long)ret_var.inner;
18396 if (ret_var.is_owned) {
18402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18403 LDKChannelTransactionParameters this_ptr_conv;
18404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18405 this_ptr_conv.is_owned = false;
18406 LDKCounterpartyChannelTransactionParameters val_conv;
18407 val_conv.inner = (void*)(val & (~1));
18408 val_conv.is_owned = (val & 1) || (val == 0);
18409 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
18410 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
18413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18414 LDKChannelTransactionParameters this_ptr_conv;
18415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18416 this_ptr_conv.is_owned = false;
18417 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
18418 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18419 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18420 long ret_ref = (long)ret_var.inner;
18421 if (ret_var.is_owned) {
18427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18428 LDKChannelTransactionParameters this_ptr_conv;
18429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18430 this_ptr_conv.is_owned = false;
18431 LDKOutPoint val_conv;
18432 val_conv.inner = (void*)(val & (~1));
18433 val_conv.is_owned = (val & 1) || (val == 0);
18434 val_conv = OutPoint_clone(&val_conv);
18435 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
18438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg) {
18439 LDKChannelPublicKeys holder_pubkeys_arg_conv;
18440 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
18441 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
18442 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
18443 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
18444 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
18445 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
18446 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
18447 LDKOutPoint funding_outpoint_arg_conv;
18448 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
18449 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
18450 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
18451 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv);
18452 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18453 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18454 long ret_ref = (long)ret_var.inner;
18455 if (ret_var.is_owned) {
18461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18462 LDKChannelTransactionParameters orig_conv;
18463 orig_conv.inner = (void*)(orig & (~1));
18464 orig_conv.is_owned = false;
18465 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
18466 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18467 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18468 long ret_ref = (long)ret_var.inner;
18469 if (ret_var.is_owned) {
18475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18476 LDKCounterpartyChannelTransactionParameters this_obj_conv;
18477 this_obj_conv.inner = (void*)(this_obj & (~1));
18478 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18479 CounterpartyChannelTransactionParameters_free(this_obj_conv);
18482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
18483 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18485 this_ptr_conv.is_owned = false;
18486 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
18487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18489 long ret_ref = (long)ret_var.inner;
18490 if (ret_var.is_owned) {
18496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18497 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18499 this_ptr_conv.is_owned = false;
18500 LDKChannelPublicKeys val_conv;
18501 val_conv.inner = (void*)(val & (~1));
18502 val_conv.is_owned = (val & 1) || (val == 0);
18503 val_conv = ChannelPublicKeys_clone(&val_conv);
18504 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
18507 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18508 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18510 this_ptr_conv.is_owned = false;
18511 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
18515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18516 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
18517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18518 this_ptr_conv.is_owned = false;
18519 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
18522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
18523 LDKChannelPublicKeys pubkeys_arg_conv;
18524 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
18525 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
18526 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
18527 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
18528 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18529 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18530 long ret_ref = (long)ret_var.inner;
18531 if (ret_var.is_owned) {
18537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18538 LDKCounterpartyChannelTransactionParameters orig_conv;
18539 orig_conv.inner = (void*)(orig & (~1));
18540 orig_conv.is_owned = false;
18541 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
18542 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18543 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18544 long ret_ref = (long)ret_var.inner;
18545 if (ret_var.is_owned) {
18551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
18552 LDKChannelTransactionParameters this_arg_conv;
18553 this_arg_conv.inner = (void*)(this_arg & (~1));
18554 this_arg_conv.is_owned = false;
18555 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
18559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
18560 LDKChannelTransactionParameters this_arg_conv;
18561 this_arg_conv.inner = (void*)(this_arg & (~1));
18562 this_arg_conv.is_owned = false;
18563 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
18564 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18565 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18566 long ret_ref = (long)ret_var.inner;
18567 if (ret_var.is_owned) {
18573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
18574 LDKChannelTransactionParameters this_arg_conv;
18575 this_arg_conv.inner = (void*)(this_arg & (~1));
18576 this_arg_conv.is_owned = false;
18577 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
18578 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18579 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18580 long ret_ref = (long)ret_var.inner;
18581 if (ret_var.is_owned) {
18587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
18588 LDKCounterpartyChannelTransactionParameters obj_conv;
18589 obj_conv.inner = (void*)(obj & (~1));
18590 obj_conv.is_owned = false;
18591 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
18592 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18593 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18594 CVec_u8Z_free(ret_var);
18598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18599 LDKu8slice ser_ref;
18600 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18601 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18602 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
18603 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
18604 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18605 return (long)ret_conv;
18608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
18609 LDKChannelTransactionParameters obj_conv;
18610 obj_conv.inner = (void*)(obj & (~1));
18611 obj_conv.is_owned = false;
18612 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
18613 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18614 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18615 CVec_u8Z_free(ret_var);
18619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18620 LDKu8slice ser_ref;
18621 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18622 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18623 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
18624 *ret_conv = ChannelTransactionParameters_read(ser_ref);
18625 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18626 return (long)ret_conv;
18629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18630 LDKDirectedChannelTransactionParameters this_obj_conv;
18631 this_obj_conv.inner = (void*)(this_obj & (~1));
18632 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18633 DirectedChannelTransactionParameters_free(this_obj_conv);
18636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
18637 LDKDirectedChannelTransactionParameters this_arg_conv;
18638 this_arg_conv.inner = (void*)(this_arg & (~1));
18639 this_arg_conv.is_owned = false;
18640 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
18641 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18642 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18643 long ret_ref = (long)ret_var.inner;
18644 if (ret_var.is_owned) {
18650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
18651 LDKDirectedChannelTransactionParameters this_arg_conv;
18652 this_arg_conv.inner = (void*)(this_arg & (~1));
18653 this_arg_conv.is_owned = false;
18654 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
18655 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18656 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18657 long ret_ref = (long)ret_var.inner;
18658 if (ret_var.is_owned) {
18664 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
18665 LDKDirectedChannelTransactionParameters this_arg_conv;
18666 this_arg_conv.inner = (void*)(this_arg & (~1));
18667 this_arg_conv.is_owned = false;
18668 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
18672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
18673 LDKDirectedChannelTransactionParameters this_arg_conv;
18674 this_arg_conv.inner = (void*)(this_arg & (~1));
18675 this_arg_conv.is_owned = false;
18676 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
18680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
18681 LDKDirectedChannelTransactionParameters this_arg_conv;
18682 this_arg_conv.inner = (void*)(this_arg & (~1));
18683 this_arg_conv.is_owned = false;
18684 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
18685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18687 long ret_ref = (long)ret_var.inner;
18688 if (ret_var.is_owned) {
18694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18695 LDKHolderCommitmentTransaction this_obj_conv;
18696 this_obj_conv.inner = (void*)(this_obj & (~1));
18697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18698 HolderCommitmentTransaction_free(this_obj_conv);
18701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
18702 LDKHolderCommitmentTransaction this_ptr_conv;
18703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18704 this_ptr_conv.is_owned = false;
18705 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18706 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
18710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18711 LDKHolderCommitmentTransaction this_ptr_conv;
18712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18713 this_ptr_conv.is_owned = false;
18714 LDKSignature val_ref;
18715 CHECK((*env)->GetArrayLength(env, val) == 64);
18716 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18717 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
18720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
18721 LDKHolderCommitmentTransaction this_ptr_conv;
18722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18723 this_ptr_conv.is_owned = false;
18724 LDKCVec_SignatureZ val_constr;
18725 val_constr.datalen = (*env)->GetArrayLength(env, val);
18726 if (val_constr.datalen > 0)
18727 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18729 val_constr.data = NULL;
18730 for (size_t i = 0; i < val_constr.datalen; i++) {
18731 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
18732 LDKSignature val_conv_8_ref;
18733 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
18734 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
18735 val_constr.data[i] = val_conv_8_ref;
18737 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
18740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18741 LDKHolderCommitmentTransaction orig_conv;
18742 orig_conv.inner = (void*)(orig & (~1));
18743 orig_conv.is_owned = false;
18744 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
18745 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18746 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18747 long ret_ref = (long)ret_var.inner;
18748 if (ret_var.is_owned) {
18754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18755 LDKHolderCommitmentTransaction obj_conv;
18756 obj_conv.inner = (void*)(obj & (~1));
18757 obj_conv.is_owned = false;
18758 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
18759 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18760 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18761 CVec_u8Z_free(ret_var);
18765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18766 LDKu8slice ser_ref;
18767 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18768 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18769 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
18770 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
18771 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18772 return (long)ret_conv;
18775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new(JNIEnv *env, jclass clz, int64_t commitment_tx, int8_tArray counterparty_sig, jobjectArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
18776 LDKCommitmentTransaction commitment_tx_conv;
18777 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
18778 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
18779 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
18780 LDKSignature counterparty_sig_ref;
18781 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
18782 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
18783 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
18784 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
18785 if (counterparty_htlc_sigs_constr.datalen > 0)
18786 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18788 counterparty_htlc_sigs_constr.data = NULL;
18789 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
18790 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
18791 LDKSignature counterparty_htlc_sigs_conv_8_ref;
18792 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
18793 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
18794 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
18796 LDKPublicKey holder_funding_key_ref;
18797 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
18798 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
18799 LDKPublicKey counterparty_funding_key_ref;
18800 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
18801 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
18802 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
18803 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18804 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18805 long ret_ref = (long)ret_var.inner;
18806 if (ret_var.is_owned) {
18812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18813 LDKBuiltCommitmentTransaction this_obj_conv;
18814 this_obj_conv.inner = (void*)(this_obj & (~1));
18815 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18816 BuiltCommitmentTransaction_free(this_obj_conv);
18819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
18820 LDKBuiltCommitmentTransaction this_ptr_conv;
18821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18822 this_ptr_conv.is_owned = false;
18823 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
18824 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18825 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18826 Transaction_free(ret_var);
18830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18831 LDKBuiltCommitmentTransaction this_ptr_conv;
18832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18833 this_ptr_conv.is_owned = false;
18834 LDKTransaction val_ref;
18835 val_ref.datalen = (*env)->GetArrayLength(env, val);
18836 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
18837 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
18838 val_ref.data_is_owned = true;
18839 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
18842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
18843 LDKBuiltCommitmentTransaction this_ptr_conv;
18844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18845 this_ptr_conv.is_owned = false;
18846 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18847 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
18851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18852 LDKBuiltCommitmentTransaction this_ptr_conv;
18853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18854 this_ptr_conv.is_owned = false;
18855 LDKThirtyTwoBytes val_ref;
18856 CHECK((*env)->GetArrayLength(env, val) == 32);
18857 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18858 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
18861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
18862 LDKTransaction transaction_arg_ref;
18863 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
18864 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
18865 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
18866 transaction_arg_ref.data_is_owned = true;
18867 LDKThirtyTwoBytes txid_arg_ref;
18868 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
18869 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
18870 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
18871 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18872 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18873 long ret_ref = (long)ret_var.inner;
18874 if (ret_var.is_owned) {
18880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18881 LDKBuiltCommitmentTransaction orig_conv;
18882 orig_conv.inner = (void*)(orig & (~1));
18883 orig_conv.is_owned = false;
18884 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
18885 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18886 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18887 long ret_ref = (long)ret_var.inner;
18888 if (ret_var.is_owned) {
18894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18895 LDKBuiltCommitmentTransaction obj_conv;
18896 obj_conv.inner = (void*)(obj & (~1));
18897 obj_conv.is_owned = false;
18898 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
18899 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18900 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18901 CVec_u8Z_free(ret_var);
18905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18906 LDKu8slice ser_ref;
18907 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18908 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18909 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
18910 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
18911 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18912 return (long)ret_conv;
18915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
18916 LDKBuiltCommitmentTransaction this_arg_conv;
18917 this_arg_conv.inner = (void*)(this_arg & (~1));
18918 this_arg_conv.is_owned = false;
18919 LDKu8slice funding_redeemscript_ref;
18920 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
18921 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
18922 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18923 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
18924 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
18928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
18929 LDKBuiltCommitmentTransaction this_arg_conv;
18930 this_arg_conv.inner = (void*)(this_arg & (~1));
18931 this_arg_conv.is_owned = false;
18932 unsigned char funding_key_arr[32];
18933 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
18934 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
18935 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
18936 LDKu8slice funding_redeemscript_ref;
18937 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
18938 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
18939 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18940 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
18941 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
18945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18946 LDKCommitmentTransaction this_obj_conv;
18947 this_obj_conv.inner = (void*)(this_obj & (~1));
18948 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18949 CommitmentTransaction_free(this_obj_conv);
18952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18953 LDKCommitmentTransaction orig_conv;
18954 orig_conv.inner = (void*)(orig & (~1));
18955 orig_conv.is_owned = false;
18956 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
18957 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18958 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18959 long ret_ref = (long)ret_var.inner;
18960 if (ret_var.is_owned) {
18966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
18967 LDKCommitmentTransaction obj_conv;
18968 obj_conv.inner = (void*)(obj & (~1));
18969 obj_conv.is_owned = false;
18970 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
18971 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18972 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18973 CVec_u8Z_free(ret_var);
18977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18978 LDKu8slice ser_ref;
18979 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18980 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18981 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
18982 *ret_conv = CommitmentTransaction_read(ser_ref);
18983 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18984 return (long)ret_conv;
18987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
18988 LDKCommitmentTransaction this_arg_conv;
18989 this_arg_conv.inner = (void*)(this_arg & (~1));
18990 this_arg_conv.is_owned = false;
18991 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
18995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
18996 LDKCommitmentTransaction this_arg_conv;
18997 this_arg_conv.inner = (void*)(this_arg & (~1));
18998 this_arg_conv.is_owned = false;
18999 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
19003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
19004 LDKCommitmentTransaction this_arg_conv;
19005 this_arg_conv.inner = (void*)(this_arg & (~1));
19006 this_arg_conv.is_owned = false;
19007 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
19011 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
19012 LDKCommitmentTransaction this_arg_conv;
19013 this_arg_conv.inner = (void*)(this_arg & (~1));
19014 this_arg_conv.is_owned = false;
19015 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
19019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
19020 LDKCommitmentTransaction this_arg_conv;
19021 this_arg_conv.inner = (void*)(this_arg & (~1));
19022 this_arg_conv.is_owned = false;
19023 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
19024 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19025 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19026 long ret_ref = (long)ret_var.inner;
19027 if (ret_var.is_owned) {
19033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
19034 LDKCommitmentTransaction this_arg_conv;
19035 this_arg_conv.inner = (void*)(this_arg & (~1));
19036 this_arg_conv.is_owned = false;
19037 LDKDirectedChannelTransactionParameters channel_parameters_conv;
19038 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
19039 channel_parameters_conv.is_owned = false;
19040 LDKChannelPublicKeys broadcaster_keys_conv;
19041 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
19042 broadcaster_keys_conv.is_owned = false;
19043 LDKChannelPublicKeys countersignatory_keys_conv;
19044 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
19045 countersignatory_keys_conv.is_owned = false;
19046 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
19047 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
19048 return (long)ret_conv;
19051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19052 LDKTrustedCommitmentTransaction this_obj_conv;
19053 this_obj_conv.inner = (void*)(this_obj & (~1));
19054 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19055 TrustedCommitmentTransaction_free(this_obj_conv);
19058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
19059 LDKTrustedCommitmentTransaction this_arg_conv;
19060 this_arg_conv.inner = (void*)(this_arg & (~1));
19061 this_arg_conv.is_owned = false;
19062 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19063 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
19067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
19068 LDKTrustedCommitmentTransaction this_arg_conv;
19069 this_arg_conv.inner = (void*)(this_arg & (~1));
19070 this_arg_conv.is_owned = false;
19071 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
19072 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19073 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19074 long ret_ref = (long)ret_var.inner;
19075 if (ret_var.is_owned) {
19081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
19082 LDKTrustedCommitmentTransaction this_arg_conv;
19083 this_arg_conv.inner = (void*)(this_arg & (~1));
19084 this_arg_conv.is_owned = false;
19085 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
19086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19088 long ret_ref = (long)ret_var.inner;
19089 if (ret_var.is_owned) {
19095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters) {
19096 LDKTrustedCommitmentTransaction this_arg_conv;
19097 this_arg_conv.inner = (void*)(this_arg & (~1));
19098 this_arg_conv.is_owned = false;
19099 unsigned char htlc_base_key_arr[32];
19100 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
19101 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
19102 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
19103 LDKDirectedChannelTransactionParameters channel_parameters_conv;
19104 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
19105 channel_parameters_conv.is_owned = false;
19106 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
19107 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
19108 return (long)ret_conv;
19111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1commitment_1transaction_1number_1obscure_1factor(JNIEnv *env, jclass clz, int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
19112 LDKPublicKey broadcaster_payment_basepoint_ref;
19113 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
19114 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
19115 LDKPublicKey countersignatory_payment_basepoint_ref;
19116 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
19117 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
19118 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
19122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19123 LDKInitFeatures orig_conv;
19124 orig_conv.inner = (void*)(orig & (~1));
19125 orig_conv.is_owned = false;
19126 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
19127 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19128 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19129 long ret_ref = (long)ret_var.inner;
19130 if (ret_var.is_owned) {
19136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19137 LDKNodeFeatures orig_conv;
19138 orig_conv.inner = (void*)(orig & (~1));
19139 orig_conv.is_owned = false;
19140 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
19141 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19142 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19143 long ret_ref = (long)ret_var.inner;
19144 if (ret_var.is_owned) {
19150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19151 LDKChannelFeatures orig_conv;
19152 orig_conv.inner = (void*)(orig & (~1));
19153 orig_conv.is_owned = false;
19154 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
19155 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19156 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19157 long ret_ref = (long)ret_var.inner;
19158 if (ret_var.is_owned) {
19164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19165 LDKInvoiceFeatures orig_conv;
19166 orig_conv.inner = (void*)(orig & (~1));
19167 orig_conv.is_owned = false;
19168 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
19169 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19170 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19171 long ret_ref = (long)ret_var.inner;
19172 if (ret_var.is_owned) {
19178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19179 LDKInitFeatures this_obj_conv;
19180 this_obj_conv.inner = (void*)(this_obj & (~1));
19181 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19182 InitFeatures_free(this_obj_conv);
19185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19186 LDKNodeFeatures this_obj_conv;
19187 this_obj_conv.inner = (void*)(this_obj & (~1));
19188 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19189 NodeFeatures_free(this_obj_conv);
19192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19193 LDKChannelFeatures this_obj_conv;
19194 this_obj_conv.inner = (void*)(this_obj & (~1));
19195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19196 ChannelFeatures_free(this_obj_conv);
19199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19200 LDKInvoiceFeatures this_obj_conv;
19201 this_obj_conv.inner = (void*)(this_obj & (~1));
19202 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19203 InvoiceFeatures_free(this_obj_conv);
19206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
19207 LDKInitFeatures ret_var = InitFeatures_empty();
19208 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19209 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19210 long ret_ref = (long)ret_var.inner;
19211 if (ret_var.is_owned) {
19217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
19218 LDKInitFeatures ret_var = InitFeatures_known();
19219 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19220 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19221 long ret_ref = (long)ret_var.inner;
19222 if (ret_var.is_owned) {
19228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
19229 LDKNodeFeatures ret_var = NodeFeatures_empty();
19230 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19231 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19232 long ret_ref = (long)ret_var.inner;
19233 if (ret_var.is_owned) {
19239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
19240 LDKNodeFeatures ret_var = NodeFeatures_known();
19241 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19242 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19243 long ret_ref = (long)ret_var.inner;
19244 if (ret_var.is_owned) {
19250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
19251 LDKChannelFeatures ret_var = ChannelFeatures_empty();
19252 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19253 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19254 long ret_ref = (long)ret_var.inner;
19255 if (ret_var.is_owned) {
19261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
19262 LDKChannelFeatures ret_var = ChannelFeatures_known();
19263 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19264 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19265 long ret_ref = (long)ret_var.inner;
19266 if (ret_var.is_owned) {
19272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
19273 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
19274 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19275 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19276 long ret_ref = (long)ret_var.inner;
19277 if (ret_var.is_owned) {
19283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
19284 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
19285 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19286 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19287 long ret_ref = (long)ret_var.inner;
19288 if (ret_var.is_owned) {
19294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
19295 LDKInitFeatures obj_conv;
19296 obj_conv.inner = (void*)(obj & (~1));
19297 obj_conv.is_owned = false;
19298 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
19299 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19300 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19301 CVec_u8Z_free(ret_var);
19305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
19306 LDKNodeFeatures obj_conv;
19307 obj_conv.inner = (void*)(obj & (~1));
19308 obj_conv.is_owned = false;
19309 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
19310 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19311 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19312 CVec_u8Z_free(ret_var);
19316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
19317 LDKChannelFeatures obj_conv;
19318 obj_conv.inner = (void*)(obj & (~1));
19319 obj_conv.is_owned = false;
19320 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
19321 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19322 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19323 CVec_u8Z_free(ret_var);
19327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
19328 LDKInvoiceFeatures obj_conv;
19329 obj_conv.inner = (void*)(obj & (~1));
19330 obj_conv.is_owned = false;
19331 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
19332 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19333 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19334 CVec_u8Z_free(ret_var);
19338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19339 LDKu8slice ser_ref;
19340 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19341 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19342 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
19343 *ret_conv = InitFeatures_read(ser_ref);
19344 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19345 return (long)ret_conv;
19348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19349 LDKu8slice ser_ref;
19350 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19351 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19352 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
19353 *ret_conv = NodeFeatures_read(ser_ref);
19354 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19355 return (long)ret_conv;
19358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19359 LDKu8slice ser_ref;
19360 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19361 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19362 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
19363 *ret_conv = ChannelFeatures_read(ser_ref);
19364 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19365 return (long)ret_conv;
19368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19369 LDKu8slice ser_ref;
19370 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19371 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19372 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
19373 *ret_conv = InvoiceFeatures_read(ser_ref);
19374 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19375 return (long)ret_conv;
19378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19379 LDKRouteHop this_obj_conv;
19380 this_obj_conv.inner = (void*)(this_obj & (~1));
19381 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19382 RouteHop_free(this_obj_conv);
19385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
19386 LDKRouteHop this_ptr_conv;
19387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19388 this_ptr_conv.is_owned = false;
19389 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19390 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
19394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19395 LDKRouteHop this_ptr_conv;
19396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19397 this_ptr_conv.is_owned = false;
19398 LDKPublicKey val_ref;
19399 CHECK((*env)->GetArrayLength(env, val) == 33);
19400 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19401 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
19404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19405 LDKRouteHop this_ptr_conv;
19406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19407 this_ptr_conv.is_owned = false;
19408 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
19409 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19410 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19411 long ret_ref = (long)ret_var.inner;
19412 if (ret_var.is_owned) {
19418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19419 LDKRouteHop this_ptr_conv;
19420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19421 this_ptr_conv.is_owned = false;
19422 LDKNodeFeatures val_conv;
19423 val_conv.inner = (void*)(val & (~1));
19424 val_conv.is_owned = (val & 1) || (val == 0);
19425 val_conv = NodeFeatures_clone(&val_conv);
19426 RouteHop_set_node_features(&this_ptr_conv, val_conv);
19429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19430 LDKRouteHop this_ptr_conv;
19431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19432 this_ptr_conv.is_owned = false;
19433 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
19437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19438 LDKRouteHop this_ptr_conv;
19439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19440 this_ptr_conv.is_owned = false;
19441 RouteHop_set_short_channel_id(&this_ptr_conv, val);
19444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19445 LDKRouteHop this_ptr_conv;
19446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19447 this_ptr_conv.is_owned = false;
19448 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
19449 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19450 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19451 long ret_ref = (long)ret_var.inner;
19452 if (ret_var.is_owned) {
19458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19459 LDKRouteHop this_ptr_conv;
19460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19461 this_ptr_conv.is_owned = false;
19462 LDKChannelFeatures val_conv;
19463 val_conv.inner = (void*)(val & (~1));
19464 val_conv.is_owned = (val & 1) || (val == 0);
19465 val_conv = ChannelFeatures_clone(&val_conv);
19466 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
19469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19470 LDKRouteHop this_ptr_conv;
19471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19472 this_ptr_conv.is_owned = false;
19473 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
19477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19478 LDKRouteHop this_ptr_conv;
19479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19480 this_ptr_conv.is_owned = false;
19481 RouteHop_set_fee_msat(&this_ptr_conv, val);
19484 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19485 LDKRouteHop this_ptr_conv;
19486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19487 this_ptr_conv.is_owned = false;
19488 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
19492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19493 LDKRouteHop this_ptr_conv;
19494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19495 this_ptr_conv.is_owned = false;
19496 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
19499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
19500 LDKPublicKey pubkey_arg_ref;
19501 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
19502 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
19503 LDKNodeFeatures node_features_arg_conv;
19504 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
19505 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
19506 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
19507 LDKChannelFeatures channel_features_arg_conv;
19508 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
19509 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
19510 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
19511 LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
19512 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19513 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19514 long ret_ref = (long)ret_var.inner;
19515 if (ret_var.is_owned) {
19521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19522 LDKRouteHop orig_conv;
19523 orig_conv.inner = (void*)(orig & (~1));
19524 orig_conv.is_owned = false;
19525 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
19526 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19527 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19528 long ret_ref = (long)ret_var.inner;
19529 if (ret_var.is_owned) {
19535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19536 LDKRoute this_obj_conv;
19537 this_obj_conv.inner = (void*)(this_obj & (~1));
19538 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19539 Route_free(this_obj_conv);
19542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
19543 LDKRoute this_ptr_conv;
19544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19545 this_ptr_conv.is_owned = false;
19546 LDKCVec_CVec_RouteHopZZ val_constr;
19547 val_constr.datalen = (*env)->GetArrayLength(env, val);
19548 if (val_constr.datalen > 0)
19549 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
19551 val_constr.data = NULL;
19552 for (size_t m = 0; m < val_constr.datalen; m++) {
19553 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
19554 LDKCVec_RouteHopZ val_conv_12_constr;
19555 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
19556 if (val_conv_12_constr.datalen > 0)
19557 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19559 val_conv_12_constr.data = NULL;
19560 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
19561 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
19562 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
19563 LDKRouteHop val_conv_12_conv_10_conv;
19564 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
19565 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
19566 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
19567 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
19569 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
19570 val_constr.data[m] = val_conv_12_constr;
19572 Route_set_paths(&this_ptr_conv, val_constr);
19575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
19576 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
19577 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
19578 if (paths_arg_constr.datalen > 0)
19579 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
19581 paths_arg_constr.data = NULL;
19582 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
19583 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
19584 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
19585 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
19586 if (paths_arg_conv_12_constr.datalen > 0)
19587 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19589 paths_arg_conv_12_constr.data = NULL;
19590 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
19591 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
19592 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
19593 LDKRouteHop paths_arg_conv_12_conv_10_conv;
19594 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
19595 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
19596 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
19597 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
19599 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
19600 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
19602 LDKRoute ret_var = Route_new(paths_arg_constr);
19603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19605 long ret_ref = (long)ret_var.inner;
19606 if (ret_var.is_owned) {
19612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19613 LDKRoute orig_conv;
19614 orig_conv.inner = (void*)(orig & (~1));
19615 orig_conv.is_owned = false;
19616 LDKRoute ret_var = Route_clone(&orig_conv);
19617 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19618 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19619 long ret_ref = (long)ret_var.inner;
19620 if (ret_var.is_owned) {
19626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
19628 obj_conv.inner = (void*)(obj & (~1));
19629 obj_conv.is_owned = false;
19630 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
19631 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19632 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19633 CVec_u8Z_free(ret_var);
19637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19638 LDKu8slice ser_ref;
19639 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19640 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19641 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19642 *ret_conv = Route_read(ser_ref);
19643 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19644 return (long)ret_conv;
19647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19648 LDKRouteHint this_obj_conv;
19649 this_obj_conv.inner = (void*)(this_obj & (~1));
19650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19651 RouteHint_free(this_obj_conv);
19654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19655 LDKRouteHint this_ptr_conv;
19656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19657 this_ptr_conv.is_owned = false;
19658 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19659 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
19663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19664 LDKRouteHint this_ptr_conv;
19665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19666 this_ptr_conv.is_owned = false;
19667 LDKPublicKey val_ref;
19668 CHECK((*env)->GetArrayLength(env, val) == 33);
19669 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19670 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
19673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19674 LDKRouteHint this_ptr_conv;
19675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19676 this_ptr_conv.is_owned = false;
19677 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
19681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19682 LDKRouteHint this_ptr_conv;
19683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19684 this_ptr_conv.is_owned = false;
19685 RouteHint_set_short_channel_id(&this_ptr_conv, val);
19688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
19689 LDKRouteHint this_ptr_conv;
19690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19691 this_ptr_conv.is_owned = false;
19692 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
19693 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19694 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19695 long ret_ref = (long)ret_var.inner;
19696 if (ret_var.is_owned) {
19702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19703 LDKRouteHint this_ptr_conv;
19704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19705 this_ptr_conv.is_owned = false;
19706 LDKRoutingFees val_conv;
19707 val_conv.inner = (void*)(val & (~1));
19708 val_conv.is_owned = (val & 1) || (val == 0);
19709 val_conv = RoutingFees_clone(&val_conv);
19710 RouteHint_set_fees(&this_ptr_conv, val_conv);
19713 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19714 LDKRouteHint this_ptr_conv;
19715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19716 this_ptr_conv.is_owned = false;
19717 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
19721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19722 LDKRouteHint this_ptr_conv;
19723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19724 this_ptr_conv.is_owned = false;
19725 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
19728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19729 LDKRouteHint this_ptr_conv;
19730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19731 this_ptr_conv.is_owned = false;
19732 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19733 *ret_copy = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
19734 long ret_ref = (long)ret_copy;
19738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19739 LDKRouteHint this_ptr_conv;
19740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19741 this_ptr_conv.is_owned = false;
19742 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
19744 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
19747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19748 LDKRouteHint this_ptr_conv;
19749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19750 this_ptr_conv.is_owned = false;
19751 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19752 *ret_copy = RouteHint_get_htlc_maximum_msat(&this_ptr_conv);
19753 long ret_ref = (long)ret_copy;
19757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19758 LDKRouteHint this_ptr_conv;
19759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19760 this_ptr_conv.is_owned = false;
19761 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
19763 RouteHint_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
19766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) {
19767 LDKPublicKey src_node_id_arg_ref;
19768 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
19769 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
19770 LDKRoutingFees fees_arg_conv;
19771 fees_arg_conv.inner = (void*)(fees_arg & (~1));
19772 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
19773 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
19774 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
19775 FREE((void*)htlc_minimum_msat_arg);
19776 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
19777 FREE((void*)htlc_maximum_msat_arg);
19778 LDKRouteHint ret_var = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
19779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19781 long ret_ref = (long)ret_var.inner;
19782 if (ret_var.is_owned) {
19788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19789 LDKRouteHint orig_conv;
19790 orig_conv.inner = (void*)(orig & (~1));
19791 orig_conv.is_owned = false;
19792 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
19793 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19794 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19795 long ret_ref = (long)ret_var.inner;
19796 if (ret_var.is_owned) {
19802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
19803 LDKPublicKey our_node_id_ref;
19804 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
19805 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
19806 LDKNetworkGraph network_conv;
19807 network_conv.inner = (void*)(network & (~1));
19808 network_conv.is_owned = false;
19809 LDKPublicKey payee_ref;
19810 CHECK((*env)->GetArrayLength(env, payee) == 33);
19811 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
19812 LDKInvoiceFeatures payee_features_conv;
19813 payee_features_conv.inner = (void*)(payee_features & (~1));
19814 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
19815 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
19816 LDKCVec_ChannelDetailsZ first_hops_constr;
19817 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
19818 if (first_hops_constr.datalen > 0)
19819 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
19821 first_hops_constr.data = NULL;
19822 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
19823 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
19824 int64_t first_hops_conv_16 = first_hops_vals[q];
19825 LDKChannelDetails first_hops_conv_16_conv;
19826 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
19827 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
19828 first_hops_constr.data[q] = first_hops_conv_16_conv;
19830 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
19831 LDKCVec_RouteHintZ last_hops_constr;
19832 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
19833 if (last_hops_constr.datalen > 0)
19834 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
19836 last_hops_constr.data = NULL;
19837 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
19838 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
19839 int64_t last_hops_conv_11 = last_hops_vals[l];
19840 LDKRouteHint last_hops_conv_11_conv;
19841 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
19842 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
19843 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
19844 last_hops_constr.data[l] = last_hops_conv_11_conv;
19846 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
19847 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19848 if (logger_conv.free == LDKLogger_JCalls_free) {
19849 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19850 LDKLogger_JCalls_clone(logger_conv.this_arg);
19852 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
19853 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
19854 FREE(first_hops_constr.data);
19855 return (long)ret_conv;
19858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19859 LDKNetworkGraph this_obj_conv;
19860 this_obj_conv.inner = (void*)(this_obj & (~1));
19861 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19862 NetworkGraph_free(this_obj_conv);
19865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19866 LDKNetworkGraph orig_conv;
19867 orig_conv.inner = (void*)(orig & (~1));
19868 orig_conv.is_owned = false;
19869 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
19870 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19871 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19872 long ret_ref = (long)ret_var.inner;
19873 if (ret_var.is_owned) {
19879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19880 LDKLockedNetworkGraph this_obj_conv;
19881 this_obj_conv.inner = (void*)(this_obj & (~1));
19882 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19883 LockedNetworkGraph_free(this_obj_conv);
19886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19887 LDKNetGraphMsgHandler this_obj_conv;
19888 this_obj_conv.inner = (void*)(this_obj & (~1));
19889 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19890 NetGraphMsgHandler_free(this_obj_conv);
19893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
19894 LDKThirtyTwoBytes genesis_hash_ref;
19895 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
19896 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
19897 LDKAccess *chain_access_conv_ptr = NULL;
19898 if (chain_access != 0) {
19899 LDKAccess chain_access_conv;
19900 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19901 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19902 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19903 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19905 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19906 *chain_access_conv_ptr = chain_access_conv;
19908 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19909 if (logger_conv.free == LDKLogger_JCalls_free) {
19910 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19911 LDKLogger_JCalls_clone(logger_conv.this_arg);
19913 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
19914 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19915 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19916 long ret_ref = (long)ret_var.inner;
19917 if (ret_var.is_owned) {
19923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
19924 LDKAccess *chain_access_conv_ptr = NULL;
19925 if (chain_access != 0) {
19926 LDKAccess chain_access_conv;
19927 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19928 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19929 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19930 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19932 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19933 *chain_access_conv_ptr = chain_access_conv;
19935 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19936 if (logger_conv.free == LDKLogger_JCalls_free) {
19937 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19938 LDKLogger_JCalls_clone(logger_conv.this_arg);
19940 LDKNetworkGraph network_graph_conv;
19941 network_graph_conv.inner = (void*)(network_graph & (~1));
19942 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
19943 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
19944 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
19945 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19946 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19947 long ret_ref = (long)ret_var.inner;
19948 if (ret_var.is_owned) {
19954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
19955 LDKNetGraphMsgHandler this_arg_conv;
19956 this_arg_conv.inner = (void*)(this_arg & (~1));
19957 this_arg_conv.is_owned = false;
19958 LDKAccess *chain_access_conv_ptr = NULL;
19959 if (chain_access != 0) {
19960 LDKAccess chain_access_conv;
19961 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19962 if (chain_access_conv.free == LDKAccess_JCalls_free) {
19963 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19964 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
19966 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19967 *chain_access_conv_ptr = chain_access_conv;
19969 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
19972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
19973 LDKNetGraphMsgHandler this_arg_conv;
19974 this_arg_conv.inner = (void*)(this_arg & (~1));
19975 this_arg_conv.is_owned = false;
19976 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
19977 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19978 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19979 long ret_ref = (long)ret_var.inner;
19980 if (ret_var.is_owned) {
19986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
19987 LDKLockedNetworkGraph this_arg_conv;
19988 this_arg_conv.inner = (void*)(this_arg & (~1));
19989 this_arg_conv.is_owned = false;
19990 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
19991 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19992 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19993 long ret_ref = (long)ret_var.inner;
19994 if (ret_var.is_owned) {
20000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20001 LDKNetGraphMsgHandler this_arg_conv;
20002 this_arg_conv.inner = (void*)(this_arg & (~1));
20003 this_arg_conv.is_owned = false;
20004 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20005 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
20009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20010 LDKNetGraphMsgHandler this_arg_conv;
20011 this_arg_conv.inner = (void*)(this_arg & (~1));
20012 this_arg_conv.is_owned = false;
20013 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20014 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
20018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20019 LDKDirectionalChannelInfo this_obj_conv;
20020 this_obj_conv.inner = (void*)(this_obj & (~1));
20021 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20022 DirectionalChannelInfo_free(this_obj_conv);
20025 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
20026 LDKDirectionalChannelInfo this_ptr_conv;
20027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20028 this_ptr_conv.is_owned = false;
20029 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
20033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20034 LDKDirectionalChannelInfo this_ptr_conv;
20035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20036 this_ptr_conv.is_owned = false;
20037 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
20040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
20041 LDKDirectionalChannelInfo this_ptr_conv;
20042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20043 this_ptr_conv.is_owned = false;
20044 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
20048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20049 LDKDirectionalChannelInfo this_ptr_conv;
20050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20051 this_ptr_conv.is_owned = false;
20052 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
20055 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
20056 LDKDirectionalChannelInfo this_ptr_conv;
20057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20058 this_ptr_conv.is_owned = false;
20059 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
20063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20064 LDKDirectionalChannelInfo this_ptr_conv;
20065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20066 this_ptr_conv.is_owned = false;
20067 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
20070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20071 LDKDirectionalChannelInfo this_ptr_conv;
20072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20073 this_ptr_conv.is_owned = false;
20074 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
20078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20079 LDKDirectionalChannelInfo this_ptr_conv;
20080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20081 this_ptr_conv.is_owned = false;
20082 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
20085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20086 LDKDirectionalChannelInfo this_ptr_conv;
20087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20088 this_ptr_conv.is_owned = false;
20089 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20090 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
20091 long ret_ref = (long)ret_copy;
20095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20096 LDKDirectionalChannelInfo this_ptr_conv;
20097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20098 this_ptr_conv.is_owned = false;
20099 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
20101 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
20104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
20105 LDKDirectionalChannelInfo this_ptr_conv;
20106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20107 this_ptr_conv.is_owned = false;
20108 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
20109 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20110 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20111 long ret_ref = (long)ret_var.inner;
20112 if (ret_var.is_owned) {
20118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20119 LDKDirectionalChannelInfo this_ptr_conv;
20120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20121 this_ptr_conv.is_owned = false;
20122 LDKRoutingFees val_conv;
20123 val_conv.inner = (void*)(val & (~1));
20124 val_conv.is_owned = (val & 1) || (val == 0);
20125 val_conv = RoutingFees_clone(&val_conv);
20126 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
20129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
20130 LDKDirectionalChannelInfo this_ptr_conv;
20131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20132 this_ptr_conv.is_owned = false;
20133 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
20134 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20135 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20136 long ret_ref = (long)ret_var.inner;
20137 if (ret_var.is_owned) {
20143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20144 LDKDirectionalChannelInfo this_ptr_conv;
20145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20146 this_ptr_conv.is_owned = false;
20147 LDKChannelUpdate val_conv;
20148 val_conv.inner = (void*)(val & (~1));
20149 val_conv.is_owned = (val & 1) || (val == 0);
20150 val_conv = ChannelUpdate_clone(&val_conv);
20151 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
20154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
20155 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
20156 FREE((void*)htlc_maximum_msat_arg);
20157 LDKRoutingFees fees_arg_conv;
20158 fees_arg_conv.inner = (void*)(fees_arg & (~1));
20159 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
20160 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
20161 LDKChannelUpdate last_update_message_arg_conv;
20162 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
20163 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
20164 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
20165 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv);
20166 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20167 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20168 long ret_ref = (long)ret_var.inner;
20169 if (ret_var.is_owned) {
20175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20176 LDKDirectionalChannelInfo orig_conv;
20177 orig_conv.inner = (void*)(orig & (~1));
20178 orig_conv.is_owned = false;
20179 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
20180 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20181 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20182 long ret_ref = (long)ret_var.inner;
20183 if (ret_var.is_owned) {
20189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
20190 LDKDirectionalChannelInfo obj_conv;
20191 obj_conv.inner = (void*)(obj & (~1));
20192 obj_conv.is_owned = false;
20193 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
20194 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20195 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20196 CVec_u8Z_free(ret_var);
20200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20201 LDKu8slice ser_ref;
20202 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20203 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20204 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
20205 *ret_conv = DirectionalChannelInfo_read(ser_ref);
20206 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20207 return (long)ret_conv;
20210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20211 LDKChannelInfo this_obj_conv;
20212 this_obj_conv.inner = (void*)(this_obj & (~1));
20213 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20214 ChannelInfo_free(this_obj_conv);
20217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20218 LDKChannelInfo this_ptr_conv;
20219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20220 this_ptr_conv.is_owned = false;
20221 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
20222 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20223 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20224 long ret_ref = (long)ret_var.inner;
20225 if (ret_var.is_owned) {
20231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20232 LDKChannelInfo this_ptr_conv;
20233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20234 this_ptr_conv.is_owned = false;
20235 LDKChannelFeatures val_conv;
20236 val_conv.inner = (void*)(val & (~1));
20237 val_conv.is_owned = (val & 1) || (val == 0);
20238 val_conv = ChannelFeatures_clone(&val_conv);
20239 ChannelInfo_set_features(&this_ptr_conv, val_conv);
20242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
20243 LDKChannelInfo this_ptr_conv;
20244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20245 this_ptr_conv.is_owned = false;
20246 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20247 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
20251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20252 LDKChannelInfo this_ptr_conv;
20253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20254 this_ptr_conv.is_owned = false;
20255 LDKPublicKey val_ref;
20256 CHECK((*env)->GetArrayLength(env, val) == 33);
20257 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20258 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
20261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
20262 LDKChannelInfo this_ptr_conv;
20263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20264 this_ptr_conv.is_owned = false;
20265 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
20266 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20267 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20268 long ret_ref = (long)ret_var.inner;
20269 if (ret_var.is_owned) {
20275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20276 LDKChannelInfo this_ptr_conv;
20277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20278 this_ptr_conv.is_owned = false;
20279 LDKDirectionalChannelInfo val_conv;
20280 val_conv.inner = (void*)(val & (~1));
20281 val_conv.is_owned = (val & 1) || (val == 0);
20282 val_conv = DirectionalChannelInfo_clone(&val_conv);
20283 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
20286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
20287 LDKChannelInfo this_ptr_conv;
20288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20289 this_ptr_conv.is_owned = false;
20290 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20291 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
20295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20296 LDKChannelInfo this_ptr_conv;
20297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20298 this_ptr_conv.is_owned = false;
20299 LDKPublicKey val_ref;
20300 CHECK((*env)->GetArrayLength(env, val) == 33);
20301 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20302 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
20305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
20306 LDKChannelInfo this_ptr_conv;
20307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20308 this_ptr_conv.is_owned = false;
20309 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
20310 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20311 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20312 long ret_ref = (long)ret_var.inner;
20313 if (ret_var.is_owned) {
20319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20320 LDKChannelInfo this_ptr_conv;
20321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20322 this_ptr_conv.is_owned = false;
20323 LDKDirectionalChannelInfo val_conv;
20324 val_conv.inner = (void*)(val & (~1));
20325 val_conv.is_owned = (val & 1) || (val == 0);
20326 val_conv = DirectionalChannelInfo_clone(&val_conv);
20327 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
20330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
20331 LDKChannelInfo this_ptr_conv;
20332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20333 this_ptr_conv.is_owned = false;
20334 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20335 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
20336 long ret_ref = (long)ret_copy;
20340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20341 LDKChannelInfo this_ptr_conv;
20342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20343 this_ptr_conv.is_owned = false;
20344 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
20346 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
20349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
20350 LDKChannelInfo this_ptr_conv;
20351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20352 this_ptr_conv.is_owned = false;
20353 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
20354 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20355 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20356 long ret_ref = (long)ret_var.inner;
20357 if (ret_var.is_owned) {
20363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20364 LDKChannelInfo this_ptr_conv;
20365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20366 this_ptr_conv.is_owned = false;
20367 LDKChannelAnnouncement val_conv;
20368 val_conv.inner = (void*)(val & (~1));
20369 val_conv.is_owned = (val & 1) || (val == 0);
20370 val_conv = ChannelAnnouncement_clone(&val_conv);
20371 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
20374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray node_one_arg, int64_t one_to_two_arg, int8_tArray node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) {
20375 LDKChannelFeatures features_arg_conv;
20376 features_arg_conv.inner = (void*)(features_arg & (~1));
20377 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20378 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
20379 LDKPublicKey node_one_arg_ref;
20380 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
20381 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
20382 LDKDirectionalChannelInfo one_to_two_arg_conv;
20383 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
20384 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
20385 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
20386 LDKPublicKey node_two_arg_ref;
20387 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
20388 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
20389 LDKDirectionalChannelInfo two_to_one_arg_conv;
20390 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
20391 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
20392 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
20393 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
20394 FREE((void*)capacity_sats_arg);
20395 LDKChannelAnnouncement announcement_message_arg_conv;
20396 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
20397 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
20398 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
20399 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
20400 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20401 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20402 long ret_ref = (long)ret_var.inner;
20403 if (ret_var.is_owned) {
20409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20410 LDKChannelInfo orig_conv;
20411 orig_conv.inner = (void*)(orig & (~1));
20412 orig_conv.is_owned = false;
20413 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
20414 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20415 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20416 long ret_ref = (long)ret_var.inner;
20417 if (ret_var.is_owned) {
20423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
20424 LDKChannelInfo obj_conv;
20425 obj_conv.inner = (void*)(obj & (~1));
20426 obj_conv.is_owned = false;
20427 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
20428 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20429 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20430 CVec_u8Z_free(ret_var);
20434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20435 LDKu8slice ser_ref;
20436 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20437 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20438 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20439 *ret_conv = ChannelInfo_read(ser_ref);
20440 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20441 return (long)ret_conv;
20444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20445 LDKRoutingFees this_obj_conv;
20446 this_obj_conv.inner = (void*)(this_obj & (~1));
20447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20448 RoutingFees_free(this_obj_conv);
20451 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20452 LDKRoutingFees this_ptr_conv;
20453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20454 this_ptr_conv.is_owned = false;
20455 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
20459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20460 LDKRoutingFees this_ptr_conv;
20461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20462 this_ptr_conv.is_owned = false;
20463 RoutingFees_set_base_msat(&this_ptr_conv, val);
20466 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
20467 LDKRoutingFees this_ptr_conv;
20468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20469 this_ptr_conv.is_owned = false;
20470 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
20474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20475 LDKRoutingFees this_ptr_conv;
20476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20477 this_ptr_conv.is_owned = false;
20478 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
20481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv *env, jclass clz, int32_t base_msat_arg, int32_t proportional_millionths_arg) {
20482 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
20483 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20484 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20485 long ret_ref = (long)ret_var.inner;
20486 if (ret_var.is_owned) {
20492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20493 LDKRoutingFees orig_conv;
20494 orig_conv.inner = (void*)(orig & (~1));
20495 orig_conv.is_owned = false;
20496 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
20497 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20498 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20499 long ret_ref = (long)ret_var.inner;
20500 if (ret_var.is_owned) {
20506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20507 LDKu8slice ser_ref;
20508 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20509 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20510 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20511 *ret_conv = RoutingFees_read(ser_ref);
20512 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20513 return (long)ret_conv;
20516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
20517 LDKRoutingFees obj_conv;
20518 obj_conv.inner = (void*)(obj & (~1));
20519 obj_conv.is_owned = false;
20520 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
20521 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20522 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20523 CVec_u8Z_free(ret_var);
20527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20528 LDKNodeAnnouncementInfo this_obj_conv;
20529 this_obj_conv.inner = (void*)(this_obj & (~1));
20530 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20531 NodeAnnouncementInfo_free(this_obj_conv);
20534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20535 LDKNodeAnnouncementInfo this_ptr_conv;
20536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20537 this_ptr_conv.is_owned = false;
20538 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
20539 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20540 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20541 long ret_ref = (long)ret_var.inner;
20542 if (ret_var.is_owned) {
20548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20549 LDKNodeAnnouncementInfo this_ptr_conv;
20550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20551 this_ptr_conv.is_owned = false;
20552 LDKNodeFeatures val_conv;
20553 val_conv.inner = (void*)(val & (~1));
20554 val_conv.is_owned = (val & 1) || (val == 0);
20555 val_conv = NodeFeatures_clone(&val_conv);
20556 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
20559 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
20560 LDKNodeAnnouncementInfo this_ptr_conv;
20561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20562 this_ptr_conv.is_owned = false;
20563 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
20567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20568 LDKNodeAnnouncementInfo this_ptr_conv;
20569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20570 this_ptr_conv.is_owned = false;
20571 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
20574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
20575 LDKNodeAnnouncementInfo this_ptr_conv;
20576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20577 this_ptr_conv.is_owned = false;
20578 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
20579 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
20583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20584 LDKNodeAnnouncementInfo this_ptr_conv;
20585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20586 this_ptr_conv.is_owned = false;
20587 LDKThreeBytes val_ref;
20588 CHECK((*env)->GetArrayLength(env, val) == 3);
20589 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
20590 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
20593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
20594 LDKNodeAnnouncementInfo this_ptr_conv;
20595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20596 this_ptr_conv.is_owned = false;
20597 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20598 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
20602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20603 LDKNodeAnnouncementInfo this_ptr_conv;
20604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20605 this_ptr_conv.is_owned = false;
20606 LDKThirtyTwoBytes val_ref;
20607 CHECK((*env)->GetArrayLength(env, val) == 32);
20608 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20609 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
20612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20613 LDKNodeAnnouncementInfo this_ptr_conv;
20614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20615 this_ptr_conv.is_owned = false;
20616 LDKCVec_NetAddressZ val_constr;
20617 val_constr.datalen = (*env)->GetArrayLength(env, val);
20618 if (val_constr.datalen > 0)
20619 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20621 val_constr.data = NULL;
20622 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20623 for (size_t m = 0; m < val_constr.datalen; m++) {
20624 int64_t val_conv_12 = val_vals[m];
20625 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
20626 FREE((void*)val_conv_12);
20627 val_constr.data[m] = val_conv_12_conv;
20629 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20630 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
20633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
20634 LDKNodeAnnouncementInfo this_ptr_conv;
20635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20636 this_ptr_conv.is_owned = false;
20637 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
20638 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20639 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20640 long ret_ref = (long)ret_var.inner;
20641 if (ret_var.is_owned) {
20647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20648 LDKNodeAnnouncementInfo this_ptr_conv;
20649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20650 this_ptr_conv.is_owned = false;
20651 LDKNodeAnnouncement val_conv;
20652 val_conv.inner = (void*)(val & (~1));
20653 val_conv.is_owned = (val & 1) || (val == 0);
20654 val_conv = NodeAnnouncement_clone(&val_conv);
20655 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
20658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, int64_tArray addresses_arg, int64_t announcement_message_arg) {
20659 LDKNodeFeatures features_arg_conv;
20660 features_arg_conv.inner = (void*)(features_arg & (~1));
20661 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20662 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
20663 LDKThreeBytes rgb_arg_ref;
20664 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
20665 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
20666 LDKThirtyTwoBytes alias_arg_ref;
20667 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
20668 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
20669 LDKCVec_NetAddressZ addresses_arg_constr;
20670 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
20671 if (addresses_arg_constr.datalen > 0)
20672 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20674 addresses_arg_constr.data = NULL;
20675 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
20676 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
20677 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
20678 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
20679 FREE((void*)addresses_arg_conv_12);
20680 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
20682 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
20683 LDKNodeAnnouncement announcement_message_arg_conv;
20684 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
20685 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
20686 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
20687 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
20688 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20689 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20690 long ret_ref = (long)ret_var.inner;
20691 if (ret_var.is_owned) {
20697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20698 LDKNodeAnnouncementInfo orig_conv;
20699 orig_conv.inner = (void*)(orig & (~1));
20700 orig_conv.is_owned = false;
20701 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
20702 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20703 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20704 long ret_ref = (long)ret_var.inner;
20705 if (ret_var.is_owned) {
20711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
20712 LDKNodeAnnouncementInfo obj_conv;
20713 obj_conv.inner = (void*)(obj & (~1));
20714 obj_conv.is_owned = false;
20715 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
20716 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20717 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20718 CVec_u8Z_free(ret_var);
20722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20723 LDKu8slice ser_ref;
20724 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20725 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20726 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20727 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
20728 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20729 return (long)ret_conv;
20732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20733 LDKNodeInfo this_obj_conv;
20734 this_obj_conv.inner = (void*)(this_obj & (~1));
20735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20736 NodeInfo_free(this_obj_conv);
20739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20740 LDKNodeInfo this_ptr_conv;
20741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20742 this_ptr_conv.is_owned = false;
20743 LDKCVec_u64Z val_constr;
20744 val_constr.datalen = (*env)->GetArrayLength(env, val);
20745 if (val_constr.datalen > 0)
20746 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20748 val_constr.data = NULL;
20749 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20750 for (size_t g = 0; g < val_constr.datalen; g++) {
20751 int64_t val_conv_6 = val_vals[g];
20752 val_constr.data[g] = val_conv_6;
20754 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20755 NodeInfo_set_channels(&this_ptr_conv, val_constr);
20758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
20759 LDKNodeInfo this_ptr_conv;
20760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20761 this_ptr_conv.is_owned = false;
20762 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
20763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20765 long ret_ref = (long)ret_var.inner;
20766 if (ret_var.is_owned) {
20772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20773 LDKNodeInfo this_ptr_conv;
20774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20775 this_ptr_conv.is_owned = false;
20776 LDKRoutingFees val_conv;
20777 val_conv.inner = (void*)(val & (~1));
20778 val_conv.is_owned = (val & 1) || (val == 0);
20779 val_conv = RoutingFees_clone(&val_conv);
20780 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
20783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
20784 LDKNodeInfo this_ptr_conv;
20785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20786 this_ptr_conv.is_owned = false;
20787 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
20788 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20789 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20790 long ret_ref = (long)ret_var.inner;
20791 if (ret_var.is_owned) {
20797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20798 LDKNodeInfo this_ptr_conv;
20799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20800 this_ptr_conv.is_owned = false;
20801 LDKNodeAnnouncementInfo val_conv;
20802 val_conv.inner = (void*)(val & (~1));
20803 val_conv.is_owned = (val & 1) || (val == 0);
20804 val_conv = NodeAnnouncementInfo_clone(&val_conv);
20805 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
20808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t lowest_inbound_channel_fees_arg, int64_t announcement_info_arg) {
20809 LDKCVec_u64Z channels_arg_constr;
20810 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
20811 if (channels_arg_constr.datalen > 0)
20812 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20814 channels_arg_constr.data = NULL;
20815 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
20816 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
20817 int64_t channels_arg_conv_6 = channels_arg_vals[g];
20818 channels_arg_constr.data[g] = channels_arg_conv_6;
20820 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
20821 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
20822 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
20823 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
20824 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
20825 LDKNodeAnnouncementInfo announcement_info_arg_conv;
20826 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
20827 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
20828 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
20829 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
20830 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20831 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20832 long ret_ref = (long)ret_var.inner;
20833 if (ret_var.is_owned) {
20839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20840 LDKNodeInfo orig_conv;
20841 orig_conv.inner = (void*)(orig & (~1));
20842 orig_conv.is_owned = false;
20843 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
20844 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20845 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20846 long ret_ref = (long)ret_var.inner;
20847 if (ret_var.is_owned) {
20853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
20854 LDKNodeInfo obj_conv;
20855 obj_conv.inner = (void*)(obj & (~1));
20856 obj_conv.is_owned = false;
20857 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
20858 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20859 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20860 CVec_u8Z_free(ret_var);
20864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20865 LDKu8slice ser_ref;
20866 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20867 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20868 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20869 *ret_conv = NodeInfo_read(ser_ref);
20870 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20871 return (long)ret_conv;
20874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
20875 LDKNetworkGraph obj_conv;
20876 obj_conv.inner = (void*)(obj & (~1));
20877 obj_conv.is_owned = false;
20878 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
20879 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20880 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20881 CVec_u8Z_free(ret_var);
20885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20886 LDKu8slice ser_ref;
20887 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20888 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20889 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20890 *ret_conv = NetworkGraph_read(ser_ref);
20891 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20892 return (long)ret_conv;
20895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
20896 LDKThirtyTwoBytes genesis_hash_ref;
20897 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
20898 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
20899 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
20900 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20901 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20902 long ret_ref = (long)ret_var.inner;
20903 if (ret_var.is_owned) {
20909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20910 LDKNetworkGraph this_arg_conv;
20911 this_arg_conv.inner = (void*)(this_arg & (~1));
20912 this_arg_conv.is_owned = false;
20913 LDKNodeAnnouncement msg_conv;
20914 msg_conv.inner = (void*)(msg & (~1));
20915 msg_conv.is_owned = false;
20916 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20917 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
20918 return (long)ret_conv;
20921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20922 LDKNetworkGraph this_arg_conv;
20923 this_arg_conv.inner = (void*)(this_arg & (~1));
20924 this_arg_conv.is_owned = false;
20925 LDKUnsignedNodeAnnouncement msg_conv;
20926 msg_conv.inner = (void*)(msg & (~1));
20927 msg_conv.is_owned = false;
20928 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20929 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
20930 return (long)ret_conv;
20933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) {
20934 LDKNetworkGraph this_arg_conv;
20935 this_arg_conv.inner = (void*)(this_arg & (~1));
20936 this_arg_conv.is_owned = false;
20937 LDKChannelAnnouncement msg_conv;
20938 msg_conv.inner = (void*)(msg & (~1));
20939 msg_conv.is_owned = false;
20940 LDKAccess *chain_access_conv_ptr = NULL;
20941 if (chain_access != 0) {
20942 LDKAccess chain_access_conv;
20943 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20944 if (chain_access_conv.free == LDKAccess_JCalls_free) {
20945 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20946 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
20948 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20949 *chain_access_conv_ptr = chain_access_conv;
20951 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20952 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20953 return (long)ret_conv;
20956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) {
20957 LDKNetworkGraph this_arg_conv;
20958 this_arg_conv.inner = (void*)(this_arg & (~1));
20959 this_arg_conv.is_owned = false;
20960 LDKUnsignedChannelAnnouncement msg_conv;
20961 msg_conv.inner = (void*)(msg & (~1));
20962 msg_conv.is_owned = false;
20963 LDKAccess *chain_access_conv_ptr = NULL;
20964 if (chain_access != 0) {
20965 LDKAccess chain_access_conv;
20966 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
20967 if (chain_access_conv.free == LDKAccess_JCalls_free) {
20968 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20969 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
20971 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
20972 *chain_access_conv_ptr = chain_access_conv;
20974 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20975 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
20976 return (long)ret_conv;
20979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
20980 LDKNetworkGraph this_arg_conv;
20981 this_arg_conv.inner = (void*)(this_arg & (~1));
20982 this_arg_conv.is_owned = false;
20983 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
20986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20987 LDKNetworkGraph this_arg_conv;
20988 this_arg_conv.inner = (void*)(this_arg & (~1));
20989 this_arg_conv.is_owned = false;
20990 LDKChannelUpdate msg_conv;
20991 msg_conv.inner = (void*)(msg & (~1));
20992 msg_conv.is_owned = false;
20993 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20994 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
20995 return (long)ret_conv;
20998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20999 LDKNetworkGraph this_arg_conv;
21000 this_arg_conv.inner = (void*)(this_arg & (~1));
21001 this_arg_conv.is_owned = false;
21002 LDKUnsignedChannelUpdate msg_conv;
21003 msg_conv.inner = (void*)(msg & (~1));
21004 msg_conv.is_owned = false;
21005 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21006 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
21007 return (long)ret_conv;