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;
276 static jclass LDKNetwork_class = NULL;
277 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
278 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
279 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
280 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv *env, jclass clz) {
281 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
282 CHECK(LDKNetwork_class != NULL);
283 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
284 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
285 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
286 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
287 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
288 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
290 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
292 case LDKNetwork_Bitcoin:
293 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
294 case LDKNetwork_Testnet:
295 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
296 case LDKNetwork_Regtest:
297 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
302 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
303 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
304 case 0: return LDKSecp256k1Error_IncorrectSignature;
305 case 1: return LDKSecp256k1Error_InvalidMessage;
306 case 2: return LDKSecp256k1Error_InvalidPublicKey;
307 case 3: return LDKSecp256k1Error_InvalidSignature;
308 case 4: return LDKSecp256k1Error_InvalidSecretKey;
309 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
310 case 6: return LDKSecp256k1Error_InvalidTweak;
311 case 7: return LDKSecp256k1Error_NotEnoughMemory;
312 case 8: return LDKSecp256k1Error_CallbackPanicked;
316 static jclass LDKSecp256k1Error_class = NULL;
317 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
318 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
319 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
320 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
321 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
322 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
323 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
324 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
325 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
326 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv *env, jclass clz) {
327 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
328 CHECK(LDKSecp256k1Error_class != NULL);
329 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
330 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
331 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
332 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
333 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
334 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
335 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
336 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
337 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
338 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
339 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
340 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
341 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
342 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
343 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
344 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
345 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
346 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
348 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
350 case LDKSecp256k1Error_IncorrectSignature:
351 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
352 case LDKSecp256k1Error_InvalidMessage:
353 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
354 case LDKSecp256k1Error_InvalidPublicKey:
355 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
356 case LDKSecp256k1Error_InvalidSignature:
357 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
358 case LDKSecp256k1Error_InvalidSecretKey:
359 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
360 case LDKSecp256k1Error_InvalidRecoveryId:
361 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
362 case LDKSecp256k1Error_InvalidTweak:
363 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
364 case LDKSecp256k1Error_NotEnoughMemory:
365 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
366 case LDKSecp256k1Error_CallbackPanicked:
367 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
373 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
374 ret->datalen = (*env)->GetArrayLength(env, elems);
375 if (ret->datalen == 0) {
378 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
379 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
380 for (size_t i = 0; i < ret->datalen; i++) {
381 ret->data[i] = java_elems[i];
383 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
387 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
388 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
389 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
393 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
399 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1);
402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
403 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1);
406 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
407 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
408 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
409 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
410 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
411 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
413 LDKSpendableOutputDescriptor_StaticOutput_class =
414 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
415 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
416 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
417 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
418 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
419 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
420 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
421 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
422 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
423 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
424 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
425 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
426 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
427 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
429 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
430 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
432 case LDKSpendableOutputDescriptor_StaticOutput: {
433 LDKOutPoint outpoint_var = obj->static_output.outpoint;
434 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
435 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
436 long outpoint_ref = (long)outpoint_var.inner & ~1;
437 long output_ref = ((long)&obj->static_output.output) | 1;
438 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
440 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
441 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
442 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
443 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
444 long outpoint_ref = (long)outpoint_var.inner & ~1;
445 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
446 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
447 long output_ref = ((long)&obj->dynamic_output_p2wsh.output) | 1;
448 long key_derivation_params_ref = (long)(&obj->dynamic_output_p2wsh.key_derivation_params) | 1;
449 int8_tArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
450 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
451 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, (long)output_ref, key_derivation_params_ref, revocation_pubkey_arr);
453 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
454 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
455 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
456 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
457 long outpoint_ref = (long)outpoint_var.inner & ~1;
458 long output_ref = ((long)&obj->static_output_counterparty_payment.output) | 1;
459 long key_derivation_params_ref = (long)(&obj->static_output_counterparty_payment.key_derivation_params) | 1;
460 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, (long)output_ref, key_derivation_params_ref);
465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
466 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
467 ret->datalen = (*env)->GetArrayLength(env, elems);
468 if (ret->datalen == 0) {
471 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
472 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
473 for (size_t i = 0; i < ret->datalen; i++) {
474 int64_t arr_elem = java_elems[i];
475 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
476 FREE((void*)arr_elem);
477 ret->data[i] = arr_elem_conv;
479 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
483 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
484 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
485 for (size_t i = 0; i < ret.datalen; i++) {
486 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
490 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
491 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
492 static jclass LDKErrorAction_IgnoreError_class = NULL;
493 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
494 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
495 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
497 LDKErrorAction_DisconnectPeer_class =
498 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
499 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
500 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
501 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
502 LDKErrorAction_IgnoreError_class =
503 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
504 CHECK(LDKErrorAction_IgnoreError_class != NULL);
505 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
506 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
507 LDKErrorAction_SendErrorMessage_class =
508 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
509 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
510 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
511 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
513 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
514 LDKErrorAction *obj = (LDKErrorAction*)ptr;
516 case LDKErrorAction_DisconnectPeer: {
517 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
518 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
519 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
520 long msg_ref = (long)msg_var.inner & ~1;
521 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
523 case LDKErrorAction_IgnoreError: {
524 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
526 case LDKErrorAction_SendErrorMessage: {
527 LDKErrorMessage msg_var = obj->send_error_message.msg;
528 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
529 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
530 long msg_ref = (long)msg_var.inner & ~1;
531 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
536 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
537 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
538 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
539 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
540 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
541 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
543 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
544 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
545 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
546 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
547 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
548 LDKHTLCFailChannelUpdate_ChannelClosed_class =
549 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
550 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
551 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
552 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
553 LDKHTLCFailChannelUpdate_NodeFailure_class =
554 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
555 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
556 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
557 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
559 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
560 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
562 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
563 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
564 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
565 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
566 long msg_ref = (long)msg_var.inner & ~1;
567 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
569 case LDKHTLCFailChannelUpdate_ChannelClosed: {
570 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
572 case LDKHTLCFailChannelUpdate_NodeFailure: {
573 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
574 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
575 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
580 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
581 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
582 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
583 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
584 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
585 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
586 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
587 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
588 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
589 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
590 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
591 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
592 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
593 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
594 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
595 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
596 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
597 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
598 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
599 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
600 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
601 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
602 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
603 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
604 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
605 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
606 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
607 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
608 static jclass LDKMessageSendEvent_HandleError_class = NULL;
609 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
610 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
611 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
612 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
613 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
614 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
615 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
617 LDKMessageSendEvent_SendAcceptChannel_class =
618 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
619 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
620 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
621 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
622 LDKMessageSendEvent_SendOpenChannel_class =
623 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
624 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
625 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
626 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
627 LDKMessageSendEvent_SendFundingCreated_class =
628 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
629 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
630 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
631 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
632 LDKMessageSendEvent_SendFundingSigned_class =
633 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
634 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
635 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
636 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
637 LDKMessageSendEvent_SendFundingLocked_class =
638 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
639 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
640 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
641 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
642 LDKMessageSendEvent_SendAnnouncementSignatures_class =
643 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
644 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
645 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
646 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
647 LDKMessageSendEvent_UpdateHTLCs_class =
648 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
649 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
650 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
651 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
652 LDKMessageSendEvent_SendRevokeAndACK_class =
653 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
654 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
655 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
656 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
657 LDKMessageSendEvent_SendClosingSigned_class =
658 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
659 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
660 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
661 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
662 LDKMessageSendEvent_SendShutdown_class =
663 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
664 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
665 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
666 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
667 LDKMessageSendEvent_SendChannelReestablish_class =
668 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
669 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
670 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
671 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
672 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
673 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
674 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
675 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
676 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
677 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
678 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
679 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
680 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
681 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
682 LDKMessageSendEvent_BroadcastChannelUpdate_class =
683 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
684 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
685 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
686 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
687 LDKMessageSendEvent_HandleError_class =
688 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
689 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
690 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
691 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
692 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
693 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
694 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
695 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
696 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
697 LDKMessageSendEvent_SendChannelRangeQuery_class =
698 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
699 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
700 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
701 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
702 LDKMessageSendEvent_SendShortIdsQuery_class =
703 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
704 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
705 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
706 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
708 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
709 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
711 case LDKMessageSendEvent_SendAcceptChannel: {
712 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
713 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
714 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
715 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
716 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
717 long msg_ref = (long)msg_var.inner & ~1;
718 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
720 case LDKMessageSendEvent_SendOpenChannel: {
721 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
722 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
723 LDKOpenChannel msg_var = obj->send_open_channel.msg;
724 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
725 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
726 long msg_ref = (long)msg_var.inner & ~1;
727 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
729 case LDKMessageSendEvent_SendFundingCreated: {
730 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
731 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
732 LDKFundingCreated msg_var = obj->send_funding_created.msg;
733 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
734 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
735 long msg_ref = (long)msg_var.inner & ~1;
736 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
738 case LDKMessageSendEvent_SendFundingSigned: {
739 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
740 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
741 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
742 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
743 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
744 long msg_ref = (long)msg_var.inner & ~1;
745 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
747 case LDKMessageSendEvent_SendFundingLocked: {
748 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
749 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
750 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
751 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
752 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
753 long msg_ref = (long)msg_var.inner & ~1;
754 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
756 case LDKMessageSendEvent_SendAnnouncementSignatures: {
757 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
758 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
759 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
760 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
761 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
762 long msg_ref = (long)msg_var.inner & ~1;
763 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
765 case LDKMessageSendEvent_UpdateHTLCs: {
766 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
767 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
768 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
769 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
770 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
771 long updates_ref = (long)updates_var.inner & ~1;
772 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
774 case LDKMessageSendEvent_SendRevokeAndACK: {
775 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
776 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
777 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
778 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
779 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
780 long msg_ref = (long)msg_var.inner & ~1;
781 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
783 case LDKMessageSendEvent_SendClosingSigned: {
784 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
785 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
786 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
787 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
788 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
789 long msg_ref = (long)msg_var.inner & ~1;
790 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
792 case LDKMessageSendEvent_SendShutdown: {
793 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
794 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
795 LDKShutdown msg_var = obj->send_shutdown.msg;
796 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
797 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
798 long msg_ref = (long)msg_var.inner & ~1;
799 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
801 case LDKMessageSendEvent_SendChannelReestablish: {
802 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
803 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
804 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
805 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
806 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
807 long msg_ref = (long)msg_var.inner & ~1;
808 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
810 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
811 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
812 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
813 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
814 long msg_ref = (long)msg_var.inner & ~1;
815 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
816 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
817 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
818 long update_msg_ref = (long)update_msg_var.inner & ~1;
819 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
821 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
822 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
823 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
824 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
825 long msg_ref = (long)msg_var.inner & ~1;
826 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
828 case LDKMessageSendEvent_BroadcastChannelUpdate: {
829 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
830 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
831 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
832 long msg_ref = (long)msg_var.inner & ~1;
833 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
835 case LDKMessageSendEvent_HandleError: {
836 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
837 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
838 long action_ref = ((long)&obj->handle_error.action) | 1;
839 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
841 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
842 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
843 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
845 case LDKMessageSendEvent_SendChannelRangeQuery: {
846 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
847 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
848 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
849 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
850 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
851 long msg_ref = (long)msg_var.inner & ~1;
852 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
854 case LDKMessageSendEvent_SendShortIdsQuery: {
855 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
856 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
857 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
858 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
859 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
860 long msg_ref = (long)msg_var.inner & ~1;
861 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
867 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
868 ret->datalen = (*env)->GetArrayLength(env, elems);
869 if (ret->datalen == 0) {
872 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
873 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
874 for (size_t i = 0; i < ret->datalen; i++) {
875 int64_t arr_elem = java_elems[i];
876 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
877 FREE((void*)arr_elem);
878 ret->data[i] = arr_elem_conv;
880 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
884 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
885 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
886 for (size_t i = 0; i < ret.datalen; i++) {
887 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
891 static jclass LDKEvent_FundingGenerationReady_class = NULL;
892 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
893 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
894 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
895 static jclass LDKEvent_PaymentReceived_class = NULL;
896 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
897 static jclass LDKEvent_PaymentSent_class = NULL;
898 static jmethodID LDKEvent_PaymentSent_meth = NULL;
899 static jclass LDKEvent_PaymentFailed_class = NULL;
900 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
901 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
902 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
903 static jclass LDKEvent_SpendableOutputs_class = NULL;
904 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
906 LDKEvent_FundingGenerationReady_class =
907 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
908 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
909 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
910 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
911 LDKEvent_FundingBroadcastSafe_class =
912 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
913 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
914 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
915 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
916 LDKEvent_PaymentReceived_class =
917 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
918 CHECK(LDKEvent_PaymentReceived_class != NULL);
919 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
920 CHECK(LDKEvent_PaymentReceived_meth != NULL);
921 LDKEvent_PaymentSent_class =
922 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
923 CHECK(LDKEvent_PaymentSent_class != NULL);
924 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
925 CHECK(LDKEvent_PaymentSent_meth != NULL);
926 LDKEvent_PaymentFailed_class =
927 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
928 CHECK(LDKEvent_PaymentFailed_class != NULL);
929 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
930 CHECK(LDKEvent_PaymentFailed_meth != NULL);
931 LDKEvent_PendingHTLCsForwardable_class =
932 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
933 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
934 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
935 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
936 LDKEvent_SpendableOutputs_class =
937 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
938 CHECK(LDKEvent_SpendableOutputs_class != NULL);
939 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
940 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
942 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
943 LDKEvent *obj = (LDKEvent*)ptr;
945 case LDKEvent_FundingGenerationReady: {
946 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
947 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
948 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
949 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
950 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
951 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);
953 case LDKEvent_FundingBroadcastSafe: {
954 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
955 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
956 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
957 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
958 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
960 case LDKEvent_PaymentReceived: {
961 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
962 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
963 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
964 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
965 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
967 case LDKEvent_PaymentSent: {
968 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
969 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
970 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
972 case LDKEvent_PaymentFailed: {
973 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
974 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
975 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
977 case LDKEvent_PendingHTLCsForwardable: {
978 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
980 case LDKEvent_SpendableOutputs: {
981 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
982 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
983 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
984 for (size_t b = 0; b < outputs_var.datalen; b++) {
985 long arr_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
986 outputs_arr_ptr[b] = arr_conv_27_ref;
988 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
989 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
995 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
996 ret->datalen = (*env)->GetArrayLength(env, elems);
997 if (ret->datalen == 0) {
1000 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1001 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1002 for (size_t i = 0; i < ret->datalen; i++) {
1003 int64_t arr_elem = java_elems[i];
1004 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1005 FREE((void*)arr_elem);
1006 ret->data[i] = arr_elem_conv;
1008 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1012 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1013 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1014 for (size_t i = 0; i < ret.datalen; i++) {
1015 ret.data[i] = Event_clone(&orig->data[i]);
1019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1020 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1022 LDKTransaction b_ref;
1023 b_ref.datalen = (*env)->GetArrayLength(env, b);
1024 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1025 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1026 b_ref.data_is_owned = false;
1030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1031 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1035 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1036 LDKTransaction b_var = tuple->b;
1037 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1038 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1042 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1043 ret->datalen = (*env)->GetArrayLength(env, elems);
1044 if (ret->datalen == 0) {
1047 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1048 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1049 for (size_t i = 0; i < ret->datalen; i++) {
1050 int64_t arr_elem = java_elems[i];
1051 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1052 FREE((void*)arr_elem);
1053 ret->data[i] = arr_elem_conv;
1055 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1060 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1063 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1064 CHECK(val->result_ok);
1065 return *val->contents.result;
1067 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1068 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1069 CHECK(!val->result_ok);
1070 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1074 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1075 ret->datalen = (*env)->GetArrayLength(env, elems);
1076 if (ret->datalen == 0) {
1079 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1080 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1081 for (size_t i = 0; i < ret->datalen; i++) {
1082 int64_t arr_elem = java_elems[i];
1083 LDKMonitorEvent arr_elem_conv;
1084 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1085 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1086 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
1087 ret->data[i] = arr_elem_conv;
1089 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1093 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1094 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1095 for (size_t i = 0; i < ret.datalen; i++) {
1096 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1101 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1104 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1105 CHECK(val->result_ok);
1106 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1107 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1108 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1109 long res_ref = (long)res_var.inner & ~1;
1112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1113 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1114 CHECK(!val->result_ok);
1115 LDKDecodeError err_var = (*val->contents.err);
1116 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1117 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1118 long err_ref = (long)err_var.inner & ~1;
1121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1122 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1125 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1126 CHECK(val->result_ok);
1127 return *val->contents.result;
1129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1130 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1131 CHECK(!val->result_ok);
1132 LDKMonitorUpdateError err_var = (*val->contents.err);
1133 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1134 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1135 long err_ref = (long)err_var.inner & ~1;
1138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1139 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1141 a_conv.inner = (void*)(a & (~1));
1142 a_conv.is_owned = (a & 1) || (a == 0);
1143 a_conv = OutPoint_clone(&a_conv);
1146 b_ref.datalen = (*env)->GetArrayLength(env, b);
1147 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1148 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1153 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1154 LDKOutPoint a_var = tuple->a;
1155 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1156 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1157 long a_ref = (long)a_var.inner & ~1;
1160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1161 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1162 LDKCVec_u8Z b_var = tuple->b;
1163 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1164 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
1168 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1170 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1175 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1176 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1180 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1181 long b_ref = ((long)&tuple->b) | 1;
1184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1185 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1186 ret->datalen = (*env)->GetArrayLength(env, elems);
1187 if (ret->datalen == 0) {
1190 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ 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 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1195 FREE((void*)arr_elem);
1196 ret->data[i] = arr_elem_conv;
1198 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1202 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1203 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1204 for (size_t i = 0; i < ret.datalen; i++) {
1205 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
1210 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1211 LDKThirtyTwoBytes a_ref;
1212 CHECK((*env)->GetArrayLength(env, a) == 32);
1213 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
1215 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1216 b_constr.datalen = (*env)->GetArrayLength(env, b);
1217 if (b_constr.datalen > 0)
1218 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1220 b_constr.data = NULL;
1221 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
1222 for (size_t a = 0; a < b_constr.datalen; a++) {
1223 int64_t arr_conv_26 = b_vals[a];
1224 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
1225 FREE((void*)arr_conv_26);
1226 b_constr.data[a] = arr_conv_26_conv;
1228 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
1232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1233 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1234 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
1235 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
1238 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1239 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1240 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1241 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
1242 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
1243 for (size_t a = 0; a < b_var.datalen; a++) {
1244 long arr_conv_26_ref = (long)(&b_var.data[a]) | 1;
1245 b_arr_ptr[a] = arr_conv_26_ref;
1247 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
1250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1251 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1252 ret->datalen = (*env)->GetArrayLength(env, elems);
1253 if (ret->datalen == 0) {
1256 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1257 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1258 for (size_t i = 0; i < ret->datalen; i++) {
1259 int64_t arr_elem = java_elems[i];
1260 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1261 FREE((void*)arr_elem);
1262 ret->data[i] = arr_elem_conv;
1264 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
1269 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1271 CHECK((*env)->GetArrayLength(env, a) == 64);
1272 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
1274 LDKCVec_SignatureZ b_constr;
1275 b_constr.datalen = (*env)->GetArrayLength(env, b);
1276 if (b_constr.datalen > 0)
1277 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1279 b_constr.data = NULL;
1280 for (size_t i = 0; i < b_constr.datalen; i++) {
1281 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
1282 LDKSignature arr_conv_8_ref;
1283 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
1284 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
1285 b_constr.data[i] = arr_conv_8_ref;
1290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1291 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1292 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
1293 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
1296 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1297 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1298 LDKCVec_SignatureZ b_var = tuple->b;
1299 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
1301 for (size_t i = 0; i < b_var.datalen; i++) {
1302 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
1303 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
1304 (*env)->SetObjectArrayElement(env, b_arr, i, arr_conv_8_arr);
1308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1309 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1312 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1313 CHECK(val->result_ok);
1314 long res_ref = (long)(&(*val->contents.result)) | 1;
1317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1318 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1319 CHECK(!val->result_ok);
1320 return *val->contents.err;
1322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1323 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1326 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1327 CHECK(val->result_ok);
1328 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
1329 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
1332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1333 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1334 CHECK(!val->result_ok);
1335 return *val->contents.err;
1337 typedef struct LDKChannelKeys_JCalls {
1338 atomic_size_t refcnt;
1341 jmethodID get_per_commitment_point_meth;
1342 jmethodID release_commitment_secret_meth;
1343 jmethodID key_derivation_params_meth;
1344 jmethodID sign_counterparty_commitment_meth;
1345 jmethodID sign_holder_commitment_and_htlcs_meth;
1346 jmethodID sign_justice_transaction_meth;
1347 jmethodID sign_counterparty_htlc_transaction_meth;
1348 jmethodID sign_closing_transaction_meth;
1349 jmethodID sign_channel_announcement_meth;
1350 jmethodID ready_channel_meth;
1351 jmethodID write_meth;
1352 } LDKChannelKeys_JCalls;
1353 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1354 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1355 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1357 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1358 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1362 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1363 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1365 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1366 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1368 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1369 LDKPublicKey arg_ref;
1370 CHECK((*env)->GetArrayLength(env, arg) == 33);
1371 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
1374 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1375 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1377 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1378 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1380 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1381 LDKThirtyTwoBytes arg_ref;
1382 CHECK((*env)->GetArrayLength(env, arg) == 32);
1383 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
1386 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1387 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1389 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1390 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1392 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1393 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)ret) & ~1);
1394 ret_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)ret);
1397 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1398 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1400 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1401 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1402 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1403 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1404 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1405 long commitment_tx_ref = (long)commitment_tx_var.inner;
1406 if (commitment_tx_var.is_owned) {
1407 commitment_tx_ref |= 1;
1409 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1411 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1412 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1413 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1416 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1417 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1419 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1420 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1421 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1422 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1423 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1424 long commitment_tx_ref = (long)commitment_tx_var.inner;
1425 if (commitment_tx_var.is_owned) {
1426 commitment_tx_ref |= 1;
1428 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1430 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1431 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1432 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1435 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1436 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1438 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1439 LDKTransaction justice_tx_var = justice_tx;
1440 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
1441 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
1442 Transaction_free(justice_tx_var);
1443 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1444 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1445 LDKHTLCOutputInCommitment htlc_var = *htlc;
1446 htlc_var = HTLCOutputInCommitment_clone(htlc);
1447 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1448 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1449 long htlc_ref = (long)htlc_var.inner;
1450 if (htlc_var.is_owned) {
1453 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1455 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);
1456 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1457 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1460 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1461 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1463 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1464 LDKTransaction htlc_tx_var = htlc_tx;
1465 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
1466 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
1467 Transaction_free(htlc_tx_var);
1468 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1469 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1470 LDKHTLCOutputInCommitment htlc_var = *htlc;
1471 htlc_var = HTLCOutputInCommitment_clone(htlc);
1472 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1473 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1474 long htlc_ref = (long)htlc_var.inner;
1475 if (htlc_var.is_owned) {
1478 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1480 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);
1481 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1482 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1485 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1486 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1488 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1489 LDKTransaction closing_tx_var = closing_tx;
1490 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
1491 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
1492 Transaction_free(closing_tx_var);
1493 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1495 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
1496 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1497 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1500 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1501 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1503 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1504 LDKUnsignedChannelAnnouncement msg_var = *msg;
1505 msg_var = UnsignedChannelAnnouncement_clone(msg);
1506 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1507 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1508 long msg_ref = (long)msg_var.inner;
1509 if (msg_var.is_owned) {
1512 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1514 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
1515 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1516 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1519 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1520 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1522 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1523 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1524 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1525 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1526 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1527 long channel_parameters_ref = (long)channel_parameters_var.inner;
1528 if (channel_parameters_var.is_owned) {
1529 channel_parameters_ref |= 1;
1531 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1533 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
1535 LDKCVec_u8Z write_jcall(const void* this_arg) {
1536 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1538 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
1539 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1541 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
1542 LDKCVec_u8Z arg_ref;
1543 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
1544 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1545 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
1548 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1549 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1550 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1551 return (void*) this_arg;
1553 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
1554 jclass c = (*env)->GetObjectClass(env, o);
1556 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1557 atomic_init(&calls->refcnt, 1);
1558 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1559 calls->o = (*env)->NewWeakGlobalRef(env, o);
1560 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1561 CHECK(calls->get_per_commitment_point_meth != NULL);
1562 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1563 CHECK(calls->release_commitment_secret_meth != NULL);
1564 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1565 CHECK(calls->key_derivation_params_meth != NULL);
1566 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
1567 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1568 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
1569 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
1570 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
1571 CHECK(calls->sign_justice_transaction_meth != NULL);
1572 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
1573 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1574 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
1575 CHECK(calls->sign_closing_transaction_meth != NULL);
1576 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1577 CHECK(calls->sign_channel_announcement_meth != NULL);
1578 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
1579 CHECK(calls->ready_channel_meth != NULL);
1580 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
1581 CHECK(calls->write_meth != NULL);
1583 LDKChannelPublicKeys pubkeys_conv;
1584 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1585 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1586 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1588 LDKChannelKeys ret = {
1589 .this_arg = (void*) calls,
1590 .get_per_commitment_point = get_per_commitment_point_jcall,
1591 .release_commitment_secret = release_commitment_secret_jcall,
1592 .key_derivation_params = key_derivation_params_jcall,
1593 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1594 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall,
1595 .sign_justice_transaction = sign_justice_transaction_jcall,
1596 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1597 .sign_closing_transaction = sign_closing_transaction_jcall,
1598 .sign_channel_announcement = sign_channel_announcement_jcall,
1599 .ready_channel = ready_channel_jcall,
1600 .clone = LDKChannelKeys_JCalls_clone,
1601 .write = write_jcall,
1602 .free = LDKChannelKeys_JCalls_free,
1603 .pubkeys = pubkeys_conv,
1604 .set_pubkeys = NULL,
1608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
1609 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1610 *res_ptr = LDKChannelKeys_init(env, clz, o, pubkeys);
1611 return (long)res_ptr;
1613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
1614 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1615 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
1616 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
1621 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1622 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
1623 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv *env, jclass clz, int64_t this_arg) {
1628 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1629 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1630 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1631 return (long)ret_ref;
1634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
1635 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1636 LDKCommitmentTransaction commitment_tx_conv;
1637 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1638 commitment_tx_conv.is_owned = false;
1639 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1640 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1641 return (long)ret_conv;
1644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
1645 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1646 LDKHolderCommitmentTransaction commitment_tx_conv;
1647 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1648 commitment_tx_conv.is_owned = false;
1649 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1650 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1651 return (long)ret_conv;
1654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_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) {
1655 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1656 LDKTransaction justice_tx_ref;
1657 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
1658 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1659 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
1660 justice_tx_ref.data_is_owned = true;
1661 unsigned char per_commitment_key_arr[32];
1662 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
1663 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
1664 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1665 LDKHTLCOutputInCommitment htlc_conv;
1666 htlc_conv.inner = (void*)(htlc & (~1));
1667 htlc_conv.is_owned = false;
1668 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1669 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1670 return (long)ret_conv;
1673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_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) {
1674 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1675 LDKTransaction htlc_tx_ref;
1676 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
1677 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1678 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
1679 htlc_tx_ref.data_is_owned = true;
1680 LDKPublicKey per_commitment_point_ref;
1681 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
1682 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1683 LDKHTLCOutputInCommitment htlc_conv;
1684 htlc_conv.inner = (void*)(htlc & (~1));
1685 htlc_conv.is_owned = false;
1686 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1687 *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);
1688 return (long)ret_conv;
1691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
1692 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1693 LDKTransaction closing_tx_ref;
1694 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
1695 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1696 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
1697 closing_tx_ref.data_is_owned = true;
1698 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1699 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1700 return (long)ret_conv;
1703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
1704 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1705 LDKUnsignedChannelAnnouncement msg_conv;
1706 msg_conv.inner = (void*)(msg & (~1));
1707 msg_conv.is_owned = false;
1708 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1709 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1710 return (long)ret_conv;
1713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
1714 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1715 LDKChannelTransactionParameters channel_parameters_conv;
1716 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1717 channel_parameters_conv.is_owned = false;
1718 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
1722 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1723 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1724 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
1725 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
1726 CVec_u8Z_free(arg_var);
1730 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1731 if (this_arg->set_pubkeys != NULL)
1732 this_arg->set_pubkeys(this_arg);
1733 return this_arg->pubkeys;
1735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
1736 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1737 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1740 long ret_ref = (long)ret_var.inner;
1741 if (ret_var.is_owned) {
1747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
1748 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1749 LDKThirtyTwoBytes a_ref;
1750 CHECK((*env)->GetArrayLength(env, a) == 32);
1751 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
1753 LDKChannelMonitor b_conv;
1754 b_conv.inner = (void*)(b & (~1));
1755 b_conv.is_owned = (b & 1) || (b == 0);
1756 b_conv = ChannelMonitor_clone(&b_conv);
1760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1761 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1762 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
1763 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
1766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1767 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1768 LDKChannelMonitor b_var = tuple->b;
1769 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1770 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1771 long b_ref = (long)b_var.inner & ~1;
1774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1775 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1778 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1779 CHECK(val->result_ok);
1780 long res_ref = (long)(&(*val->contents.result)) | 1;
1783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1784 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1785 CHECK(!val->result_ok);
1786 LDKDecodeError err_var = (*val->contents.err);
1787 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1788 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1789 long err_ref = (long)err_var.inner & ~1;
1792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1793 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1796 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1797 CHECK(val->result_ok);
1798 long res_ref = ((long)&(*val->contents.result)) | 1;
1801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1802 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1803 CHECK(!val->result_ok);
1804 LDKDecodeError err_var = (*val->contents.err);
1805 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1806 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1807 long err_ref = (long)err_var.inner & ~1;
1810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1811 return ((LDKCResult_ChanKeySignerDecodeErrorZ*)arg)->result_ok;
1813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1814 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)(arg & ~1);
1815 CHECK(val->result_ok);
1816 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1817 *ret = ChannelKeys_clone(&(*val->contents.result));
1820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1821 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)(arg & ~1);
1822 CHECK(!val->result_ok);
1823 LDKDecodeError err_var = (*val->contents.err);
1824 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1825 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1826 long err_ref = (long)err_var.inner & ~1;
1829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1830 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
1832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1833 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1);
1834 CHECK(val->result_ok);
1835 LDKInMemoryChannelKeys res_var = (*val->contents.result);
1836 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1837 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1838 long res_ref = (long)res_var.inner & ~1;
1841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1842 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1);
1843 CHECK(!val->result_ok);
1844 LDKDecodeError err_var = (*val->contents.err);
1845 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1846 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1847 long err_ref = (long)err_var.inner & ~1;
1850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1851 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1854 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1855 CHECK(val->result_ok);
1856 long res_ref = ((long)&(*val->contents.result)) | 1;
1857 return (long)res_ref;
1859 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1860 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1861 CHECK(!val->result_ok);
1862 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1865 static jclass LDKAPIError_APIMisuseError_class = NULL;
1866 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1867 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1868 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1869 static jclass LDKAPIError_RouteError_class = NULL;
1870 static jmethodID LDKAPIError_RouteError_meth = NULL;
1871 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1872 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1873 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
1874 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
1875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1876 LDKAPIError_APIMisuseError_class =
1877 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
1878 CHECK(LDKAPIError_APIMisuseError_class != NULL);
1879 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
1880 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1881 LDKAPIError_FeeRateTooHigh_class =
1882 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
1883 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1884 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
1885 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1886 LDKAPIError_RouteError_class =
1887 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
1888 CHECK(LDKAPIError_RouteError_class != NULL);
1889 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
1890 CHECK(LDKAPIError_RouteError_meth != NULL);
1891 LDKAPIError_ChannelUnavailable_class =
1892 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
1893 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1894 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
1895 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1896 LDKAPIError_MonitorUpdateFailed_class =
1897 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
1898 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
1899 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
1900 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
1902 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1903 LDKAPIError *obj = (LDKAPIError*)ptr;
1905 case LDKAPIError_APIMisuseError: {
1906 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
1907 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
1908 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
1909 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
1911 case LDKAPIError_FeeRateTooHigh: {
1912 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
1913 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
1914 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
1915 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
1917 case LDKAPIError_RouteError: {
1918 LDKStr err_str = obj->route_error.err;
1919 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1920 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
1922 case LDKAPIError_ChannelUnavailable: {
1923 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
1924 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
1925 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
1926 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
1928 case LDKAPIError_MonitorUpdateFailed: {
1929 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
1934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1935 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
1937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1938 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
1939 CHECK(val->result_ok);
1940 return *val->contents.result;
1942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1943 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
1944 CHECK(!val->result_ok);
1945 long err_ref = ((long)&(*val->contents.err)) | 1;
1948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1949 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1950 ret->datalen = (*env)->GetArrayLength(env, elems);
1951 if (ret->datalen == 0) {
1954 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1955 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1956 for (size_t i = 0; i < ret->datalen; i++) {
1957 int64_t arr_elem = java_elems[i];
1958 LDKChannelDetails arr_elem_conv;
1959 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1960 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1961 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1962 ret->data[i] = arr_elem_conv;
1964 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1968 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1969 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1970 for (size_t i = 0; i < ret.datalen; i++) {
1971 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1976 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
1978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1979 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
1980 CHECK(val->result_ok);
1981 return *val->contents.result;
1983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1984 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
1985 CHECK(!val->result_ok);
1986 LDKPaymentSendFailure err_var = (*val->contents.err);
1987 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1988 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1989 long err_ref = (long)err_var.inner & ~1;
1992 static jclass LDKNetAddress_IPv4_class = NULL;
1993 static jmethodID LDKNetAddress_IPv4_meth = NULL;
1994 static jclass LDKNetAddress_IPv6_class = NULL;
1995 static jmethodID LDKNetAddress_IPv6_meth = NULL;
1996 static jclass LDKNetAddress_OnionV2_class = NULL;
1997 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
1998 static jclass LDKNetAddress_OnionV3_class = NULL;
1999 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
2001 LDKNetAddress_IPv4_class =
2002 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2003 CHECK(LDKNetAddress_IPv4_class != NULL);
2004 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2005 CHECK(LDKNetAddress_IPv4_meth != NULL);
2006 LDKNetAddress_IPv6_class =
2007 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2008 CHECK(LDKNetAddress_IPv6_class != NULL);
2009 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2010 CHECK(LDKNetAddress_IPv6_meth != NULL);
2011 LDKNetAddress_OnionV2_class =
2012 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2013 CHECK(LDKNetAddress_OnionV2_class != NULL);
2014 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2015 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2016 LDKNetAddress_OnionV3_class =
2017 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2018 CHECK(LDKNetAddress_OnionV3_class != NULL);
2019 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2020 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2022 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2023 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2025 case LDKNetAddress_IPv4: {
2026 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
2027 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2028 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2030 case LDKNetAddress_IPv6: {
2031 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
2032 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2033 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2035 case LDKNetAddress_OnionV2: {
2036 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
2037 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2038 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2040 case LDKNetAddress_OnionV3: {
2041 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2042 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2043 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);
2048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2049 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2050 ret->datalen = (*env)->GetArrayLength(env, elems);
2051 if (ret->datalen == 0) {
2054 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2055 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2056 for (size_t i = 0; i < ret->datalen; i++) {
2057 int64_t arr_elem = java_elems[i];
2058 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2059 FREE((void*)arr_elem);
2060 ret->data[i] = arr_elem_conv;
2062 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2066 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2067 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2068 for (size_t i = 0; i < ret.datalen; i++) {
2069 ret.data[i] = NetAddress_clone(&orig->data[i]);
2073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2074 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2075 ret->datalen = (*env)->GetArrayLength(env, elems);
2076 if (ret->datalen == 0) {
2079 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2080 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2081 for (size_t i = 0; i < ret->datalen; i++) {
2082 int64_t arr_elem = java_elems[i];
2083 LDKChannelMonitor arr_elem_conv;
2084 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2085 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2086 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2087 ret->data[i] = arr_elem_conv;
2089 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2093 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2094 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2095 for (size_t i = 0; i < ret.datalen; i++) {
2096 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2100 typedef struct LDKWatch_JCalls {
2101 atomic_size_t refcnt;
2104 jmethodID watch_channel_meth;
2105 jmethodID update_channel_meth;
2106 jmethodID release_pending_monitor_events_meth;
2108 static void LDKWatch_JCalls_free(void* this_arg) {
2109 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2110 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2112 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2113 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2117 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2118 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2120 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2121 LDKOutPoint funding_txo_var = funding_txo;
2122 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2123 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2124 long funding_txo_ref = (long)funding_txo_var.inner;
2125 if (funding_txo_var.is_owned) {
2126 funding_txo_ref |= 1;
2128 LDKChannelMonitor monitor_var = monitor;
2129 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2130 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2131 long monitor_ref = (long)monitor_var.inner;
2132 if (monitor_var.is_owned) {
2135 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2137 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2138 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2139 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2142 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2143 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2145 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2146 LDKOutPoint funding_txo_var = funding_txo;
2147 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2148 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2149 long funding_txo_ref = (long)funding_txo_var.inner;
2150 if (funding_txo_var.is_owned) {
2151 funding_txo_ref |= 1;
2153 LDKChannelMonitorUpdate update_var = update;
2154 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2155 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2156 long update_ref = (long)update_var.inner;
2157 if (update_var.is_owned) {
2160 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2162 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2163 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2164 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2167 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2168 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2170 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2171 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2173 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2174 LDKCVec_MonitorEventZ arg_constr;
2175 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
2176 if (arg_constr.datalen > 0)
2177 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2179 arg_constr.data = NULL;
2180 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
2181 for (size_t o = 0; o < arg_constr.datalen; o++) {
2182 int64_t arr_conv_14 = arg_vals[o];
2183 LDKMonitorEvent arr_conv_14_conv;
2184 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2185 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2186 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2187 arg_constr.data[o] = arr_conv_14_conv;
2189 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
2192 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2193 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2194 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2195 return (void*) this_arg;
2197 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
2198 jclass c = (*env)->GetObjectClass(env, o);
2200 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2201 atomic_init(&calls->refcnt, 1);
2202 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2203 calls->o = (*env)->NewWeakGlobalRef(env, o);
2204 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2205 CHECK(calls->watch_channel_meth != NULL);
2206 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2207 CHECK(calls->update_channel_meth != NULL);
2208 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2209 CHECK(calls->release_pending_monitor_events_meth != NULL);
2212 .this_arg = (void*) calls,
2213 .watch_channel = watch_channel_jcall,
2214 .update_channel = update_channel_jcall,
2215 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2216 .free = LDKWatch_JCalls_free,
2220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
2221 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2222 *res_ptr = LDKWatch_init(env, clz, o);
2223 return (long)res_ptr;
2225 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) {
2226 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2227 LDKOutPoint funding_txo_conv;
2228 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2229 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2230 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2231 LDKChannelMonitor monitor_conv;
2232 monitor_conv.inner = (void*)(monitor & (~1));
2233 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2234 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2235 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2236 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2237 return (long)ret_conv;
2240 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) {
2241 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2242 LDKOutPoint funding_txo_conv;
2243 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2244 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2245 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2246 LDKChannelMonitorUpdate update_conv;
2247 update_conv.inner = (void*)(update & (~1));
2248 update_conv.is_owned = (update & 1) || (update == 0);
2249 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2250 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2251 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2252 return (long)ret_conv;
2255 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
2256 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2257 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2258 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
2259 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
2260 for (size_t o = 0; o < ret_var.datalen; o++) {
2261 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2262 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2263 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2264 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2265 if (arr_conv_14_var.is_owned) {
2266 arr_conv_14_ref |= 1;
2268 ret_arr_ptr[o] = arr_conv_14_ref;
2270 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
2275 typedef struct LDKBroadcasterInterface_JCalls {
2276 atomic_size_t refcnt;
2279 jmethodID broadcast_transaction_meth;
2280 } LDKBroadcasterInterface_JCalls;
2281 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2282 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2283 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2285 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2286 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2290 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2291 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2293 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2294 LDKTransaction tx_var = tx;
2295 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
2296 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
2297 Transaction_free(tx_var);
2298 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2300 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2302 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2303 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2304 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2305 return (void*) this_arg;
2307 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
2308 jclass c = (*env)->GetObjectClass(env, o);
2310 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2311 atomic_init(&calls->refcnt, 1);
2312 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2313 calls->o = (*env)->NewWeakGlobalRef(env, o);
2314 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2315 CHECK(calls->broadcast_transaction_meth != NULL);
2317 LDKBroadcasterInterface ret = {
2318 .this_arg = (void*) calls,
2319 .broadcast_transaction = broadcast_transaction_jcall,
2320 .free = LDKBroadcasterInterface_JCalls_free,
2324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2325 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2326 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
2327 return (long)res_ptr;
2329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
2330 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2331 LDKTransaction tx_ref;
2332 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
2333 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2334 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
2335 tx_ref.data_is_owned = true;
2336 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2339 typedef struct LDKKeysInterface_JCalls {
2340 atomic_size_t refcnt;
2343 jmethodID get_node_secret_meth;
2344 jmethodID get_destination_script_meth;
2345 jmethodID get_shutdown_pubkey_meth;
2346 jmethodID get_channel_keys_meth;
2347 jmethodID get_secure_random_bytes_meth;
2348 jmethodID read_chan_signer_meth;
2349 } LDKKeysInterface_JCalls;
2350 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2351 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2352 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2354 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2355 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2359 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2360 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2362 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2363 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2365 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
2366 LDKSecretKey arg_ref;
2367 CHECK((*env)->GetArrayLength(env, arg) == 32);
2368 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
2371 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2372 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2374 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2375 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2377 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
2378 LDKCVec_u8Z arg_ref;
2379 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
2380 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2381 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
2384 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2385 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2387 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2390 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2391 LDKPublicKey arg_ref;
2392 CHECK((*env)->GetArrayLength(env, arg) == 33);
2393 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
2396 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2397 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2399 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2400 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2402 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2403 LDKChannelKeys ret_conv = *(LDKChannelKeys*)(((uint64_t)ret) & ~1);
2404 ret_conv = ChannelKeys_clone(ret);
2407 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2408 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2410 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2411 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2413 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2414 LDKThirtyTwoBytes arg_ref;
2415 CHECK((*env)->GetArrayLength(env, arg) == 32);
2416 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
2419 LDKCResult_ChanKeySignerDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
2420 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2422 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2423 LDKu8slice reader_var = reader;
2424 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
2425 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
2426 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2428 LDKCResult_ChanKeySignerDecodeErrorZ* ret = (LDKCResult_ChanKeySignerDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
2429 LDKCResult_ChanKeySignerDecodeErrorZ ret_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)(((uint64_t)ret) & ~1);
2430 ret_conv = CResult_ChanKeySignerDecodeErrorZ_clone((LDKCResult_ChanKeySignerDecodeErrorZ*)ret);
2433 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2434 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2435 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2436 return (void*) this_arg;
2438 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
2439 jclass c = (*env)->GetObjectClass(env, o);
2441 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2442 atomic_init(&calls->refcnt, 1);
2443 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2444 calls->o = (*env)->NewWeakGlobalRef(env, o);
2445 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2446 CHECK(calls->get_node_secret_meth != NULL);
2447 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2448 CHECK(calls->get_destination_script_meth != NULL);
2449 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2450 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2451 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2452 CHECK(calls->get_channel_keys_meth != NULL);
2453 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2454 CHECK(calls->get_secure_random_bytes_meth != NULL);
2455 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
2456 CHECK(calls->read_chan_signer_meth != NULL);
2458 LDKKeysInterface ret = {
2459 .this_arg = (void*) calls,
2460 .get_node_secret = get_node_secret_jcall,
2461 .get_destination_script = get_destination_script_jcall,
2462 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2463 .get_channel_keys = get_channel_keys_jcall,
2464 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2465 .read_chan_signer = read_chan_signer_jcall,
2466 .free = LDKKeysInterface_JCalls_free,
2470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2471 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2472 *res_ptr = LDKKeysInterface_init(env, clz, o);
2473 return (long)res_ptr;
2475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
2476 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2477 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2478 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
2483 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2484 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2485 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
2486 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
2487 CVec_u8Z_free(arg_var);
2491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
2492 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2493 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
2494 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2499 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2500 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2501 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
2506 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2507 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2508 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
2513 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2514 LDKu8slice reader_ref;
2515 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
2516 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
2517 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
2518 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2519 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
2520 return (long)ret_conv;
2523 typedef struct LDKFeeEstimator_JCalls {
2524 atomic_size_t refcnt;
2527 jmethodID get_est_sat_per_1000_weight_meth;
2528 } LDKFeeEstimator_JCalls;
2529 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2530 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2531 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2533 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2534 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2538 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2539 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2541 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2542 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2543 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2545 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2547 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2548 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2549 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2550 return (void*) this_arg;
2552 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
2553 jclass c = (*env)->GetObjectClass(env, o);
2555 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2556 atomic_init(&calls->refcnt, 1);
2557 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2558 calls->o = (*env)->NewWeakGlobalRef(env, o);
2559 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2560 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2562 LDKFeeEstimator ret = {
2563 .this_arg = (void*) calls,
2564 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2565 .free = LDKFeeEstimator_JCalls_free,
2569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
2570 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2571 *res_ptr = LDKFeeEstimator_init(env, clz, o);
2572 return (long)res_ptr;
2574 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) {
2575 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2576 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
2577 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2581 typedef struct LDKLogger_JCalls {
2582 atomic_size_t refcnt;
2587 static void LDKLogger_JCalls_free(void* this_arg) {
2588 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2589 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2591 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2592 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2596 void log_jcall(const void* this_arg, const char* record) {
2597 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2599 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2600 const char* record_str = record;
2601 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
2602 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2604 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
2606 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2607 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2608 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2609 return (void*) this_arg;
2611 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
2612 jclass c = (*env)->GetObjectClass(env, o);
2614 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2615 atomic_init(&calls->refcnt, 1);
2616 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2617 calls->o = (*env)->NewWeakGlobalRef(env, o);
2618 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
2619 CHECK(calls->log_meth != NULL);
2622 .this_arg = (void*) calls,
2624 .free = LDKLogger_JCalls_free,
2628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
2629 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2630 *res_ptr = LDKLogger_init(env, clz, o);
2631 return (long)res_ptr;
2633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2634 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2635 LDKThirtyTwoBytes a_ref;
2636 CHECK((*env)->GetArrayLength(env, a) == 32);
2637 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2639 LDKChannelManager b_conv;
2640 b_conv.inner = (void*)(b & (~1));
2641 b_conv.is_owned = (b & 1) || (b == 0);
2642 // Warning: we need a move here but no clone is available for LDKChannelManager
2646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2647 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2648 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2649 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2653 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2654 LDKChannelManager b_var = tuple->b;
2655 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2656 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2657 long b_ref = (long)b_var.inner & ~1;
2660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2661 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2664 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2665 CHECK(val->result_ok);
2666 long res_ref = (long)(&(*val->contents.result)) | 1;
2669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2670 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2671 CHECK(!val->result_ok);
2672 LDKDecodeError err_var = (*val->contents.err);
2673 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2674 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2675 long err_ref = (long)err_var.inner & ~1;
2678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2679 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2682 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2683 CHECK(val->result_ok);
2684 long res_ref = ((long)&(*val->contents.result)) | 1;
2687 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2688 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2689 CHECK(!val->result_ok);
2690 return *val->contents.err;
2692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2693 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2696 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2697 CHECK(val->result_ok);
2698 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2699 *res_conv = (*val->contents.result);
2700 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2701 return (long)res_conv;
2703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2704 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2705 CHECK(!val->result_ok);
2706 LDKDecodeError err_var = (*val->contents.err);
2707 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2708 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2709 long err_ref = (long)err_var.inner & ~1;
2712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2713 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2714 ret->datalen = (*env)->GetArrayLength(env, elems);
2715 if (ret->datalen == 0) {
2718 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2719 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2720 for (size_t i = 0; i < ret->datalen; i++) {
2721 ret->data[i] = java_elems[i];
2723 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2727 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2728 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2729 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2733 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2734 ret->datalen = (*env)->GetArrayLength(env, elems);
2735 if (ret->datalen == 0) {
2738 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2739 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2740 for (size_t i = 0; i < ret->datalen; i++) {
2741 int64_t arr_elem = java_elems[i];
2742 LDKUpdateAddHTLC arr_elem_conv;
2743 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2744 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2745 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2746 ret->data[i] = arr_elem_conv;
2748 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2752 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2753 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2754 for (size_t i = 0; i < ret.datalen; i++) {
2755 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2760 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2761 ret->datalen = (*env)->GetArrayLength(env, elems);
2762 if (ret->datalen == 0) {
2765 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2766 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2767 for (size_t i = 0; i < ret->datalen; i++) {
2768 int64_t arr_elem = java_elems[i];
2769 LDKUpdateFulfillHTLC arr_elem_conv;
2770 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2771 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2772 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2773 ret->data[i] = arr_elem_conv;
2775 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2779 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2780 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2781 for (size_t i = 0; i < ret.datalen; i++) {
2782 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2787 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
2788 ret->datalen = (*env)->GetArrayLength(env, elems);
2789 if (ret->datalen == 0) {
2792 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
2793 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2794 for (size_t i = 0; i < ret->datalen; i++) {
2795 int64_t arr_elem = java_elems[i];
2796 LDKUpdateFailHTLC arr_elem_conv;
2797 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2798 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2799 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
2800 ret->data[i] = arr_elem_conv;
2802 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2806 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
2807 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
2808 for (size_t i = 0; i < ret.datalen; i++) {
2809 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
2813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2814 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
2815 ret->datalen = (*env)->GetArrayLength(env, elems);
2816 if (ret->datalen == 0) {
2819 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
2820 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2821 for (size_t i = 0; i < ret->datalen; i++) {
2822 int64_t arr_elem = java_elems[i];
2823 LDKUpdateFailMalformedHTLC arr_elem_conv;
2824 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2825 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2826 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
2827 ret->data[i] = arr_elem_conv;
2829 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2833 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
2834 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
2835 for (size_t i = 0; i < ret.datalen; i++) {
2836 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
2840 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2841 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
2843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2844 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
2845 CHECK(val->result_ok);
2846 return *val->contents.result;
2848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2849 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
2850 CHECK(!val->result_ok);
2851 LDKLightningError err_var = (*val->contents.err);
2852 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2853 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2854 long err_ref = (long)err_var.inner & ~1;
2857 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) {
2858 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
2859 LDKChannelAnnouncement a_conv;
2860 a_conv.inner = (void*)(a & (~1));
2861 a_conv.is_owned = (a & 1) || (a == 0);
2862 a_conv = ChannelAnnouncement_clone(&a_conv);
2864 LDKChannelUpdate b_conv;
2865 b_conv.inner = (void*)(b & (~1));
2866 b_conv.is_owned = (b & 1) || (b == 0);
2867 b_conv = ChannelUpdate_clone(&b_conv);
2869 LDKChannelUpdate c_conv;
2870 c_conv.inner = (void*)(c & (~1));
2871 c_conv.is_owned = (c & 1) || (c == 0);
2872 c_conv = ChannelUpdate_clone(&c_conv);
2876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2877 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
2878 LDKChannelAnnouncement a_var = tuple->a;
2879 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2880 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2881 long a_ref = (long)a_var.inner & ~1;
2884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2885 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
2886 LDKChannelUpdate b_var = tuple->b;
2887 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2888 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2889 long b_ref = (long)b_var.inner & ~1;
2892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
2893 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
2894 LDKChannelUpdate c_var = tuple->c;
2895 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2896 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2897 long c_ref = (long)c_var.inner & ~1;
2900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2901 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
2902 ret->datalen = (*env)->GetArrayLength(env, elems);
2903 if (ret->datalen == 0) {
2906 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
2907 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2908 for (size_t i = 0; i < ret->datalen; i++) {
2909 int64_t arr_elem = java_elems[i];
2910 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
2911 FREE((void*)arr_elem);
2912 ret->data[i] = arr_elem_conv;
2914 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2919 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
2920 ret->datalen = (*env)->GetArrayLength(env, elems);
2921 if (ret->datalen == 0) {
2924 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
2925 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2926 for (size_t i = 0; i < ret->datalen; i++) {
2927 int64_t arr_elem = java_elems[i];
2928 LDKNodeAnnouncement arr_elem_conv;
2929 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2930 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2931 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
2932 ret->data[i] = arr_elem_conv;
2934 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2938 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
2939 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
2940 for (size_t i = 0; i < ret.datalen; i++) {
2941 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
2945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2946 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
2948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2949 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
2950 CHECK(val->result_ok);
2951 return *val->contents.result;
2953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2954 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
2955 CHECK(!val->result_ok);
2956 LDKLightningError err_var = (*val->contents.err);
2957 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2958 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2959 long err_ref = (long)err_var.inner & ~1;
2962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2963 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
2965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2966 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
2967 CHECK(val->result_ok);
2968 LDKChannelReestablish res_var = (*val->contents.result);
2969 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2970 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2971 long res_ref = (long)res_var.inner & ~1;
2974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2975 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
2976 CHECK(!val->result_ok);
2977 LDKDecodeError err_var = (*val->contents.err);
2978 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2979 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2980 long err_ref = (long)err_var.inner & ~1;
2983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2984 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
2986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2987 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
2988 CHECK(val->result_ok);
2989 LDKInit res_var = (*val->contents.result);
2990 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2991 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2992 long res_ref = (long)res_var.inner & ~1;
2995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2996 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
2997 CHECK(!val->result_ok);
2998 LDKDecodeError err_var = (*val->contents.err);
2999 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3000 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3001 long err_ref = (long)err_var.inner & ~1;
3004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3005 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3008 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3009 CHECK(val->result_ok);
3010 LDKPing res_var = (*val->contents.result);
3011 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3012 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3013 long res_ref = (long)res_var.inner & ~1;
3016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3017 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3018 CHECK(!val->result_ok);
3019 LDKDecodeError err_var = (*val->contents.err);
3020 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3021 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3022 long err_ref = (long)err_var.inner & ~1;
3025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3026 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3029 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3030 CHECK(val->result_ok);
3031 LDKPong res_var = (*val->contents.result);
3032 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3033 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3034 long res_ref = (long)res_var.inner & ~1;
3037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3038 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3039 CHECK(!val->result_ok);
3040 LDKDecodeError err_var = (*val->contents.err);
3041 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3042 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3043 long err_ref = (long)err_var.inner & ~1;
3046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3047 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3050 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3051 CHECK(val->result_ok);
3052 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3053 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3054 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3055 long res_ref = (long)res_var.inner & ~1;
3058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3059 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3060 CHECK(!val->result_ok);
3061 LDKDecodeError err_var = (*val->contents.err);
3062 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3063 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3064 long err_ref = (long)err_var.inner & ~1;
3067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3068 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3071 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3072 CHECK(val->result_ok);
3073 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3074 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3075 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3076 long res_ref = (long)res_var.inner & ~1;
3079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3080 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3081 CHECK(!val->result_ok);
3082 LDKDecodeError err_var = (*val->contents.err);
3083 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3084 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3085 long err_ref = (long)err_var.inner & ~1;
3088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3089 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3092 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3093 CHECK(val->result_ok);
3094 LDKErrorMessage res_var = (*val->contents.result);
3095 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3096 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3097 long res_ref = (long)res_var.inner & ~1;
3100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3101 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3102 CHECK(!val->result_ok);
3103 LDKDecodeError err_var = (*val->contents.err);
3104 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3105 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3106 long err_ref = (long)err_var.inner & ~1;
3109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3110 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3113 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3114 CHECK(val->result_ok);
3115 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3116 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3117 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3118 long res_ref = (long)res_var.inner & ~1;
3121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3122 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3123 CHECK(!val->result_ok);
3124 LDKDecodeError err_var = (*val->contents.err);
3125 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3126 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3127 long err_ref = (long)err_var.inner & ~1;
3130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3131 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3134 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3135 CHECK(val->result_ok);
3136 LDKQueryShortChannelIds res_var = (*val->contents.result);
3137 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3138 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3139 long res_ref = (long)res_var.inner & ~1;
3142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3143 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3144 CHECK(!val->result_ok);
3145 LDKDecodeError err_var = (*val->contents.err);
3146 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3147 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3148 long err_ref = (long)err_var.inner & ~1;
3151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3152 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3155 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3156 CHECK(val->result_ok);
3157 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3158 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3159 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3160 long res_ref = (long)res_var.inner & ~1;
3163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3164 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3165 CHECK(!val->result_ok);
3166 LDKDecodeError err_var = (*val->contents.err);
3167 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3168 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3169 long err_ref = (long)err_var.inner & ~1;
3172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3173 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3176 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3177 CHECK(val->result_ok);
3178 LDKQueryChannelRange res_var = (*val->contents.result);
3179 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3180 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3181 long res_ref = (long)res_var.inner & ~1;
3184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3185 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3186 CHECK(!val->result_ok);
3187 LDKDecodeError err_var = (*val->contents.err);
3188 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3189 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3190 long err_ref = (long)err_var.inner & ~1;
3193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3194 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3197 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3198 CHECK(val->result_ok);
3199 LDKReplyChannelRange res_var = (*val->contents.result);
3200 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3201 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3202 long res_ref = (long)res_var.inner & ~1;
3205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3206 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3207 CHECK(!val->result_ok);
3208 LDKDecodeError err_var = (*val->contents.err);
3209 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3210 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3211 long err_ref = (long)err_var.inner & ~1;
3214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3215 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3218 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3219 CHECK(val->result_ok);
3220 LDKGossipTimestampFilter res_var = (*val->contents.result);
3221 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3222 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3223 long res_ref = (long)res_var.inner & ~1;
3226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3227 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3228 CHECK(!val->result_ok);
3229 LDKDecodeError err_var = (*val->contents.err);
3230 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3231 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3232 long err_ref = (long)err_var.inner & ~1;
3235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3236 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3239 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3240 CHECK(val->result_ok);
3241 LDKCVec_u8Z res_var = (*val->contents.result);
3242 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3243 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3247 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3248 CHECK(!val->result_ok);
3249 LDKPeerHandleError err_var = (*val->contents.err);
3250 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3251 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3252 long err_ref = (long)err_var.inner & ~1;
3255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3256 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
3258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3259 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3260 CHECK(val->result_ok);
3261 return *val->contents.result;
3263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3264 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3265 CHECK(!val->result_ok);
3266 LDKPeerHandleError err_var = (*val->contents.err);
3267 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3268 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3269 long err_ref = (long)err_var.inner & ~1;
3272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3273 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3276 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3277 CHECK(val->result_ok);
3278 return *val->contents.result;
3280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3281 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3282 CHECK(!val->result_ok);
3283 LDKPeerHandleError err_var = (*val->contents.err);
3284 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3285 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3286 long err_ref = (long)err_var.inner & ~1;
3289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3290 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3293 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)(arg & ~1);
3294 CHECK(val->result_ok);
3295 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3296 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
3299 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3300 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)(arg & ~1);
3301 CHECK(!val->result_ok);
3302 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3306 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3309 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)(arg & ~1);
3310 CHECK(val->result_ok);
3311 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
3312 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
3315 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3316 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)(arg & ~1);
3317 CHECK(!val->result_ok);
3318 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3322 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3325 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)(arg & ~1);
3326 CHECK(val->result_ok);
3327 LDKTxCreationKeys res_var = (*val->contents.result);
3328 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3329 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3330 long res_ref = (long)res_var.inner & ~1;
3333 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3334 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)(arg & ~1);
3335 CHECK(!val->result_ok);
3336 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3340 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
3342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3343 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
3344 CHECK(val->result_ok);
3345 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
3346 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3347 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3348 long res_ref = (long)res_var.inner & ~1;
3351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3352 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
3353 CHECK(!val->result_ok);
3354 return *val->contents.err;
3356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3357 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
3359 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3360 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
3361 CHECK(val->result_ok);
3362 LDKCVec_SignatureZ res_var = (*val->contents.result);
3363 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3365 for (size_t i = 0; i < res_var.datalen; i++) {
3366 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
3367 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
3368 (*env)->SetObjectArrayElement(env, res_arr, i, arr_conv_8_arr);
3372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3373 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
3374 CHECK(!val->result_ok);
3375 return *val->contents.err;
3377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3378 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3379 ret->datalen = (*env)->GetArrayLength(env, elems);
3380 if (ret->datalen == 0) {
3383 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3384 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3385 for (size_t i = 0; i < ret->datalen; i++) {
3386 int64_t arr_elem = java_elems[i];
3387 LDKRouteHop arr_elem_conv;
3388 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3389 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3390 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3391 ret->data[i] = arr_elem_conv;
3393 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3397 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3398 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3399 for (size_t i = 0; i < ret.datalen; i++) {
3400 ret.data[i] = RouteHop_clone(&orig->data[i]);
3404 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3405 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3406 for (size_t i = 0; i < ret.datalen; i++) {
3407 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3412 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3415 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3416 CHECK(val->result_ok);
3417 LDKRoute res_var = (*val->contents.result);
3418 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3419 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3420 long res_ref = (long)res_var.inner & ~1;
3423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3424 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3425 CHECK(!val->result_ok);
3426 LDKDecodeError err_var = (*val->contents.err);
3427 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3428 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3429 long err_ref = (long)err_var.inner & ~1;
3432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3433 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3434 ret->datalen = (*env)->GetArrayLength(env, elems);
3435 if (ret->datalen == 0) {
3438 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3439 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3440 for (size_t i = 0; i < ret->datalen; i++) {
3441 int64_t arr_elem = java_elems[i];
3442 LDKRouteHint arr_elem_conv;
3443 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3444 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3445 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3446 ret->data[i] = arr_elem_conv;
3448 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3452 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3453 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3454 for (size_t i = 0; i < ret.datalen; i++) {
3455 ret.data[i] = RouteHint_clone(&orig->data[i]);
3459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3460 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3463 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3464 CHECK(val->result_ok);
3465 LDKRoute res_var = (*val->contents.result);
3466 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3467 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3468 long res_ref = (long)res_var.inner & ~1;
3471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3472 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3473 CHECK(!val->result_ok);
3474 LDKLightningError err_var = (*val->contents.err);
3475 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3476 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3477 long err_ref = (long)err_var.inner & ~1;
3480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3481 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
3483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3484 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3485 CHECK(val->result_ok);
3486 LDKRoutingFees res_var = (*val->contents.result);
3487 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3488 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3489 long res_ref = (long)res_var.inner & ~1;
3492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3493 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3494 CHECK(!val->result_ok);
3495 LDKDecodeError err_var = (*val->contents.err);
3496 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3497 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3498 long err_ref = (long)err_var.inner & ~1;
3501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3502 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
3504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3505 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3506 CHECK(val->result_ok);
3507 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
3508 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3509 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3510 long res_ref = (long)res_var.inner & ~1;
3513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3514 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3515 CHECK(!val->result_ok);
3516 LDKDecodeError err_var = (*val->contents.err);
3517 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3518 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3519 long err_ref = (long)err_var.inner & ~1;
3522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3523 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
3525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3526 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3527 CHECK(val->result_ok);
3528 LDKNodeInfo res_var = (*val->contents.result);
3529 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3530 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3531 long res_ref = (long)res_var.inner & ~1;
3534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3535 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3536 CHECK(!val->result_ok);
3537 LDKDecodeError err_var = (*val->contents.err);
3538 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3539 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3540 long err_ref = (long)err_var.inner & ~1;
3543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3544 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3547 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3548 CHECK(val->result_ok);
3549 LDKNetworkGraph res_var = (*val->contents.result);
3550 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3551 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3552 long res_ref = (long)res_var.inner & ~1;
3555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3556 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3557 CHECK(!val->result_ok);
3558 LDKDecodeError err_var = (*val->contents.err);
3559 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3560 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3561 long err_ref = (long)err_var.inner & ~1;
3564 typedef struct LDKMessageSendEventsProvider_JCalls {
3565 atomic_size_t refcnt;
3568 jmethodID get_and_clear_pending_msg_events_meth;
3569 } LDKMessageSendEventsProvider_JCalls;
3570 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3571 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3572 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3574 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3575 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3579 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3580 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3582 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3583 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3585 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
3586 LDKCVec_MessageSendEventZ arg_constr;
3587 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
3588 if (arg_constr.datalen > 0)
3589 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3591 arg_constr.data = NULL;
3592 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
3593 for (size_t s = 0; s < arg_constr.datalen; s++) {
3594 int64_t arr_conv_18 = arg_vals[s];
3595 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1);
3596 FREE((void*)arr_conv_18);
3597 arg_constr.data[s] = arr_conv_18_conv;
3599 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
3602 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3603 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3604 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3605 return (void*) this_arg;
3607 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
3608 jclass c = (*env)->GetObjectClass(env, o);
3610 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3611 atomic_init(&calls->refcnt, 1);
3612 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3613 calls->o = (*env)->NewWeakGlobalRef(env, o);
3614 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
3615 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
3617 LDKMessageSendEventsProvider ret = {
3618 .this_arg = (void*) calls,
3619 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3620 .free = LDKMessageSendEventsProvider_JCalls_free,
3624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
3625 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3626 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
3627 return (long)res_ptr;
3629 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3630 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3631 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3632 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3633 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3634 for (size_t s = 0; s < ret_var.datalen; s++) {
3635 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3636 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3637 long arr_conv_18_ref = (long)arr_conv_18_copy;
3638 ret_arr_ptr[s] = arr_conv_18_ref;
3640 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3645 typedef struct LDKEventsProvider_JCalls {
3646 atomic_size_t refcnt;
3649 jmethodID get_and_clear_pending_events_meth;
3650 } LDKEventsProvider_JCalls;
3651 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3652 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3653 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3655 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3656 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3660 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3661 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3663 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3664 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3666 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
3667 LDKCVec_EventZ arg_constr;
3668 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
3669 if (arg_constr.datalen > 0)
3670 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3672 arg_constr.data = NULL;
3673 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
3674 for (size_t h = 0; h < arg_constr.datalen; h++) {
3675 int64_t arr_conv_7 = arg_vals[h];
3676 LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1);
3677 FREE((void*)arr_conv_7);
3678 arg_constr.data[h] = arr_conv_7_conv;
3680 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
3683 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3684 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3685 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3686 return (void*) this_arg;
3688 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
3689 jclass c = (*env)->GetObjectClass(env, o);
3691 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3692 atomic_init(&calls->refcnt, 1);
3693 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3694 calls->o = (*env)->NewWeakGlobalRef(env, o);
3695 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
3696 CHECK(calls->get_and_clear_pending_events_meth != NULL);
3698 LDKEventsProvider ret = {
3699 .this_arg = (void*) calls,
3700 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3701 .free = LDKEventsProvider_JCalls_free,
3705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
3706 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3707 *res_ptr = LDKEventsProvider_init(env, clz, o);
3708 return (long)res_ptr;
3710 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3711 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3712 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3713 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3714 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3715 for (size_t h = 0; h < ret_var.datalen; h++) {
3716 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3717 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
3718 long arr_conv_7_ref = (long)arr_conv_7_copy;
3719 ret_arr_ptr[h] = arr_conv_7_ref;
3721 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3726 typedef struct LDKAccess_JCalls {
3727 atomic_size_t refcnt;
3730 jmethodID get_utxo_meth;
3732 static void LDKAccess_JCalls_free(void* this_arg) {
3733 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3734 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3736 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3737 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3741 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3742 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3744 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3745 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3746 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3747 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3749 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
3750 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
3751 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
3754 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3755 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3756 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3757 return (void*) this_arg;
3759 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3760 jclass c = (*env)->GetObjectClass(env, o);
3762 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3763 atomic_init(&calls->refcnt, 1);
3764 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3765 calls->o = (*env)->NewWeakGlobalRef(env, o);
3766 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3767 CHECK(calls->get_utxo_meth != NULL);
3770 .this_arg = (void*) calls,
3771 .get_utxo = get_utxo_jcall,
3772 .free = LDKAccess_JCalls_free,
3776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3777 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3778 *res_ptr = LDKAccess_init(env, clz, o);
3779 return (long)res_ptr;
3781 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) {
3782 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
3783 unsigned char genesis_hash_arr[32];
3784 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3785 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3786 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3787 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3788 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3789 return (long)ret_conv;
3792 typedef struct LDKFilter_JCalls {
3793 atomic_size_t refcnt;
3796 jmethodID register_tx_meth;
3797 jmethodID register_output_meth;
3799 static void LDKFilter_JCalls_free(void* this_arg) {
3800 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3801 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3803 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3804 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3808 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
3809 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3811 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3812 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
3813 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
3814 LDKu8slice script_pubkey_var = script_pubkey;
3815 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
3816 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
3817 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3819 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
3821 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
3822 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3824 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3825 LDKOutPoint outpoint_var = *outpoint;
3826 outpoint_var = OutPoint_clone(outpoint);
3827 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3828 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3829 long outpoint_ref = (long)outpoint_var.inner;
3830 if (outpoint_var.is_owned) {
3833 LDKu8slice script_pubkey_var = script_pubkey;
3834 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
3835 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
3836 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3838 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
3840 static void* LDKFilter_JCalls_clone(const void* this_arg) {
3841 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3842 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3843 return (void*) this_arg;
3845 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
3846 jclass c = (*env)->GetObjectClass(env, o);
3848 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
3849 atomic_init(&calls->refcnt, 1);
3850 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3851 calls->o = (*env)->NewWeakGlobalRef(env, o);
3852 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
3853 CHECK(calls->register_tx_meth != NULL);
3854 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
3855 CHECK(calls->register_output_meth != NULL);
3858 .this_arg = (void*) calls,
3859 .register_tx = register_tx_jcall,
3860 .register_output = register_output_jcall,
3861 .free = LDKFilter_JCalls_free,
3865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
3866 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
3867 *res_ptr = LDKFilter_init(env, clz, o);
3868 return (long)res_ptr;
3870 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) {
3871 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3872 unsigned char txid_arr[32];
3873 CHECK((*env)->GetArrayLength(env, txid) == 32);
3874 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
3875 unsigned char (*txid_ref)[32] = &txid_arr;
3876 LDKu8slice script_pubkey_ref;
3877 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
3878 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
3879 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
3880 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
3883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t outpoint, int8_tArray script_pubkey) {
3884 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3885 LDKOutPoint outpoint_conv;
3886 outpoint_conv.inner = (void*)(outpoint & (~1));
3887 outpoint_conv.is_owned = false;
3888 LDKu8slice script_pubkey_ref;
3889 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
3890 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
3891 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
3892 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
3895 typedef struct LDKPersist_JCalls {
3896 atomic_size_t refcnt;
3899 jmethodID persist_new_channel_meth;
3900 jmethodID update_persisted_channel_meth;
3901 } LDKPersist_JCalls;
3902 static void LDKPersist_JCalls_free(void* this_arg) {
3903 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3904 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3906 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3907 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3911 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
3912 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3914 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3915 LDKOutPoint id_var = id;
3916 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3917 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3918 long id_ref = (long)id_var.inner;
3919 if (id_var.is_owned) {
3922 LDKChannelMonitor data_var = *data;
3923 data_var = ChannelMonitor_clone(data);
3924 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3925 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3926 long data_ref = (long)data_var.inner;
3927 if (data_var.is_owned) {
3930 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3932 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
3933 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3934 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3937 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
3938 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3940 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3941 LDKOutPoint id_var = id;
3942 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3943 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3944 long id_ref = (long)id_var.inner;
3945 if (id_var.is_owned) {
3948 LDKChannelMonitorUpdate update_var = *update;
3949 update_var = ChannelMonitorUpdate_clone(update);
3950 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3951 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3952 long update_ref = (long)update_var.inner;
3953 if (update_var.is_owned) {
3956 LDKChannelMonitor data_var = *data;
3957 data_var = ChannelMonitor_clone(data);
3958 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3959 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3960 long data_ref = (long)data_var.inner;
3961 if (data_var.is_owned) {
3964 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3966 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
3967 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3968 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
3971 static void* LDKPersist_JCalls_clone(const void* this_arg) {
3972 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3973 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3974 return (void*) this_arg;
3976 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
3977 jclass c = (*env)->GetObjectClass(env, o);
3979 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
3980 atomic_init(&calls->refcnt, 1);
3981 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3982 calls->o = (*env)->NewWeakGlobalRef(env, o);
3983 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
3984 CHECK(calls->persist_new_channel_meth != NULL);
3985 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
3986 CHECK(calls->update_persisted_channel_meth != NULL);
3989 .this_arg = (void*) calls,
3990 .persist_new_channel = persist_new_channel_jcall,
3991 .update_persisted_channel = update_persisted_channel_jcall,
3992 .free = LDKPersist_JCalls_free,
3996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
3997 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
3998 *res_ptr = LDKPersist_init(env, clz, o);
3999 return (long)res_ptr;
4001 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) {
4002 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4003 LDKOutPoint id_conv;
4004 id_conv.inner = (void*)(id & (~1));
4005 id_conv.is_owned = (id & 1) || (id == 0);
4006 id_conv = OutPoint_clone(&id_conv);
4007 LDKChannelMonitor data_conv;
4008 data_conv.inner = (void*)(data & (~1));
4009 data_conv.is_owned = false;
4010 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4011 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4012 return (long)ret_conv;
4015 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) {
4016 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4017 LDKOutPoint id_conv;
4018 id_conv.inner = (void*)(id & (~1));
4019 id_conv.is_owned = (id & 1) || (id == 0);
4020 id_conv = OutPoint_clone(&id_conv);
4021 LDKChannelMonitorUpdate update_conv;
4022 update_conv.inner = (void*)(update & (~1));
4023 update_conv.is_owned = false;
4024 LDKChannelMonitor data_conv;
4025 data_conv.inner = (void*)(data & (~1));
4026 data_conv.is_owned = false;
4027 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4028 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4029 return (long)ret_conv;
4032 typedef struct LDKChannelMessageHandler_JCalls {
4033 atomic_size_t refcnt;
4036 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4037 jmethodID handle_open_channel_meth;
4038 jmethodID handle_accept_channel_meth;
4039 jmethodID handle_funding_created_meth;
4040 jmethodID handle_funding_signed_meth;
4041 jmethodID handle_funding_locked_meth;
4042 jmethodID handle_shutdown_meth;
4043 jmethodID handle_closing_signed_meth;
4044 jmethodID handle_update_add_htlc_meth;
4045 jmethodID handle_update_fulfill_htlc_meth;
4046 jmethodID handle_update_fail_htlc_meth;
4047 jmethodID handle_update_fail_malformed_htlc_meth;
4048 jmethodID handle_commitment_signed_meth;
4049 jmethodID handle_revoke_and_ack_meth;
4050 jmethodID handle_update_fee_meth;
4051 jmethodID handle_announcement_signatures_meth;
4052 jmethodID peer_disconnected_meth;
4053 jmethodID peer_connected_meth;
4054 jmethodID handle_channel_reestablish_meth;
4055 jmethodID handle_error_meth;
4056 } LDKChannelMessageHandler_JCalls;
4057 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4058 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4059 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4061 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4062 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4066 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4067 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4069 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4070 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4071 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4072 LDKInitFeatures their_features_var = their_features;
4073 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4074 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4075 long their_features_ref = (long)their_features_var.inner;
4076 if (their_features_var.is_owned) {
4077 their_features_ref |= 1;
4079 LDKOpenChannel msg_var = *msg;
4080 msg_var = OpenChannel_clone(msg);
4081 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4082 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4083 long msg_ref = (long)msg_var.inner;
4084 if (msg_var.is_owned) {
4087 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4089 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4091 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4092 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4094 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4095 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4096 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4097 LDKInitFeatures their_features_var = their_features;
4098 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4099 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4100 long their_features_ref = (long)their_features_var.inner;
4101 if (their_features_var.is_owned) {
4102 their_features_ref |= 1;
4104 LDKAcceptChannel msg_var = *msg;
4105 msg_var = AcceptChannel_clone(msg);
4106 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4107 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4108 long msg_ref = (long)msg_var.inner;
4109 if (msg_var.is_owned) {
4112 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4114 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4116 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4117 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4119 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4120 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4121 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4122 LDKFundingCreated msg_var = *msg;
4123 msg_var = FundingCreated_clone(msg);
4124 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4125 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4126 long msg_ref = (long)msg_var.inner;
4127 if (msg_var.is_owned) {
4130 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4132 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4134 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4135 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4137 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4138 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4139 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4140 LDKFundingSigned msg_var = *msg;
4141 msg_var = FundingSigned_clone(msg);
4142 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4143 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4144 long msg_ref = (long)msg_var.inner;
4145 if (msg_var.is_owned) {
4148 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4150 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4152 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4153 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4155 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4156 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4157 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4158 LDKFundingLocked msg_var = *msg;
4159 msg_var = FundingLocked_clone(msg);
4160 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4161 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4162 long msg_ref = (long)msg_var.inner;
4163 if (msg_var.is_owned) {
4166 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4168 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4170 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
4171 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4173 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4174 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4175 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4176 LDKShutdown msg_var = *msg;
4177 msg_var = Shutdown_clone(msg);
4178 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4179 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4180 long msg_ref = (long)msg_var.inner;
4181 if (msg_var.is_owned) {
4184 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4186 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
4188 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4189 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4191 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4192 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4193 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4194 LDKClosingSigned msg_var = *msg;
4195 msg_var = ClosingSigned_clone(msg);
4196 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4197 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4198 long msg_ref = (long)msg_var.inner;
4199 if (msg_var.is_owned) {
4202 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4204 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4206 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4207 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4209 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4210 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4211 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4212 LDKUpdateAddHTLC msg_var = *msg;
4213 msg_var = UpdateAddHTLC_clone(msg);
4214 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4215 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4216 long msg_ref = (long)msg_var.inner;
4217 if (msg_var.is_owned) {
4220 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4222 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4224 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4225 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4227 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4228 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4229 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4230 LDKUpdateFulfillHTLC msg_var = *msg;
4231 msg_var = UpdateFulfillHTLC_clone(msg);
4232 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4233 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4234 long msg_ref = (long)msg_var.inner;
4235 if (msg_var.is_owned) {
4238 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4240 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4242 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4243 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4245 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4246 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4247 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4248 LDKUpdateFailHTLC msg_var = *msg;
4249 msg_var = UpdateFailHTLC_clone(msg);
4250 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4251 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4252 long msg_ref = (long)msg_var.inner;
4253 if (msg_var.is_owned) {
4256 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4258 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4260 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4261 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4263 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4264 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4265 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4266 LDKUpdateFailMalformedHTLC msg_var = *msg;
4267 msg_var = UpdateFailMalformedHTLC_clone(msg);
4268 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4269 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4270 long msg_ref = (long)msg_var.inner;
4271 if (msg_var.is_owned) {
4274 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4276 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4278 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4279 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4281 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4282 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4283 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4284 LDKCommitmentSigned msg_var = *msg;
4285 msg_var = CommitmentSigned_clone(msg);
4286 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4287 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4288 long msg_ref = (long)msg_var.inner;
4289 if (msg_var.is_owned) {
4292 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4294 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4296 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4297 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4299 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4300 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4301 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4302 LDKRevokeAndACK msg_var = *msg;
4303 msg_var = RevokeAndACK_clone(msg);
4304 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4305 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4306 long msg_ref = (long)msg_var.inner;
4307 if (msg_var.is_owned) {
4310 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4312 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4314 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4315 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4317 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4318 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4319 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4320 LDKUpdateFee msg_var = *msg;
4321 msg_var = UpdateFee_clone(msg);
4322 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4323 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4324 long msg_ref = (long)msg_var.inner;
4325 if (msg_var.is_owned) {
4328 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4330 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4332 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4333 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4335 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4336 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4337 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4338 LDKAnnouncementSignatures msg_var = *msg;
4339 msg_var = AnnouncementSignatures_clone(msg);
4340 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4341 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4342 long msg_ref = (long)msg_var.inner;
4343 if (msg_var.is_owned) {
4346 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4348 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4350 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4351 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4353 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4354 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4355 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4356 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4358 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4360 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4361 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4363 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4364 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4365 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4366 LDKInit msg_var = *msg;
4367 msg_var = Init_clone(msg);
4368 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4369 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4370 long msg_ref = (long)msg_var.inner;
4371 if (msg_var.is_owned) {
4374 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4376 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4378 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4379 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4381 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4382 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4383 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4384 LDKChannelReestablish msg_var = *msg;
4385 msg_var = ChannelReestablish_clone(msg);
4386 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4387 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4388 long msg_ref = (long)msg_var.inner;
4389 if (msg_var.is_owned) {
4392 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4394 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4396 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4397 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4399 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4400 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4401 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4402 LDKErrorMessage msg_var = *msg;
4403 msg_var = ErrorMessage_clone(msg);
4404 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4405 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4406 long msg_ref = (long)msg_var.inner;
4407 if (msg_var.is_owned) {
4410 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4412 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4414 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4415 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4416 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4417 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4418 return (void*) this_arg;
4420 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4421 jclass c = (*env)->GetObjectClass(env, o);
4423 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4424 atomic_init(&calls->refcnt, 1);
4425 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4426 calls->o = (*env)->NewWeakGlobalRef(env, o);
4427 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
4428 CHECK(calls->handle_open_channel_meth != NULL);
4429 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
4430 CHECK(calls->handle_accept_channel_meth != NULL);
4431 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
4432 CHECK(calls->handle_funding_created_meth != NULL);
4433 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
4434 CHECK(calls->handle_funding_signed_meth != NULL);
4435 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
4436 CHECK(calls->handle_funding_locked_meth != NULL);
4437 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
4438 CHECK(calls->handle_shutdown_meth != NULL);
4439 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
4440 CHECK(calls->handle_closing_signed_meth != NULL);
4441 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
4442 CHECK(calls->handle_update_add_htlc_meth != NULL);
4443 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
4444 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
4445 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
4446 CHECK(calls->handle_update_fail_htlc_meth != NULL);
4447 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
4448 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
4449 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
4450 CHECK(calls->handle_commitment_signed_meth != NULL);
4451 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
4452 CHECK(calls->handle_revoke_and_ack_meth != NULL);
4453 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
4454 CHECK(calls->handle_update_fee_meth != NULL);
4455 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
4456 CHECK(calls->handle_announcement_signatures_meth != NULL);
4457 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
4458 CHECK(calls->peer_disconnected_meth != NULL);
4459 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
4460 CHECK(calls->peer_connected_meth != NULL);
4461 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
4462 CHECK(calls->handle_channel_reestablish_meth != NULL);
4463 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
4464 CHECK(calls->handle_error_meth != NULL);
4466 LDKChannelMessageHandler ret = {
4467 .this_arg = (void*) calls,
4468 .handle_open_channel = handle_open_channel_jcall,
4469 .handle_accept_channel = handle_accept_channel_jcall,
4470 .handle_funding_created = handle_funding_created_jcall,
4471 .handle_funding_signed = handle_funding_signed_jcall,
4472 .handle_funding_locked = handle_funding_locked_jcall,
4473 .handle_shutdown = handle_shutdown_jcall,
4474 .handle_closing_signed = handle_closing_signed_jcall,
4475 .handle_update_add_htlc = handle_update_add_htlc_jcall,
4476 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
4477 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
4478 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
4479 .handle_commitment_signed = handle_commitment_signed_jcall,
4480 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
4481 .handle_update_fee = handle_update_fee_jcall,
4482 .handle_announcement_signatures = handle_announcement_signatures_jcall,
4483 .peer_disconnected = peer_disconnected_jcall,
4484 .peer_connected = peer_connected_jcall,
4485 .handle_channel_reestablish = handle_channel_reestablish_jcall,
4486 .handle_error = handle_error_jcall,
4487 .free = LDKChannelMessageHandler_JCalls_free,
4488 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
4490 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4494 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4495 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
4496 return (long)res_ptr;
4498 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) {
4499 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4500 LDKPublicKey their_node_id_ref;
4501 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4502 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4503 LDKInitFeatures their_features_conv;
4504 their_features_conv.inner = (void*)(their_features & (~1));
4505 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4506 // Warning: we need a move here but no clone is available for LDKInitFeatures
4507 LDKOpenChannel msg_conv;
4508 msg_conv.inner = (void*)(msg & (~1));
4509 msg_conv.is_owned = false;
4510 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4513 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) {
4514 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4515 LDKPublicKey their_node_id_ref;
4516 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4517 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4518 LDKInitFeatures their_features_conv;
4519 their_features_conv.inner = (void*)(their_features & (~1));
4520 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4521 // Warning: we need a move here but no clone is available for LDKInitFeatures
4522 LDKAcceptChannel msg_conv;
4523 msg_conv.inner = (void*)(msg & (~1));
4524 msg_conv.is_owned = false;
4525 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4528 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) {
4529 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4530 LDKPublicKey their_node_id_ref;
4531 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4532 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4533 LDKFundingCreated msg_conv;
4534 msg_conv.inner = (void*)(msg & (~1));
4535 msg_conv.is_owned = false;
4536 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4539 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) {
4540 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4541 LDKPublicKey their_node_id_ref;
4542 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4543 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4544 LDKFundingSigned msg_conv;
4545 msg_conv.inner = (void*)(msg & (~1));
4546 msg_conv.is_owned = false;
4547 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4550 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) {
4551 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4552 LDKPublicKey their_node_id_ref;
4553 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4554 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4555 LDKFundingLocked msg_conv;
4556 msg_conv.inner = (void*)(msg & (~1));
4557 msg_conv.is_owned = false;
4558 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4561 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 msg) {
4562 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4563 LDKPublicKey their_node_id_ref;
4564 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4565 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4566 LDKShutdown msg_conv;
4567 msg_conv.inner = (void*)(msg & (~1));
4568 msg_conv.is_owned = false;
4569 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4572 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) {
4573 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4574 LDKPublicKey their_node_id_ref;
4575 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4576 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4577 LDKClosingSigned msg_conv;
4578 msg_conv.inner = (void*)(msg & (~1));
4579 msg_conv.is_owned = false;
4580 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4583 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) {
4584 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4585 LDKPublicKey their_node_id_ref;
4586 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4587 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4588 LDKUpdateAddHTLC msg_conv;
4589 msg_conv.inner = (void*)(msg & (~1));
4590 msg_conv.is_owned = false;
4591 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4594 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) {
4595 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4596 LDKPublicKey their_node_id_ref;
4597 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4598 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4599 LDKUpdateFulfillHTLC msg_conv;
4600 msg_conv.inner = (void*)(msg & (~1));
4601 msg_conv.is_owned = false;
4602 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4605 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) {
4606 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4607 LDKPublicKey their_node_id_ref;
4608 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4609 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4610 LDKUpdateFailHTLC msg_conv;
4611 msg_conv.inner = (void*)(msg & (~1));
4612 msg_conv.is_owned = false;
4613 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4616 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) {
4617 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4618 LDKPublicKey their_node_id_ref;
4619 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4620 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4621 LDKUpdateFailMalformedHTLC msg_conv;
4622 msg_conv.inner = (void*)(msg & (~1));
4623 msg_conv.is_owned = false;
4624 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4627 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) {
4628 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4629 LDKPublicKey their_node_id_ref;
4630 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4631 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4632 LDKCommitmentSigned msg_conv;
4633 msg_conv.inner = (void*)(msg & (~1));
4634 msg_conv.is_owned = false;
4635 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4638 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) {
4639 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4640 LDKPublicKey their_node_id_ref;
4641 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4642 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4643 LDKRevokeAndACK msg_conv;
4644 msg_conv.inner = (void*)(msg & (~1));
4645 msg_conv.is_owned = false;
4646 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4649 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) {
4650 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4651 LDKPublicKey their_node_id_ref;
4652 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4653 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4654 LDKUpdateFee msg_conv;
4655 msg_conv.inner = (void*)(msg & (~1));
4656 msg_conv.is_owned = false;
4657 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4660 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) {
4661 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4662 LDKPublicKey their_node_id_ref;
4663 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4664 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4665 LDKAnnouncementSignatures msg_conv;
4666 msg_conv.inner = (void*)(msg & (~1));
4667 msg_conv.is_owned = false;
4668 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4671 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) {
4672 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4673 LDKPublicKey their_node_id_ref;
4674 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4675 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4676 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4679 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) {
4680 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4681 LDKPublicKey their_node_id_ref;
4682 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4683 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4685 msg_conv.inner = (void*)(msg & (~1));
4686 msg_conv.is_owned = false;
4687 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4690 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) {
4691 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4692 LDKPublicKey their_node_id_ref;
4693 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4694 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4695 LDKChannelReestablish msg_conv;
4696 msg_conv.inner = (void*)(msg & (~1));
4697 msg_conv.is_owned = false;
4698 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4701 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) {
4702 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4703 LDKPublicKey their_node_id_ref;
4704 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4705 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4706 LDKErrorMessage msg_conv;
4707 msg_conv.inner = (void*)(msg & (~1));
4708 msg_conv.is_owned = false;
4709 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4712 typedef struct LDKRoutingMessageHandler_JCalls {
4713 atomic_size_t refcnt;
4716 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4717 jmethodID handle_node_announcement_meth;
4718 jmethodID handle_channel_announcement_meth;
4719 jmethodID handle_channel_update_meth;
4720 jmethodID handle_htlc_fail_channel_update_meth;
4721 jmethodID get_next_channel_announcements_meth;
4722 jmethodID get_next_node_announcements_meth;
4723 jmethodID sync_routing_table_meth;
4724 jmethodID handle_reply_channel_range_meth;
4725 jmethodID handle_reply_short_channel_ids_end_meth;
4726 jmethodID handle_query_channel_range_meth;
4727 jmethodID handle_query_short_channel_ids_meth;
4728 } LDKRoutingMessageHandler_JCalls;
4729 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4730 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4731 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4733 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4734 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4738 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4739 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4741 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4742 LDKNodeAnnouncement msg_var = *msg;
4743 msg_var = NodeAnnouncement_clone(msg);
4744 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4745 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4746 long msg_ref = (long)msg_var.inner;
4747 if (msg_var.is_owned) {
4750 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4752 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
4753 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4754 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4757 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4758 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4760 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4761 LDKChannelAnnouncement msg_var = *msg;
4762 msg_var = ChannelAnnouncement_clone(msg);
4763 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4764 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4765 long msg_ref = (long)msg_var.inner;
4766 if (msg_var.is_owned) {
4769 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4771 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
4772 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4773 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4776 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
4777 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4779 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4780 LDKChannelUpdate msg_var = *msg;
4781 msg_var = ChannelUpdate_clone(msg);
4782 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4783 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4784 long msg_ref = (long)msg_var.inner;
4785 if (msg_var.is_owned) {
4788 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4790 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
4791 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4792 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4795 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
4796 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4798 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4799 long ret_update = (long)update;
4800 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4802 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4804 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4805 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4807 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4808 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4810 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4811 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4812 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
4813 if (arg_constr.datalen > 0)
4814 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4816 arg_constr.data = NULL;
4817 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
4818 for (size_t l = 0; l < arg_constr.datalen; l++) {
4819 int64_t arr_conv_63 = arg_vals[l];
4820 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1);
4821 FREE((void*)arr_conv_63);
4822 arg_constr.data[l] = arr_conv_63_conv;
4824 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
4827 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4828 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4830 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4831 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
4832 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
4833 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4835 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4836 LDKCVec_NodeAnnouncementZ arg_constr;
4837 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
4838 if (arg_constr.datalen > 0)
4839 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4841 arg_constr.data = NULL;
4842 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
4843 for (size_t s = 0; s < arg_constr.datalen; s++) {
4844 int64_t arr_conv_18 = arg_vals[s];
4845 LDKNodeAnnouncement arr_conv_18_conv;
4846 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4847 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4848 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4849 arg_constr.data[s] = arr_conv_18_conv;
4851 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
4854 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
4855 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4857 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4858 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4859 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4860 LDKInit init_var = *init;
4861 init_var = Init_clone(init);
4862 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4863 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4864 long init_ref = (long)init_var.inner;
4865 if (init_var.is_owned) {
4868 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4870 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
4872 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
4873 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4875 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4876 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4877 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4878 LDKReplyChannelRange msg_var = msg;
4879 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4880 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4881 long msg_ref = (long)msg_var.inner;
4882 if (msg_var.is_owned) {
4885 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4887 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
4888 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4889 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4892 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
4893 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4895 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4896 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4897 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4898 LDKReplyShortChannelIdsEnd msg_var = msg;
4899 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4900 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4901 long msg_ref = (long)msg_var.inner;
4902 if (msg_var.is_owned) {
4905 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4907 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
4908 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4909 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4912 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
4913 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4915 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4916 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4917 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4918 LDKQueryChannelRange msg_var = msg;
4919 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4920 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4921 long msg_ref = (long)msg_var.inner;
4922 if (msg_var.is_owned) {
4925 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4927 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
4928 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4929 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4932 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
4933 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4935 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4936 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4937 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4938 LDKQueryShortChannelIds msg_var = msg;
4939 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4940 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4941 long msg_ref = (long)msg_var.inner;
4942 if (msg_var.is_owned) {
4945 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4947 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
4948 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4949 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4952 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4953 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4954 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4955 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4956 return (void*) this_arg;
4958 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4959 jclass c = (*env)->GetObjectClass(env, o);
4961 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4962 atomic_init(&calls->refcnt, 1);
4963 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4964 calls->o = (*env)->NewWeakGlobalRef(env, o);
4965 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
4966 CHECK(calls->handle_node_announcement_meth != NULL);
4967 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
4968 CHECK(calls->handle_channel_announcement_meth != NULL);
4969 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
4970 CHECK(calls->handle_channel_update_meth != NULL);
4971 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
4972 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
4973 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
4974 CHECK(calls->get_next_channel_announcements_meth != NULL);
4975 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
4976 CHECK(calls->get_next_node_announcements_meth != NULL);
4977 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
4978 CHECK(calls->sync_routing_table_meth != NULL);
4979 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
4980 CHECK(calls->handle_reply_channel_range_meth != NULL);
4981 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
4982 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
4983 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
4984 CHECK(calls->handle_query_channel_range_meth != NULL);
4985 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
4986 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
4988 LDKRoutingMessageHandler ret = {
4989 .this_arg = (void*) calls,
4990 .handle_node_announcement = handle_node_announcement_jcall,
4991 .handle_channel_announcement = handle_channel_announcement_jcall,
4992 .handle_channel_update = handle_channel_update_jcall,
4993 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4994 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4995 .get_next_node_announcements = get_next_node_announcements_jcall,
4996 .sync_routing_table = sync_routing_table_jcall,
4997 .handle_reply_channel_range = handle_reply_channel_range_jcall,
4998 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
4999 .handle_query_channel_range = handle_query_channel_range_jcall,
5000 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
5001 .free = LDKRoutingMessageHandler_JCalls_free,
5002 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5004 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5008 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5009 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5010 return (long)res_ptr;
5012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5013 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5014 LDKNodeAnnouncement msg_conv;
5015 msg_conv.inner = (void*)(msg & (~1));
5016 msg_conv.is_owned = false;
5017 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5018 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5019 return (long)ret_conv;
5022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5023 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5024 LDKChannelAnnouncement msg_conv;
5025 msg_conv.inner = (void*)(msg & (~1));
5026 msg_conv.is_owned = false;
5027 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5028 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5029 return (long)ret_conv;
5032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5033 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5034 LDKChannelUpdate msg_conv;
5035 msg_conv.inner = (void*)(msg & (~1));
5036 msg_conv.is_owned = false;
5037 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5038 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5039 return (long)ret_conv;
5042 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) {
5043 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5044 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5045 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5048 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) {
5049 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5050 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5051 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5052 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5053 for (size_t l = 0; l < ret_var.datalen; l++) {
5054 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5055 *arr_conv_63_ref = ret_var.data[l];
5056 ret_arr_ptr[l] = (long)arr_conv_63_ref;
5058 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5063 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) {
5064 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5065 LDKPublicKey starting_point_ref;
5066 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
5067 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
5068 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5069 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5070 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5071 for (size_t s = 0; s < ret_var.datalen; s++) {
5072 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
5073 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5074 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5075 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
5076 if (arr_conv_18_var.is_owned) {
5077 arr_conv_18_ref |= 1;
5079 ret_arr_ptr[s] = arr_conv_18_ref;
5081 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5086 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) {
5087 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5088 LDKPublicKey their_node_id_ref;
5089 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5090 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5092 init_conv.inner = (void*)(init & (~1));
5093 init_conv.is_owned = false;
5094 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5097 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) {
5098 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5099 LDKPublicKey their_node_id_ref;
5100 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5101 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5102 LDKReplyChannelRange msg_conv;
5103 msg_conv.inner = (void*)(msg & (~1));
5104 msg_conv.is_owned = (msg & 1) || (msg == 0);
5105 msg_conv = ReplyChannelRange_clone(&msg_conv);
5106 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5107 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5108 return (long)ret_conv;
5111 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) {
5112 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5113 LDKPublicKey their_node_id_ref;
5114 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5115 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5116 LDKReplyShortChannelIdsEnd msg_conv;
5117 msg_conv.inner = (void*)(msg & (~1));
5118 msg_conv.is_owned = (msg & 1) || (msg == 0);
5119 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5120 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5121 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5122 return (long)ret_conv;
5125 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) {
5126 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5127 LDKPublicKey their_node_id_ref;
5128 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5129 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5130 LDKQueryChannelRange msg_conv;
5131 msg_conv.inner = (void*)(msg & (~1));
5132 msg_conv.is_owned = (msg & 1) || (msg == 0);
5133 msg_conv = QueryChannelRange_clone(&msg_conv);
5134 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5135 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5136 return (long)ret_conv;
5139 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) {
5140 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5141 LDKPublicKey their_node_id_ref;
5142 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5143 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5144 LDKQueryShortChannelIds msg_conv;
5145 msg_conv.inner = (void*)(msg & (~1));
5146 msg_conv.is_owned = (msg & 1) || (msg == 0);
5147 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5148 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5149 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5150 return (long)ret_conv;
5153 typedef struct LDKSocketDescriptor_JCalls {
5154 atomic_size_t refcnt;
5157 jmethodID send_data_meth;
5158 jmethodID disconnect_socket_meth;
5160 jmethodID hash_meth;
5161 } LDKSocketDescriptor_JCalls;
5162 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5163 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5164 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5166 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5167 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5171 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5172 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5174 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5175 LDKu8slice data_var = data;
5176 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
5177 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
5178 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5180 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
5182 void disconnect_socket_jcall(void* this_arg) {
5183 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5185 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5186 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5188 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
5190 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5191 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5193 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5194 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5195 *other_arg_clone = SocketDescriptor_clone(other_arg);
5196 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5198 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
5200 uint64_t hash_jcall(const void* this_arg) {
5201 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5203 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5204 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5206 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
5208 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5209 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5210 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5211 return (void*) this_arg;
5213 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
5214 jclass c = (*env)->GetObjectClass(env, o);
5216 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5217 atomic_init(&calls->refcnt, 1);
5218 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5219 calls->o = (*env)->NewWeakGlobalRef(env, o);
5220 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
5221 CHECK(calls->send_data_meth != NULL);
5222 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
5223 CHECK(calls->disconnect_socket_meth != NULL);
5224 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
5225 CHECK(calls->eq_meth != NULL);
5226 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
5227 CHECK(calls->hash_meth != NULL);
5229 LDKSocketDescriptor ret = {
5230 .this_arg = (void*) calls,
5231 .send_data = send_data_jcall,
5232 .disconnect_socket = disconnect_socket_jcall,
5235 .clone = LDKSocketDescriptor_JCalls_clone,
5236 .free = LDKSocketDescriptor_JCalls_free,
5240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
5241 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5242 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
5243 return (long)res_ptr;
5245 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) {
5246 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5247 LDKu8slice data_ref;
5248 data_ref.datalen = (*env)->GetArrayLength(env, data);
5249 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
5250 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5251 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
5255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
5256 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5257 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
5261 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5262 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
5267 LDKTransaction _res_ref;
5268 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
5269 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5270 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
5271 _res_ref.data_is_owned = true;
5272 Transaction_free(_res_ref);
5275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
5276 if ((_res & 1) != 0) return;
5277 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5279 TxOut_free(_res_conv);
5282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5283 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5284 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5285 *ret_ref = TxOut_clone(orig_conv);
5286 return (long)ret_ref;
5289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5290 LDKCVec_SpendableOutputDescriptorZ _res_constr;
5291 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5292 if (_res_constr.datalen > 0)
5293 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5295 _res_constr.data = NULL;
5296 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5297 for (size_t b = 0; b < _res_constr.datalen; b++) {
5298 int64_t arr_conv_27 = _res_vals[b];
5299 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_conv_27) & ~1);
5300 FREE((void*)arr_conv_27);
5301 _res_constr.data[b] = arr_conv_27_conv;
5303 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5304 CVec_SpendableOutputDescriptorZ_free(_res_constr);
5307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5308 LDKCVec_MessageSendEventZ _res_constr;
5309 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5310 if (_res_constr.datalen > 0)
5311 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5313 _res_constr.data = NULL;
5314 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5315 for (size_t s = 0; s < _res_constr.datalen; s++) {
5316 int64_t arr_conv_18 = _res_vals[s];
5317 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1);
5318 FREE((void*)arr_conv_18);
5319 _res_constr.data[s] = arr_conv_18_conv;
5321 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5322 CVec_MessageSendEventZ_free(_res_constr);
5325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5326 LDKCVec_EventZ _res_constr;
5327 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5328 if (_res_constr.datalen > 0)
5329 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5331 _res_constr.data = NULL;
5332 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5333 for (size_t h = 0; h < _res_constr.datalen; h++) {
5334 int64_t arr_conv_7 = _res_vals[h];
5335 LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1);
5336 FREE((void*)arr_conv_7);
5337 _res_constr.data[h] = arr_conv_7_conv;
5339 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5340 CVec_EventZ_free(_res_constr);
5343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5344 if ((_res & 1) != 0) return;
5345 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
5347 C2Tuple_usizeTransactionZ_free(_res_conv);
5350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
5351 LDKTransaction b_ref;
5352 b_ref.datalen = (*env)->GetArrayLength(env, b);
5353 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5354 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5355 b_ref.data_is_owned = true;
5356 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5357 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5358 return (long)ret_ref;
5361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5362 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
5363 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5364 if (_res_constr.datalen > 0)
5365 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5367 _res_constr.data = NULL;
5368 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5369 for (size_t y = 0; y < _res_constr.datalen; y++) {
5370 int64_t arr_conv_24 = _res_vals[y];
5371 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
5372 FREE((void*)arr_conv_24);
5373 _res_constr.data[y] = arr_conv_24_conv;
5375 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5376 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
5379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
5380 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5381 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5382 return (long)ret_conv;
5385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
5386 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
5387 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5388 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
5389 return (long)ret_conv;
5392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5393 if ((_res & 1) != 0) return;
5394 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
5396 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
5399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5400 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
5401 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5402 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
5403 return (long)ret_conv;
5406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5407 LDKCVec_MonitorEventZ _res_constr;
5408 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5409 if (_res_constr.datalen > 0)
5410 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5412 _res_constr.data = NULL;
5413 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5414 for (size_t o = 0; o < _res_constr.datalen; o++) {
5415 int64_t arr_conv_14 = _res_vals[o];
5416 LDKMonitorEvent arr_conv_14_conv;
5417 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5418 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5419 _res_constr.data[o] = arr_conv_14_conv;
5421 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5422 CVec_MonitorEventZ_free(_res_constr);
5425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5426 LDKChannelMonitorUpdate o_conv;
5427 o_conv.inner = (void*)(o & (~1));
5428 o_conv.is_owned = (o & 1) || (o == 0);
5429 o_conv = ChannelMonitorUpdate_clone(&o_conv);
5430 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5431 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
5432 return (long)ret_conv;
5435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5436 LDKDecodeError e_conv;
5437 e_conv.inner = (void*)(e & (~1));
5438 e_conv.is_owned = (e & 1) || (e == 0);
5439 e_conv = DecodeError_clone(&e_conv);
5440 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5441 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
5442 return (long)ret_conv;
5445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5446 if ((_res & 1) != 0) return;
5447 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
5449 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
5452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
5453 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5454 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5455 return (long)ret_conv;
5458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5459 LDKMonitorUpdateError e_conv;
5460 e_conv.inner = (void*)(e & (~1));
5461 e_conv.is_owned = (e & 1) || (e == 0);
5462 e_conv = MonitorUpdateError_clone(&e_conv);
5463 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5464 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
5465 return (long)ret_conv;
5468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5469 if ((_res & 1) != 0) return;
5470 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
5472 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
5475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5476 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
5477 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5478 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
5479 return (long)ret_conv;
5482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5483 if ((_res & 1) != 0) return;
5484 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
5486 C2Tuple_OutPointScriptZ_free(_res_conv);
5489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
5491 a_conv.inner = (void*)(a & (~1));
5492 a_conv.is_owned = (a & 1) || (a == 0);
5493 a_conv = OutPoint_clone(&a_conv);
5495 b_ref.datalen = (*env)->GetArrayLength(env, b);
5496 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5497 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5498 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5499 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5500 return (long)ret_ref;
5503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
5504 LDKCVec_TransactionZ _res_constr;
5505 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5506 if (_res_constr.datalen > 0)
5507 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5509 _res_constr.data = NULL;
5510 for (size_t i = 0; i < _res_constr.datalen; i++) {
5511 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
5512 LDKTransaction arr_conv_8_ref;
5513 arr_conv_8_ref.datalen = (*env)->GetArrayLength(env, arr_conv_8);
5514 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5515 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5516 arr_conv_8_ref.data_is_owned = true;
5517 _res_constr.data[i] = arr_conv_8_ref;
5519 CVec_TransactionZ_free(_res_constr);
5522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5523 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
5524 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5525 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
5526 return (long)ret_ref;
5529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5530 if ((_res & 1) != 0) return;
5531 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
5533 C2Tuple_u32TxOutZ_free(_res_conv);
5536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
5537 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
5539 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5540 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
5541 return (long)ret_ref;
5544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5545 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
5546 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5547 if (_res_constr.datalen > 0)
5548 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5550 _res_constr.data = NULL;
5551 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5552 for (size_t a = 0; a < _res_constr.datalen; a++) {
5553 int64_t arr_conv_26 = _res_vals[a];
5554 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
5555 FREE((void*)arr_conv_26);
5556 _res_constr.data[a] = arr_conv_26_conv;
5558 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5559 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
5562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5563 if ((_res & 1) != 0) return;
5564 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
5566 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
5569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5570 LDKThirtyTwoBytes a_ref;
5571 CHECK((*env)->GetArrayLength(env, a) == 32);
5572 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5573 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5574 b_constr.datalen = (*env)->GetArrayLength(env, b);
5575 if (b_constr.datalen > 0)
5576 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5578 b_constr.data = NULL;
5579 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5580 for (size_t a = 0; a < b_constr.datalen; a++) {
5581 int64_t arr_conv_26 = b_vals[a];
5582 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
5583 FREE((void*)arr_conv_26);
5584 b_constr.data[a] = arr_conv_26_conv;
5586 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5587 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5588 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
5589 return (long)ret_ref;
5592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5593 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
5594 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5595 if (_res_constr.datalen > 0)
5596 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
5598 _res_constr.data = NULL;
5599 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5600 for (size_t u = 0; u < _res_constr.datalen; u++) {
5601 int64_t arr_conv_46 = _res_vals[u];
5602 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_conv_46) & ~1);
5603 FREE((void*)arr_conv_46);
5604 _res_constr.data[u] = arr_conv_46_conv;
5606 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5607 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
5610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5611 if ((_res & 1) != 0) return;
5612 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
5614 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
5617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
5618 LDKThirtyTwoBytes a_ref;
5619 CHECK((*env)->GetArrayLength(env, a) == 32);
5620 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5621 LDKChannelMonitor b_conv;
5622 b_conv.inner = (void*)(b & (~1));
5623 b_conv.is_owned = (b & 1) || (b == 0);
5624 b_conv = ChannelMonitor_clone(&b_conv);
5625 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5626 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
5627 return (long)ret_ref;
5630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5631 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
5633 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5634 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
5635 return (long)ret_conv;
5638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5639 LDKDecodeError e_conv;
5640 e_conv.inner = (void*)(e & (~1));
5641 e_conv.is_owned = (e & 1) || (e == 0);
5642 e_conv = DecodeError_clone(&e_conv);
5643 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5644 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
5645 return (long)ret_conv;
5648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5649 if ((_res & 1) != 0) return;
5650 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
5652 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
5655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5656 LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1);
5657 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5658 *ret_ref = C2Tuple_u64u64Z_clone(orig_conv);
5659 return (long)ret_ref;
5662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
5663 if ((_res & 1) != 0) return;
5664 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)_res) & ~1);
5666 C2Tuple_u64u64Z_free(_res_conv);
5669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
5670 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5671 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5672 return (long)ret_ref;
5675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5676 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
5678 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5679 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
5680 return (long)ret_conv;
5683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5684 LDKDecodeError e_conv;
5685 e_conv.inner = (void*)(e & (~1));
5686 e_conv.is_owned = (e & 1) || (e == 0);
5687 e_conv = DecodeError_clone(&e_conv);
5688 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5689 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
5690 return (long)ret_conv;
5693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5694 if ((_res & 1) != 0) return;
5695 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
5697 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
5700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5701 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
5702 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5703 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
5704 return (long)ret_conv;
5707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
5708 LDKCVec_SignatureZ _res_constr;
5709 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5710 if (_res_constr.datalen > 0)
5711 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5713 _res_constr.data = NULL;
5714 for (size_t i = 0; i < _res_constr.datalen; i++) {
5715 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
5716 LDKSignature arr_conv_8_ref;
5717 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
5718 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5719 _res_constr.data[i] = arr_conv_8_ref;
5721 CVec_SignatureZ_free(_res_constr);
5724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5725 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
5726 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5727 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
5728 return (long)ret_ref;
5731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5732 if ((_res & 1) != 0) return;
5733 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
5735 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
5738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
5740 CHECK((*env)->GetArrayLength(env, a) == 64);
5741 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
5742 LDKCVec_SignatureZ b_constr;
5743 b_constr.datalen = (*env)->GetArrayLength(env, b);
5744 if (b_constr.datalen > 0)
5745 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5747 b_constr.data = NULL;
5748 for (size_t i = 0; i < b_constr.datalen; i++) {
5749 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
5750 LDKSignature arr_conv_8_ref;
5751 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
5752 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5753 b_constr.data[i] = arr_conv_8_ref;
5755 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5756 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5757 return (long)ret_ref;
5760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5761 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
5763 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5764 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
5765 return (long)ret_conv;
5768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
5769 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5770 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5771 return (long)ret_conv;
5774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5775 if ((_res & 1) != 0) return;
5776 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
5778 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
5781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5782 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
5783 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5784 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
5785 return (long)ret_conv;
5788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
5790 CHECK((*env)->GetArrayLength(env, o) == 64);
5791 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
5792 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5793 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
5794 return (long)ret_conv;
5797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
5798 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5799 *ret_conv = CResult_SignatureNoneZ_err();
5800 return (long)ret_conv;
5803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5804 if ((_res & 1) != 0) return;
5805 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
5807 CResult_SignatureNoneZ_free(_res_conv);
5810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5811 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
5812 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5813 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
5814 return (long)ret_conv;
5817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5818 LDKChannelKeys o_conv = *(LDKChannelKeys*)(((uint64_t)o) & ~1);
5819 if (o_conv.free == LDKChannelKeys_JCalls_free) {
5820 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5821 LDKChannelKeys_JCalls_clone(o_conv.this_arg);
5823 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5824 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_ok(o_conv);
5825 return (long)ret_conv;
5828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5829 LDKDecodeError e_conv;
5830 e_conv.inner = (void*)(e & (~1));
5831 e_conv.is_owned = (e & 1) || (e == 0);
5832 e_conv = DecodeError_clone(&e_conv);
5833 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5834 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_err(e_conv);
5835 return (long)ret_conv;
5838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5839 if ((_res & 1) != 0) return;
5840 LDKCResult_ChanKeySignerDecodeErrorZ _res_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
5842 CResult_ChanKeySignerDecodeErrorZ_free(_res_conv);
5845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5846 LDKCResult_ChanKeySignerDecodeErrorZ* orig_conv = (LDKCResult_ChanKeySignerDecodeErrorZ*)(orig & ~1);
5847 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5848 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_clone(orig_conv);
5849 return (long)ret_conv;
5852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5853 LDKInMemoryChannelKeys o_conv;
5854 o_conv.inner = (void*)(o & (~1));
5855 o_conv.is_owned = (o & 1) || (o == 0);
5856 o_conv = InMemoryChannelKeys_clone(&o_conv);
5857 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
5858 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
5859 return (long)ret_conv;
5862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5863 LDKDecodeError e_conv;
5864 e_conv.inner = (void*)(e & (~1));
5865 e_conv.is_owned = (e & 1) || (e == 0);
5866 e_conv = DecodeError_clone(&e_conv);
5867 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
5868 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
5869 return (long)ret_conv;
5872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5873 if ((_res & 1) != 0) return;
5874 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5876 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
5879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5880 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
5882 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5883 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
5884 return (long)ret_conv;
5887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
5888 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
5889 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5890 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
5891 return (long)ret_conv;
5894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5895 if ((_res & 1) != 0) return;
5896 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
5898 CResult_TxOutAccessErrorZ_free(_res_conv);
5901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5902 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
5903 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5904 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
5905 return (long)ret_conv;
5908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
5909 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5910 *ret_conv = CResult_NoneAPIErrorZ_ok();
5911 return (long)ret_conv;
5914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5915 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
5917 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5918 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
5919 return (long)ret_conv;
5922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5923 if ((_res & 1) != 0) return;
5924 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
5926 CResult_NoneAPIErrorZ_free(_res_conv);
5929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5930 LDKCVec_ChannelDetailsZ _res_constr;
5931 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5932 if (_res_constr.datalen > 0)
5933 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
5935 _res_constr.data = NULL;
5936 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5937 for (size_t q = 0; q < _res_constr.datalen; q++) {
5938 int64_t arr_conv_16 = _res_vals[q];
5939 LDKChannelDetails arr_conv_16_conv;
5940 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5941 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5942 _res_constr.data[q] = arr_conv_16_conv;
5944 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5945 CVec_ChannelDetailsZ_free(_res_constr);
5948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
5949 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5950 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5951 return (long)ret_conv;
5954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5955 LDKPaymentSendFailure e_conv;
5956 e_conv.inner = (void*)(e & (~1));
5957 e_conv.is_owned = (e & 1) || (e == 0);
5958 e_conv = PaymentSendFailure_clone(&e_conv);
5959 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5960 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
5961 return (long)ret_conv;
5964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5965 if ((_res & 1) != 0) return;
5966 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
5968 CResult_NonePaymentSendFailureZ_free(_res_conv);
5971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5972 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
5973 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5974 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
5975 return (long)ret_conv;
5978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5979 LDKCVec_NetAddressZ _res_constr;
5980 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5981 if (_res_constr.datalen > 0)
5982 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5984 _res_constr.data = NULL;
5985 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5986 for (size_t m = 0; m < _res_constr.datalen; m++) {
5987 int64_t arr_conv_12 = _res_vals[m];
5988 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
5989 FREE((void*)arr_conv_12);
5990 _res_constr.data[m] = arr_conv_12_conv;
5992 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5993 CVec_NetAddressZ_free(_res_constr);
5996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5997 LDKCVec_ChannelMonitorZ _res_constr;
5998 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5999 if (_res_constr.datalen > 0)
6000 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6002 _res_constr.data = NULL;
6003 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6004 for (size_t q = 0; q < _res_constr.datalen; q++) {
6005 int64_t arr_conv_16 = _res_vals[q];
6006 LDKChannelMonitor arr_conv_16_conv;
6007 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6008 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6009 _res_constr.data[q] = arr_conv_16_conv;
6011 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6012 CVec_ChannelMonitorZ_free(_res_constr);
6015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6016 if ((_res & 1) != 0) return;
6017 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
6019 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
6022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
6023 LDKThirtyTwoBytes a_ref;
6024 CHECK((*env)->GetArrayLength(env, a) == 32);
6025 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
6026 LDKChannelManager b_conv;
6027 b_conv.inner = (void*)(b & (~1));
6028 b_conv.is_owned = (b & 1) || (b == 0);
6029 // Warning: we need a move here but no clone is available for LDKChannelManager
6030 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
6031 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
6032 return (long)ret_ref;
6035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6036 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
6038 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6039 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
6040 return (long)ret_conv;
6043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6044 LDKDecodeError e_conv;
6045 e_conv.inner = (void*)(e & (~1));
6046 e_conv.is_owned = (e & 1) || (e == 0);
6047 e_conv = DecodeError_clone(&e_conv);
6048 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6049 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
6050 return (long)ret_conv;
6053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6054 if ((_res & 1) != 0) return;
6055 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6057 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
6060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
6061 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
6063 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6064 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
6065 return (long)ret_conv;
6068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
6069 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6070 *ret_conv = CResult_NetAddressu8Z_err(e);
6071 return (long)ret_conv;
6074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
6075 if ((_res & 1) != 0) return;
6076 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
6078 CResult_NetAddressu8Z_free(_res_conv);
6081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6082 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
6083 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6084 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
6085 return (long)ret_conv;
6088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6089 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
6091 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6092 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
6093 return (long)ret_conv;
6096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6097 LDKDecodeError e_conv;
6098 e_conv.inner = (void*)(e & (~1));
6099 e_conv.is_owned = (e & 1) || (e == 0);
6100 e_conv = DecodeError_clone(&e_conv);
6101 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6102 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
6103 return (long)ret_conv;
6106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6107 if ((_res & 1) != 0) return;
6108 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6110 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
6113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6114 LDKCVec_u64Z _res_constr;
6115 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6116 if (_res_constr.datalen > 0)
6117 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6119 _res_constr.data = NULL;
6120 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6121 for (size_t g = 0; g < _res_constr.datalen; g++) {
6122 int64_t arr_conv_6 = _res_vals[g];
6123 _res_constr.data[g] = arr_conv_6;
6125 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6126 CVec_u64Z_free(_res_constr);
6129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6130 LDKCVec_UpdateAddHTLCZ _res_constr;
6131 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6132 if (_res_constr.datalen > 0)
6133 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
6135 _res_constr.data = NULL;
6136 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6137 for (size_t p = 0; p < _res_constr.datalen; p++) {
6138 int64_t arr_conv_15 = _res_vals[p];
6139 LDKUpdateAddHTLC arr_conv_15_conv;
6140 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
6141 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
6142 _res_constr.data[p] = arr_conv_15_conv;
6144 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6145 CVec_UpdateAddHTLCZ_free(_res_constr);
6148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6149 LDKCVec_UpdateFulfillHTLCZ _res_constr;
6150 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6151 if (_res_constr.datalen > 0)
6152 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
6154 _res_constr.data = NULL;
6155 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6156 for (size_t t = 0; t < _res_constr.datalen; t++) {
6157 int64_t arr_conv_19 = _res_vals[t];
6158 LDKUpdateFulfillHTLC arr_conv_19_conv;
6159 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
6160 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
6161 _res_constr.data[t] = arr_conv_19_conv;
6163 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6164 CVec_UpdateFulfillHTLCZ_free(_res_constr);
6167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6168 LDKCVec_UpdateFailHTLCZ _res_constr;
6169 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6170 if (_res_constr.datalen > 0)
6171 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
6173 _res_constr.data = NULL;
6174 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6175 for (size_t q = 0; q < _res_constr.datalen; q++) {
6176 int64_t arr_conv_16 = _res_vals[q];
6177 LDKUpdateFailHTLC arr_conv_16_conv;
6178 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6179 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6180 _res_constr.data[q] = arr_conv_16_conv;
6182 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6183 CVec_UpdateFailHTLCZ_free(_res_constr);
6186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6187 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
6188 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6189 if (_res_constr.datalen > 0)
6190 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
6192 _res_constr.data = NULL;
6193 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6194 for (size_t z = 0; z < _res_constr.datalen; z++) {
6195 int64_t arr_conv_25 = _res_vals[z];
6196 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
6197 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
6198 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
6199 _res_constr.data[z] = arr_conv_25_conv;
6201 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6202 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
6205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6206 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6207 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6208 return (long)ret_conv;
6211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6212 LDKLightningError e_conv;
6213 e_conv.inner = (void*)(e & (~1));
6214 e_conv.is_owned = (e & 1) || (e == 0);
6215 e_conv = LightningError_clone(&e_conv);
6216 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6217 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6218 return (long)ret_conv;
6221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6222 if ((_res & 1) != 0) return;
6223 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
6225 CResult_boolLightningErrorZ_free(_res_conv);
6228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6229 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
6230 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6231 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
6232 return (long)ret_conv;
6235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6236 if ((_res & 1) != 0) return;
6237 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6239 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6242 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) {
6243 LDKChannelAnnouncement a_conv;
6244 a_conv.inner = (void*)(a & (~1));
6245 a_conv.is_owned = (a & 1) || (a == 0);
6246 a_conv = ChannelAnnouncement_clone(&a_conv);
6247 LDKChannelUpdate b_conv;
6248 b_conv.inner = (void*)(b & (~1));
6249 b_conv.is_owned = (b & 1) || (b == 0);
6250 b_conv = ChannelUpdate_clone(&b_conv);
6251 LDKChannelUpdate c_conv;
6252 c_conv.inner = (void*)(c & (~1));
6253 c_conv.is_owned = (c & 1) || (c == 0);
6254 c_conv = ChannelUpdate_clone(&c_conv);
6255 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6256 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6257 return (long)ret_ref;
6260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6261 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6262 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6263 if (_res_constr.datalen > 0)
6264 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6266 _res_constr.data = NULL;
6267 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6268 for (size_t l = 0; l < _res_constr.datalen; l++) {
6269 int64_t arr_conv_63 = _res_vals[l];
6270 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1);
6271 FREE((void*)arr_conv_63);
6272 _res_constr.data[l] = arr_conv_63_conv;
6274 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6275 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6279 LDKCVec_NodeAnnouncementZ _res_constr;
6280 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6281 if (_res_constr.datalen > 0)
6282 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6284 _res_constr.data = NULL;
6285 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6286 for (size_t s = 0; s < _res_constr.datalen; s++) {
6287 int64_t arr_conv_18 = _res_vals[s];
6288 LDKNodeAnnouncement arr_conv_18_conv;
6289 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
6290 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
6291 _res_constr.data[s] = arr_conv_18_conv;
6293 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6294 CVec_NodeAnnouncementZ_free(_res_constr);
6297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
6298 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6299 *ret_conv = CResult_NoneLightningErrorZ_ok();
6300 return (long)ret_conv;
6303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6304 LDKLightningError e_conv;
6305 e_conv.inner = (void*)(e & (~1));
6306 e_conv.is_owned = (e & 1) || (e == 0);
6307 e_conv = LightningError_clone(&e_conv);
6308 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6309 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6310 return (long)ret_conv;
6313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6314 if ((_res & 1) != 0) return;
6315 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6317 CResult_NoneLightningErrorZ_free(_res_conv);
6320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6321 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6322 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6323 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6324 return (long)ret_conv;
6327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6328 LDKChannelReestablish o_conv;
6329 o_conv.inner = (void*)(o & (~1));
6330 o_conv.is_owned = (o & 1) || (o == 0);
6331 o_conv = ChannelReestablish_clone(&o_conv);
6332 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6333 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
6334 return (long)ret_conv;
6337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6338 LDKDecodeError e_conv;
6339 e_conv.inner = (void*)(e & (~1));
6340 e_conv.is_owned = (e & 1) || (e == 0);
6341 e_conv = DecodeError_clone(&e_conv);
6342 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6343 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
6344 return (long)ret_conv;
6347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6348 if ((_res & 1) != 0) return;
6349 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
6351 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
6354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6356 o_conv.inner = (void*)(o & (~1));
6357 o_conv.is_owned = (o & 1) || (o == 0);
6358 o_conv = Init_clone(&o_conv);
6359 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6360 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
6361 return (long)ret_conv;
6364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6365 LDKDecodeError e_conv;
6366 e_conv.inner = (void*)(e & (~1));
6367 e_conv.is_owned = (e & 1) || (e == 0);
6368 e_conv = DecodeError_clone(&e_conv);
6369 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6370 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
6371 return (long)ret_conv;
6374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6375 if ((_res & 1) != 0) return;
6376 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
6378 CResult_InitDecodeErrorZ_free(_res_conv);
6381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6383 o_conv.inner = (void*)(o & (~1));
6384 o_conv.is_owned = (o & 1) || (o == 0);
6385 o_conv = Ping_clone(&o_conv);
6386 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6387 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
6388 return (long)ret_conv;
6391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6392 LDKDecodeError e_conv;
6393 e_conv.inner = (void*)(e & (~1));
6394 e_conv.is_owned = (e & 1) || (e == 0);
6395 e_conv = DecodeError_clone(&e_conv);
6396 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6397 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
6398 return (long)ret_conv;
6401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6402 if ((_res & 1) != 0) return;
6403 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
6405 CResult_PingDecodeErrorZ_free(_res_conv);
6408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6410 o_conv.inner = (void*)(o & (~1));
6411 o_conv.is_owned = (o & 1) || (o == 0);
6412 o_conv = Pong_clone(&o_conv);
6413 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6414 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
6415 return (long)ret_conv;
6418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6419 LDKDecodeError e_conv;
6420 e_conv.inner = (void*)(e & (~1));
6421 e_conv.is_owned = (e & 1) || (e == 0);
6422 e_conv = DecodeError_clone(&e_conv);
6423 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6424 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
6425 return (long)ret_conv;
6428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6429 if ((_res & 1) != 0) return;
6430 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
6432 CResult_PongDecodeErrorZ_free(_res_conv);
6435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6436 LDKUnsignedChannelAnnouncement o_conv;
6437 o_conv.inner = (void*)(o & (~1));
6438 o_conv.is_owned = (o & 1) || (o == 0);
6439 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
6440 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6441 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
6442 return (long)ret_conv;
6445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6446 LDKDecodeError e_conv;
6447 e_conv.inner = (void*)(e & (~1));
6448 e_conv.is_owned = (e & 1) || (e == 0);
6449 e_conv = DecodeError_clone(&e_conv);
6450 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6451 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
6452 return (long)ret_conv;
6455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6456 if ((_res & 1) != 0) return;
6457 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
6459 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
6462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6463 LDKUnsignedChannelUpdate o_conv;
6464 o_conv.inner = (void*)(o & (~1));
6465 o_conv.is_owned = (o & 1) || (o == 0);
6466 o_conv = UnsignedChannelUpdate_clone(&o_conv);
6467 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6468 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
6469 return (long)ret_conv;
6472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6473 LDKDecodeError e_conv;
6474 e_conv.inner = (void*)(e & (~1));
6475 e_conv.is_owned = (e & 1) || (e == 0);
6476 e_conv = DecodeError_clone(&e_conv);
6477 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6478 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
6479 return (long)ret_conv;
6482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6483 if ((_res & 1) != 0) return;
6484 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6486 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
6489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6490 LDKErrorMessage o_conv;
6491 o_conv.inner = (void*)(o & (~1));
6492 o_conv.is_owned = (o & 1) || (o == 0);
6493 o_conv = ErrorMessage_clone(&o_conv);
6494 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6495 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
6496 return (long)ret_conv;
6499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6500 LDKDecodeError e_conv;
6501 e_conv.inner = (void*)(e & (~1));
6502 e_conv.is_owned = (e & 1) || (e == 0);
6503 e_conv = DecodeError_clone(&e_conv);
6504 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6505 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
6506 return (long)ret_conv;
6509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6510 if ((_res & 1) != 0) return;
6511 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
6513 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
6516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6517 LDKUnsignedNodeAnnouncement o_conv;
6518 o_conv.inner = (void*)(o & (~1));
6519 o_conv.is_owned = (o & 1) || (o == 0);
6520 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
6521 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6522 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
6523 return (long)ret_conv;
6526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6527 LDKDecodeError e_conv;
6528 e_conv.inner = (void*)(e & (~1));
6529 e_conv.is_owned = (e & 1) || (e == 0);
6530 e_conv = DecodeError_clone(&e_conv);
6531 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6532 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
6533 return (long)ret_conv;
6536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6537 if ((_res & 1) != 0) return;
6538 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
6540 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
6543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6544 LDKQueryShortChannelIds o_conv;
6545 o_conv.inner = (void*)(o & (~1));
6546 o_conv.is_owned = (o & 1) || (o == 0);
6547 o_conv = QueryShortChannelIds_clone(&o_conv);
6548 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6549 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
6550 return (long)ret_conv;
6553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6554 LDKDecodeError e_conv;
6555 e_conv.inner = (void*)(e & (~1));
6556 e_conv.is_owned = (e & 1) || (e == 0);
6557 e_conv = DecodeError_clone(&e_conv);
6558 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6559 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
6560 return (long)ret_conv;
6563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6564 if ((_res & 1) != 0) return;
6565 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
6567 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
6570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6571 LDKReplyShortChannelIdsEnd o_conv;
6572 o_conv.inner = (void*)(o & (~1));
6573 o_conv.is_owned = (o & 1) || (o == 0);
6574 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
6575 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6576 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
6577 return (long)ret_conv;
6580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6581 LDKDecodeError e_conv;
6582 e_conv.inner = (void*)(e & (~1));
6583 e_conv.is_owned = (e & 1) || (e == 0);
6584 e_conv = DecodeError_clone(&e_conv);
6585 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6586 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
6587 return (long)ret_conv;
6590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6591 if ((_res & 1) != 0) return;
6592 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
6594 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
6597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6598 LDKQueryChannelRange o_conv;
6599 o_conv.inner = (void*)(o & (~1));
6600 o_conv.is_owned = (o & 1) || (o == 0);
6601 o_conv = QueryChannelRange_clone(&o_conv);
6602 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6603 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
6604 return (long)ret_conv;
6607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6608 LDKDecodeError e_conv;
6609 e_conv.inner = (void*)(e & (~1));
6610 e_conv.is_owned = (e & 1) || (e == 0);
6611 e_conv = DecodeError_clone(&e_conv);
6612 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6613 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
6614 return (long)ret_conv;
6617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6618 if ((_res & 1) != 0) return;
6619 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
6621 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
6624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6625 LDKReplyChannelRange o_conv;
6626 o_conv.inner = (void*)(o & (~1));
6627 o_conv.is_owned = (o & 1) || (o == 0);
6628 o_conv = ReplyChannelRange_clone(&o_conv);
6629 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6630 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
6631 return (long)ret_conv;
6634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6635 LDKDecodeError e_conv;
6636 e_conv.inner = (void*)(e & (~1));
6637 e_conv.is_owned = (e & 1) || (e == 0);
6638 e_conv = DecodeError_clone(&e_conv);
6639 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6640 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
6641 return (long)ret_conv;
6644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6645 if ((_res & 1) != 0) return;
6646 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
6648 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
6651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6652 LDKGossipTimestampFilter o_conv;
6653 o_conv.inner = (void*)(o & (~1));
6654 o_conv.is_owned = (o & 1) || (o == 0);
6655 o_conv = GossipTimestampFilter_clone(&o_conv);
6656 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6657 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
6658 return (long)ret_conv;
6661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6662 LDKDecodeError e_conv;
6663 e_conv.inner = (void*)(e & (~1));
6664 e_conv.is_owned = (e & 1) || (e == 0);
6665 e_conv = DecodeError_clone(&e_conv);
6666 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6667 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
6668 return (long)ret_conv;
6671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6672 if ((_res & 1) != 0) return;
6673 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
6675 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
6678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6679 LDKCVec_PublicKeyZ _res_constr;
6680 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6681 if (_res_constr.datalen > 0)
6682 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6684 _res_constr.data = NULL;
6685 for (size_t i = 0; i < _res_constr.datalen; i++) {
6686 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6687 LDKPublicKey arr_conv_8_ref;
6688 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 33);
6689 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
6690 _res_constr.data[i] = arr_conv_8_ref;
6692 CVec_PublicKeyZ_free(_res_constr);
6695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6696 LDKCVec_u8Z _res_ref;
6697 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6698 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6699 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6700 CVec_u8Z_free(_res_ref);
6703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6705 o_ref.datalen = (*env)->GetArrayLength(env, o);
6706 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6707 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
6708 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6709 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6710 return (long)ret_conv;
6713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6714 LDKPeerHandleError e_conv;
6715 e_conv.inner = (void*)(e & (~1));
6716 e_conv.is_owned = (e & 1) || (e == 0);
6717 e_conv = PeerHandleError_clone(&e_conv);
6718 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6719 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6720 return (long)ret_conv;
6723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6724 if ((_res & 1) != 0) return;
6725 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6727 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6731 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
6732 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6733 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
6734 return (long)ret_conv;
6737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
6738 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6739 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6740 return (long)ret_conv;
6743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6744 LDKPeerHandleError e_conv;
6745 e_conv.inner = (void*)(e & (~1));
6746 e_conv.is_owned = (e & 1) || (e == 0);
6747 e_conv = PeerHandleError_clone(&e_conv);
6748 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6749 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6750 return (long)ret_conv;
6753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6754 if ((_res & 1) != 0) return;
6755 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6757 CResult_NonePeerHandleErrorZ_free(_res_conv);
6760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6761 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
6762 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6763 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
6764 return (long)ret_conv;
6767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6768 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6769 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6770 return (long)ret_conv;
6773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6774 LDKPeerHandleError e_conv;
6775 e_conv.inner = (void*)(e & (~1));
6776 e_conv.is_owned = (e & 1) || (e == 0);
6777 e_conv = PeerHandleError_clone(&e_conv);
6778 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6779 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6780 return (long)ret_conv;
6783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6784 if ((_res & 1) != 0) return;
6785 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6787 CResult_boolPeerHandleErrorZ_free(_res_conv);
6790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6791 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
6792 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6793 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
6794 return (long)ret_conv;
6797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6799 CHECK((*env)->GetArrayLength(env, o) == 32);
6800 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
6801 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
6802 *ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
6803 return (long)ret_conv;
6806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6807 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6808 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
6809 *ret_conv = CResult_SecretKeySecpErrorZ_err(e_conv);
6810 return (long)ret_conv;
6813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6814 if ((_res & 1) != 0) return;
6815 LDKCResult_SecretKeySecpErrorZ _res_conv = *(LDKCResult_SecretKeySecpErrorZ*)(((uint64_t)_res) & ~1);
6817 CResult_SecretKeySecpErrorZ_free(_res_conv);
6820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6822 CHECK((*env)->GetArrayLength(env, o) == 33);
6823 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
6824 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
6825 *ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
6826 return (long)ret_conv;
6829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6830 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6831 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
6832 *ret_conv = CResult_PublicKeySecpErrorZ_err(e_conv);
6833 return (long)ret_conv;
6836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6837 if ((_res & 1) != 0) return;
6838 LDKCResult_PublicKeySecpErrorZ _res_conv = *(LDKCResult_PublicKeySecpErrorZ*)(((uint64_t)_res) & ~1);
6840 CResult_PublicKeySecpErrorZ_free(_res_conv);
6843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6844 LDKTxCreationKeys o_conv;
6845 o_conv.inner = (void*)(o & (~1));
6846 o_conv.is_owned = (o & 1) || (o == 0);
6847 o_conv = TxCreationKeys_clone(&o_conv);
6848 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
6849 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(o_conv);
6850 return (long)ret_conv;
6853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6854 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6855 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
6856 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(e_conv);
6857 return (long)ret_conv;
6860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6861 if ((_res & 1) != 0) return;
6862 LDKCResult_TxCreationKeysSecpErrorZ _res_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)(((uint64_t)_res) & ~1);
6864 CResult_TxCreationKeysSecpErrorZ_free(_res_conv);
6867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6868 LDKTrustedCommitmentTransaction o_conv;
6869 o_conv.inner = (void*)(o & (~1));
6870 o_conv.is_owned = (o & 1) || (o == 0);
6871 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6872 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6873 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6874 return (long)ret_conv;
6877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
6878 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6879 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6880 return (long)ret_conv;
6883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6884 if ((_res & 1) != 0) return;
6885 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6887 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
6891 LDKCVec_SignatureZ o_constr;
6892 o_constr.datalen = (*env)->GetArrayLength(env, o);
6893 if (o_constr.datalen > 0)
6894 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6896 o_constr.data = NULL;
6897 for (size_t i = 0; i < o_constr.datalen; i++) {
6898 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
6899 LDKSignature arr_conv_8_ref;
6900 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
6901 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
6902 o_constr.data[i] = arr_conv_8_ref;
6904 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6905 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6906 return (long)ret_conv;
6909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
6910 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6911 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6912 return (long)ret_conv;
6915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6916 if ((_res & 1) != 0) return;
6917 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6919 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6923 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6924 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6925 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6926 return (long)ret_conv;
6929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6930 LDKCVec_RouteHopZ _res_constr;
6931 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6932 if (_res_constr.datalen > 0)
6933 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6935 _res_constr.data = NULL;
6936 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6937 for (size_t k = 0; k < _res_constr.datalen; k++) {
6938 int64_t arr_conv_10 = _res_vals[k];
6939 LDKRouteHop arr_conv_10_conv;
6940 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
6941 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
6942 _res_constr.data[k] = arr_conv_10_conv;
6944 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6945 CVec_RouteHopZ_free(_res_constr);
6948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6949 LDKCVec_CVec_RouteHopZZ _res_constr;
6950 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6951 if (_res_constr.datalen > 0)
6952 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
6954 _res_constr.data = NULL;
6955 for (size_t m = 0; m < _res_constr.datalen; m++) {
6956 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
6957 LDKCVec_RouteHopZ arr_conv_12_constr;
6958 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
6959 if (arr_conv_12_constr.datalen > 0)
6960 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6962 arr_conv_12_constr.data = NULL;
6963 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
6964 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
6965 int64_t arr_conv_10 = arr_conv_12_vals[k];
6966 LDKRouteHop arr_conv_10_conv;
6967 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
6968 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
6969 arr_conv_12_constr.data[k] = arr_conv_10_conv;
6971 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
6972 _res_constr.data[m] = arr_conv_12_constr;
6974 CVec_CVec_RouteHopZZ_free(_res_constr);
6977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6979 o_conv.inner = (void*)(o & (~1));
6980 o_conv.is_owned = (o & 1) || (o == 0);
6981 o_conv = Route_clone(&o_conv);
6982 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6983 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
6984 return (long)ret_conv;
6987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6988 LDKDecodeError e_conv;
6989 e_conv.inner = (void*)(e & (~1));
6990 e_conv.is_owned = (e & 1) || (e == 0);
6991 e_conv = DecodeError_clone(&e_conv);
6992 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6993 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
6994 return (long)ret_conv;
6997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6998 if ((_res & 1) != 0) return;
6999 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7001 CResult_RouteDecodeErrorZ_free(_res_conv);
7004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7005 LDKCVec_RouteHintZ _res_constr;
7006 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7007 if (_res_constr.datalen > 0)
7008 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7010 _res_constr.data = NULL;
7011 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7012 for (size_t l = 0; l < _res_constr.datalen; l++) {
7013 int64_t arr_conv_11 = _res_vals[l];
7014 LDKRouteHint arr_conv_11_conv;
7015 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
7016 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
7017 _res_constr.data[l] = arr_conv_11_conv;
7019 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7020 CVec_RouteHintZ_free(_res_constr);
7023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7025 o_conv.inner = (void*)(o & (~1));
7026 o_conv.is_owned = (o & 1) || (o == 0);
7027 o_conv = Route_clone(&o_conv);
7028 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7029 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7030 return (long)ret_conv;
7033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7034 LDKLightningError e_conv;
7035 e_conv.inner = (void*)(e & (~1));
7036 e_conv.is_owned = (e & 1) || (e == 0);
7037 e_conv = LightningError_clone(&e_conv);
7038 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7039 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7040 return (long)ret_conv;
7043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7044 if ((_res & 1) != 0) return;
7045 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7047 CResult_RouteLightningErrorZ_free(_res_conv);
7050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7051 LDKRoutingFees o_conv;
7052 o_conv.inner = (void*)(o & (~1));
7053 o_conv.is_owned = (o & 1) || (o == 0);
7054 o_conv = RoutingFees_clone(&o_conv);
7055 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7056 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7057 return (long)ret_conv;
7060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7061 LDKDecodeError e_conv;
7062 e_conv.inner = (void*)(e & (~1));
7063 e_conv.is_owned = (e & 1) || (e == 0);
7064 e_conv = DecodeError_clone(&e_conv);
7065 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7066 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7067 return (long)ret_conv;
7070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7071 if ((_res & 1) != 0) return;
7072 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7074 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7078 LDKNodeAnnouncementInfo o_conv;
7079 o_conv.inner = (void*)(o & (~1));
7080 o_conv.is_owned = (o & 1) || (o == 0);
7081 o_conv = NodeAnnouncementInfo_clone(&o_conv);
7082 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7083 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7084 return (long)ret_conv;
7087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7088 LDKDecodeError e_conv;
7089 e_conv.inner = (void*)(e & (~1));
7090 e_conv.is_owned = (e & 1) || (e == 0);
7091 e_conv = DecodeError_clone(&e_conv);
7092 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7093 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7094 return (long)ret_conv;
7097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7098 if ((_res & 1) != 0) return;
7099 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7101 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7105 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
7106 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7107 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
7108 return (long)ret_conv;
7111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7113 o_conv.inner = (void*)(o & (~1));
7114 o_conv.is_owned = (o & 1) || (o == 0);
7115 o_conv = NodeInfo_clone(&o_conv);
7116 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7117 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7118 return (long)ret_conv;
7121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7122 LDKDecodeError e_conv;
7123 e_conv.inner = (void*)(e & (~1));
7124 e_conv.is_owned = (e & 1) || (e == 0);
7125 e_conv = DecodeError_clone(&e_conv);
7126 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7127 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7128 return (long)ret_conv;
7131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7132 if ((_res & 1) != 0) return;
7133 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7135 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7139 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7140 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7141 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7142 return (long)ret_conv;
7145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7146 LDKNetworkGraph o_conv;
7147 o_conv.inner = (void*)(o & (~1));
7148 o_conv.is_owned = (o & 1) || (o == 0);
7149 // Warning: we need a move here but no clone is available for LDKNetworkGraph
7150 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7151 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7152 return (long)ret_conv;
7155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7156 LDKDecodeError e_conv;
7157 e_conv.inner = (void*)(e & (~1));
7158 e_conv.is_owned = (e & 1) || (e == 0);
7159 e_conv = DecodeError_clone(&e_conv);
7160 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7161 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7162 return (long)ret_conv;
7165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7166 if ((_res & 1) != 0) return;
7167 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7169 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7173 if ((this_ptr & 1) != 0) return;
7174 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
7175 FREE((void*)this_ptr);
7176 Event_free(this_ptr_conv);
7179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7180 LDKEvent* orig_conv = (LDKEvent*)orig;
7181 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
7182 *ret_copy = Event_clone(orig_conv);
7183 long ret_ref = (long)ret_copy;
7187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
7188 LDKEvent* obj_conv = (LDKEvent*)obj;
7189 LDKCVec_u8Z arg_var = Event_write(obj_conv);
7190 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7191 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7192 CVec_u8Z_free(arg_var);
7196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7197 if ((this_ptr & 1) != 0) return;
7198 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
7199 FREE((void*)this_ptr);
7200 MessageSendEvent_free(this_ptr_conv);
7203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7204 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
7205 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7206 *ret_copy = MessageSendEvent_clone(orig_conv);
7207 long ret_ref = (long)ret_copy;
7211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7212 if ((this_ptr & 1) != 0) return;
7213 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
7214 FREE((void*)this_ptr);
7215 MessageSendEventsProvider_free(this_ptr_conv);
7218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7219 if ((this_ptr & 1) != 0) return;
7220 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
7221 FREE((void*)this_ptr);
7222 EventsProvider_free(this_ptr_conv);
7225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7226 if ((this_ptr & 1) != 0) return;
7227 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
7228 FREE((void*)this_ptr);
7229 APIError_free(this_ptr_conv);
7232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7233 LDKAPIError* orig_conv = (LDKAPIError*)orig;
7234 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7235 *ret_copy = APIError_clone(orig_conv);
7236 long ret_ref = (long)ret_copy;
7240 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7241 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
7242 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
7246 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
7247 jclass ret_conv = LDKLevel_to_java(env, Level_max());
7251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7252 if ((this_ptr & 1) != 0) return;
7253 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
7254 FREE((void*)this_ptr);
7255 Logger_free(this_ptr_conv);
7258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7259 LDKChannelHandshakeConfig this_ptr_conv;
7260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7262 ChannelHandshakeConfig_free(this_ptr_conv);
7265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7266 LDKChannelHandshakeConfig orig_conv;
7267 orig_conv.inner = (void*)(orig & (~1));
7268 orig_conv.is_owned = false;
7269 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
7270 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7271 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7272 long ret_ref = (long)ret_var.inner;
7273 if (ret_var.is_owned) {
7279 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
7280 LDKChannelHandshakeConfig this_ptr_conv;
7281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7282 this_ptr_conv.is_owned = false;
7283 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
7287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7288 LDKChannelHandshakeConfig this_ptr_conv;
7289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7290 this_ptr_conv.is_owned = false;
7291 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
7294 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
7295 LDKChannelHandshakeConfig this_ptr_conv;
7296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7297 this_ptr_conv.is_owned = false;
7298 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
7302 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) {
7303 LDKChannelHandshakeConfig this_ptr_conv;
7304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7305 this_ptr_conv.is_owned = false;
7306 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
7309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7310 LDKChannelHandshakeConfig this_ptr_conv;
7311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7312 this_ptr_conv.is_owned = false;
7313 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
7317 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) {
7318 LDKChannelHandshakeConfig this_ptr_conv;
7319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7320 this_ptr_conv.is_owned = false;
7321 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
7324 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) {
7325 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
7326 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7327 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7328 long ret_ref = (long)ret_var.inner;
7329 if (ret_var.is_owned) {
7335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
7336 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
7337 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7338 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7339 long ret_ref = (long)ret_var.inner;
7340 if (ret_var.is_owned) {
7346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7347 LDKChannelHandshakeLimits this_ptr_conv;
7348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7350 ChannelHandshakeLimits_free(this_ptr_conv);
7353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7354 LDKChannelHandshakeLimits orig_conv;
7355 orig_conv.inner = (void*)(orig & (~1));
7356 orig_conv.is_owned = false;
7357 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
7358 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7359 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7360 long ret_ref = (long)ret_var.inner;
7361 if (ret_var.is_owned) {
7367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7368 LDKChannelHandshakeLimits this_ptr_conv;
7369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7370 this_ptr_conv.is_owned = false;
7371 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
7375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7376 LDKChannelHandshakeLimits this_ptr_conv;
7377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7378 this_ptr_conv.is_owned = false;
7379 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
7382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7383 LDKChannelHandshakeLimits this_ptr_conv;
7384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7385 this_ptr_conv.is_owned = false;
7386 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
7390 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) {
7391 LDKChannelHandshakeLimits this_ptr_conv;
7392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7393 this_ptr_conv.is_owned = false;
7394 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
7397 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) {
7398 LDKChannelHandshakeLimits this_ptr_conv;
7399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7400 this_ptr_conv.is_owned = false;
7401 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
7405 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) {
7406 LDKChannelHandshakeLimits this_ptr_conv;
7407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7408 this_ptr_conv.is_owned = false;
7409 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7413 LDKChannelHandshakeLimits this_ptr_conv;
7414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7415 this_ptr_conv.is_owned = false;
7416 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
7420 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) {
7421 LDKChannelHandshakeLimits this_ptr_conv;
7422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7423 this_ptr_conv.is_owned = false;
7424 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
7427 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
7428 LDKChannelHandshakeLimits this_ptr_conv;
7429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7430 this_ptr_conv.is_owned = false;
7431 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
7435 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) {
7436 LDKChannelHandshakeLimits this_ptr_conv;
7437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7438 this_ptr_conv.is_owned = false;
7439 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
7442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7443 LDKChannelHandshakeLimits this_ptr_conv;
7444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7445 this_ptr_conv.is_owned = false;
7446 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
7450 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) {
7451 LDKChannelHandshakeLimits this_ptr_conv;
7452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7453 this_ptr_conv.is_owned = false;
7454 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
7457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7458 LDKChannelHandshakeLimits this_ptr_conv;
7459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7460 this_ptr_conv.is_owned = false;
7461 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
7465 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) {
7466 LDKChannelHandshakeLimits this_ptr_conv;
7467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7468 this_ptr_conv.is_owned = false;
7469 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
7472 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
7473 LDKChannelHandshakeLimits this_ptr_conv;
7474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7475 this_ptr_conv.is_owned = false;
7476 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
7480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7481 LDKChannelHandshakeLimits this_ptr_conv;
7482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7483 this_ptr_conv.is_owned = false;
7484 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
7487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
7488 LDKChannelHandshakeLimits this_ptr_conv;
7489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7490 this_ptr_conv.is_owned = false;
7491 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
7495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7496 LDKChannelHandshakeLimits this_ptr_conv;
7497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7498 this_ptr_conv.is_owned = false;
7499 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
7502 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
7503 LDKChannelHandshakeLimits this_ptr_conv;
7504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7505 this_ptr_conv.is_owned = false;
7506 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
7510 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) {
7511 LDKChannelHandshakeLimits this_ptr_conv;
7512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7513 this_ptr_conv.is_owned = false;
7514 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
7517 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) {
7518 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);
7519 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7520 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7521 long ret_ref = (long)ret_var.inner;
7522 if (ret_var.is_owned) {
7528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
7529 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
7530 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7531 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7532 long ret_ref = (long)ret_var.inner;
7533 if (ret_var.is_owned) {
7539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7540 LDKChannelConfig this_ptr_conv;
7541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7543 ChannelConfig_free(this_ptr_conv);
7546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7547 LDKChannelConfig orig_conv;
7548 orig_conv.inner = (void*)(orig & (~1));
7549 orig_conv.is_owned = false;
7550 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
7551 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7552 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7553 long ret_ref = (long)ret_var.inner;
7554 if (ret_var.is_owned) {
7560 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
7561 LDKChannelConfig this_ptr_conv;
7562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7563 this_ptr_conv.is_owned = false;
7564 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
7568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7569 LDKChannelConfig this_ptr_conv;
7570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7571 this_ptr_conv.is_owned = false;
7572 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
7575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
7576 LDKChannelConfig this_ptr_conv;
7577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7578 this_ptr_conv.is_owned = false;
7579 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
7583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7584 LDKChannelConfig this_ptr_conv;
7585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7586 this_ptr_conv.is_owned = false;
7587 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
7590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
7591 LDKChannelConfig this_ptr_conv;
7592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7593 this_ptr_conv.is_owned = false;
7594 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
7598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7599 LDKChannelConfig this_ptr_conv;
7600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7601 this_ptr_conv.is_owned = false;
7602 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
7605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
7606 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
7607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7609 long ret_ref = (long)ret_var.inner;
7610 if (ret_var.is_owned) {
7616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
7617 LDKChannelConfig ret_var = ChannelConfig_default();
7618 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7619 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7620 long ret_ref = (long)ret_var.inner;
7621 if (ret_var.is_owned) {
7627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
7628 LDKChannelConfig obj_conv;
7629 obj_conv.inner = (void*)(obj & (~1));
7630 obj_conv.is_owned = false;
7631 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
7632 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7633 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7634 CVec_u8Z_free(arg_var);
7638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
7640 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
7641 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
7642 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
7643 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7644 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7645 long ret_ref = (long)ret_var.inner;
7646 if (ret_var.is_owned) {
7649 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
7653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7654 LDKUserConfig this_ptr_conv;
7655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7657 UserConfig_free(this_ptr_conv);
7660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7661 LDKUserConfig orig_conv;
7662 orig_conv.inner = (void*)(orig & (~1));
7663 orig_conv.is_owned = false;
7664 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
7665 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7666 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7667 long ret_ref = (long)ret_var.inner;
7668 if (ret_var.is_owned) {
7674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
7675 LDKUserConfig this_ptr_conv;
7676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7677 this_ptr_conv.is_owned = false;
7678 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
7679 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7680 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7681 long ret_ref = (long)ret_var.inner;
7682 if (ret_var.is_owned) {
7688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7689 LDKUserConfig this_ptr_conv;
7690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7691 this_ptr_conv.is_owned = false;
7692 LDKChannelHandshakeConfig val_conv;
7693 val_conv.inner = (void*)(val & (~1));
7694 val_conv.is_owned = (val & 1) || (val == 0);
7695 val_conv = ChannelHandshakeConfig_clone(&val_conv);
7696 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
7699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
7700 LDKUserConfig this_ptr_conv;
7701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7702 this_ptr_conv.is_owned = false;
7703 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
7704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7706 long ret_ref = (long)ret_var.inner;
7707 if (ret_var.is_owned) {
7713 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) {
7714 LDKUserConfig this_ptr_conv;
7715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7716 this_ptr_conv.is_owned = false;
7717 LDKChannelHandshakeLimits val_conv;
7718 val_conv.inner = (void*)(val & (~1));
7719 val_conv.is_owned = (val & 1) || (val == 0);
7720 val_conv = ChannelHandshakeLimits_clone(&val_conv);
7721 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
7724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
7725 LDKUserConfig this_ptr_conv;
7726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7727 this_ptr_conv.is_owned = false;
7728 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
7729 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7730 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7731 long ret_ref = (long)ret_var.inner;
7732 if (ret_var.is_owned) {
7738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7739 LDKUserConfig this_ptr_conv;
7740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7741 this_ptr_conv.is_owned = false;
7742 LDKChannelConfig val_conv;
7743 val_conv.inner = (void*)(val & (~1));
7744 val_conv.is_owned = (val & 1) || (val == 0);
7745 val_conv = ChannelConfig_clone(&val_conv);
7746 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
7749 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) {
7750 LDKChannelHandshakeConfig own_channel_config_arg_conv;
7751 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
7752 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
7753 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
7754 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
7755 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
7756 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
7757 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
7758 LDKChannelConfig channel_options_arg_conv;
7759 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
7760 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
7761 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
7762 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
7763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7765 long ret_ref = (long)ret_var.inner;
7766 if (ret_var.is_owned) {
7772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
7773 LDKUserConfig ret_var = UserConfig_default();
7774 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7775 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7776 long ret_ref = (long)ret_var.inner;
7777 if (ret_var.is_owned) {
7783 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7784 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
7785 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
7789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7790 if ((this_ptr & 1) != 0) return;
7791 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
7792 FREE((void*)this_ptr);
7793 Access_free(this_ptr_conv);
7796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7797 if ((this_ptr & 1) != 0) return;
7798 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
7799 FREE((void*)this_ptr);
7800 Watch_free(this_ptr_conv);
7803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7804 if ((this_ptr & 1) != 0) return;
7805 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
7806 FREE((void*)this_ptr);
7807 Filter_free(this_ptr_conv);
7810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7811 if ((this_ptr & 1) != 0) return;
7812 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
7813 FREE((void*)this_ptr);
7814 BroadcasterInterface_free(this_ptr_conv);
7817 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7818 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
7819 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
7823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7824 if ((this_ptr & 1) != 0) return;
7825 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
7826 FREE((void*)this_ptr);
7827 FeeEstimator_free(this_ptr_conv);
7830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7831 LDKChainMonitor this_ptr_conv;
7832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7834 ChainMonitor_free(this_ptr_conv);
7837 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) {
7838 LDKChainMonitor this_arg_conv;
7839 this_arg_conv.inner = (void*)(this_arg & (~1));
7840 this_arg_conv.is_owned = false;
7841 unsigned char header_arr[80];
7842 CHECK((*env)->GetArrayLength(env, header) == 80);
7843 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7844 unsigned char (*header_ref)[80] = &header_arr;
7845 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7846 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
7847 if (txdata_constr.datalen > 0)
7848 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7850 txdata_constr.data = NULL;
7851 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
7852 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7853 int64_t arr_conv_24 = txdata_vals[y];
7854 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
7855 FREE((void*)arr_conv_24);
7856 txdata_constr.data[y] = arr_conv_24_conv;
7858 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
7859 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7862 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) {
7863 LDKChainMonitor this_arg_conv;
7864 this_arg_conv.inner = (void*)(this_arg & (~1));
7865 this_arg_conv.is_owned = false;
7866 unsigned char header_arr[80];
7867 CHECK((*env)->GetArrayLength(env, header) == 80);
7868 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7869 unsigned char (*header_ref)[80] = &header_arr;
7870 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
7873 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) {
7874 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
7875 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
7876 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7877 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7878 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
7880 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
7881 if (logger_conv.free == LDKLogger_JCalls_free) {
7882 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7883 LDKLogger_JCalls_clone(logger_conv.this_arg);
7885 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
7886 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
7887 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7888 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
7890 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
7891 if (persister_conv.free == LDKPersist_JCalls_free) {
7892 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7893 LDKPersist_JCalls_clone(persister_conv.this_arg);
7895 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
7896 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7897 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7898 long ret_ref = (long)ret_var.inner;
7899 if (ret_var.is_owned) {
7905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
7906 LDKChainMonitor this_arg_conv;
7907 this_arg_conv.inner = (void*)(this_arg & (~1));
7908 this_arg_conv.is_owned = false;
7909 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
7910 *ret = ChainMonitor_as_Watch(&this_arg_conv);
7914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
7915 LDKChainMonitor this_arg_conv;
7916 this_arg_conv.inner = (void*)(this_arg & (~1));
7917 this_arg_conv.is_owned = false;
7918 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7919 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
7923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7924 LDKChannelMonitorUpdate this_ptr_conv;
7925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7927 ChannelMonitorUpdate_free(this_ptr_conv);
7930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7931 LDKChannelMonitorUpdate orig_conv;
7932 orig_conv.inner = (void*)(orig & (~1));
7933 orig_conv.is_owned = false;
7934 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
7935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7937 long ret_ref = (long)ret_var.inner;
7938 if (ret_var.is_owned) {
7944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
7945 LDKChannelMonitorUpdate this_ptr_conv;
7946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7947 this_ptr_conv.is_owned = false;
7948 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
7952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7953 LDKChannelMonitorUpdate this_ptr_conv;
7954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7955 this_ptr_conv.is_owned = false;
7956 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
7959 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
7960 LDKChannelMonitorUpdate obj_conv;
7961 obj_conv.inner = (void*)(obj & (~1));
7962 obj_conv.is_owned = false;
7963 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
7964 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7965 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7966 CVec_u8Z_free(arg_var);
7970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
7972 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
7973 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
7974 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7975 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
7976 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
7977 return (long)ret_conv;
7980 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7981 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
7982 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
7986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7987 LDKMonitorUpdateError this_ptr_conv;
7988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7990 MonitorUpdateError_free(this_ptr_conv);
7993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7994 LDKMonitorUpdateError orig_conv;
7995 orig_conv.inner = (void*)(orig & (~1));
7996 orig_conv.is_owned = false;
7997 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
7998 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7999 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8000 long ret_ref = (long)ret_var.inner;
8001 if (ret_var.is_owned) {
8007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8008 LDKMonitorEvent this_ptr_conv;
8009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8010 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8011 MonitorEvent_free(this_ptr_conv);
8014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8015 LDKMonitorEvent orig_conv;
8016 orig_conv.inner = (void*)(orig & (~1));
8017 orig_conv.is_owned = false;
8018 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
8019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8021 long ret_ref = (long)ret_var.inner;
8022 if (ret_var.is_owned) {
8028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8029 LDKHTLCUpdate this_ptr_conv;
8030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8032 HTLCUpdate_free(this_ptr_conv);
8035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8036 LDKHTLCUpdate orig_conv;
8037 orig_conv.inner = (void*)(orig & (~1));
8038 orig_conv.is_owned = false;
8039 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
8040 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8041 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8042 long ret_ref = (long)ret_var.inner;
8043 if (ret_var.is_owned) {
8049 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
8050 LDKHTLCUpdate obj_conv;
8051 obj_conv.inner = (void*)(obj & (~1));
8052 obj_conv.is_owned = false;
8053 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
8054 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8055 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8056 CVec_u8Z_free(arg_var);
8060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8062 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8063 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8064 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
8065 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8066 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8067 long ret_ref = (long)ret_var.inner;
8068 if (ret_var.is_owned) {
8071 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8076 LDKChannelMonitor this_ptr_conv;
8077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8078 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8079 ChannelMonitor_free(this_ptr_conv);
8082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8083 LDKChannelMonitor orig_conv;
8084 orig_conv.inner = (void*)(orig & (~1));
8085 orig_conv.is_owned = false;
8086 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
8087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8089 long ret_ref = (long)ret_var.inner;
8090 if (ret_var.is_owned) {
8096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
8097 LDKChannelMonitor obj_conv;
8098 obj_conv.inner = (void*)(obj & (~1));
8099 obj_conv.is_owned = false;
8100 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
8101 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8102 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8103 CVec_u8Z_free(arg_var);
8107 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) {
8108 LDKChannelMonitor this_arg_conv;
8109 this_arg_conv.inner = (void*)(this_arg & (~1));
8110 this_arg_conv.is_owned = false;
8111 LDKChannelMonitorUpdate updates_conv;
8112 updates_conv.inner = (void*)(updates & (~1));
8113 updates_conv.is_owned = false;
8114 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
8115 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
8116 LDKLogger* logger_conv = (LDKLogger*)logger;
8117 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8118 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
8119 return (long)ret_conv;
8122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8123 LDKChannelMonitor this_arg_conv;
8124 this_arg_conv.inner = (void*)(this_arg & (~1));
8125 this_arg_conv.is_owned = false;
8126 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
8130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
8131 LDKChannelMonitor this_arg_conv;
8132 this_arg_conv.inner = (void*)(this_arg & (~1));
8133 this_arg_conv.is_owned = false;
8134 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8135 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
8136 return (long)ret_ref;
8139 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8140 LDKChannelMonitor this_arg_conv;
8141 this_arg_conv.inner = (void*)(this_arg & (~1));
8142 this_arg_conv.is_owned = false;
8143 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
8144 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8145 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8146 for (size_t o = 0; o < ret_var.datalen; o++) {
8147 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
8148 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8149 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8150 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
8151 if (arr_conv_14_var.is_owned) {
8152 arr_conv_14_ref |= 1;
8154 ret_arr_ptr[o] = arr_conv_14_ref;
8156 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8161 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8162 LDKChannelMonitor this_arg_conv;
8163 this_arg_conv.inner = (void*)(this_arg & (~1));
8164 this_arg_conv.is_owned = false;
8165 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
8166 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8167 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8168 for (size_t h = 0; h < ret_var.datalen; h++) {
8169 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8170 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
8171 long arr_conv_7_ref = (long)arr_conv_7_copy;
8172 ret_arr_ptr[h] = arr_conv_7_ref;
8174 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8179 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) {
8180 LDKChannelMonitor this_arg_conv;
8181 this_arg_conv.inner = (void*)(this_arg & (~1));
8182 this_arg_conv.is_owned = false;
8183 LDKLogger* logger_conv = (LDKLogger*)logger;
8184 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
8185 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
8187 for (size_t i = 0; i < ret_var.datalen; i++) {
8188 LDKTransaction arr_conv_8_var = ret_var.data[i];
8189 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, arr_conv_8_var.datalen);
8190 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
8191 Transaction_free(arr_conv_8_var);
8192 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
8198 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) {
8199 LDKChannelMonitor this_arg_conv;
8200 this_arg_conv.inner = (void*)(this_arg & (~1));
8201 this_arg_conv.is_owned = false;
8202 unsigned char header_arr[80];
8203 CHECK((*env)->GetArrayLength(env, header) == 80);
8204 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8205 unsigned char (*header_ref)[80] = &header_arr;
8206 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8207 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
8208 if (txdata_constr.datalen > 0)
8209 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8211 txdata_constr.data = NULL;
8212 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
8213 for (size_t y = 0; y < txdata_constr.datalen; y++) {
8214 int64_t arr_conv_24 = txdata_vals[y];
8215 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
8216 FREE((void*)arr_conv_24);
8217 txdata_constr.data[y] = arr_conv_24_conv;
8219 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
8220 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
8221 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8222 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8223 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8225 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
8226 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8227 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8228 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8230 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
8231 if (logger_conv.free == LDKLogger_JCalls_free) {
8232 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8233 LDKLogger_JCalls_clone(logger_conv.this_arg);
8235 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);
8236 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8237 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8238 for (size_t u = 0; u < ret_var.datalen; u++) {
8239 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8240 *arr_conv_46_ref = ret_var.data[u];
8241 ret_arr_ptr[u] = (long)arr_conv_46_ref;
8243 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8248 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) {
8249 LDKChannelMonitor this_arg_conv;
8250 this_arg_conv.inner = (void*)(this_arg & (~1));
8251 this_arg_conv.is_owned = false;
8252 unsigned char header_arr[80];
8253 CHECK((*env)->GetArrayLength(env, header) == 80);
8254 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8255 unsigned char (*header_ref)[80] = &header_arr;
8256 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
8257 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8258 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8259 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8261 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
8262 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8263 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8264 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8266 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
8267 if (logger_conv.free == LDKLogger_JCalls_free) {
8268 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8269 LDKLogger_JCalls_clone(logger_conv.this_arg);
8271 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
8274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8275 if ((this_ptr & 1) != 0) return;
8276 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
8277 FREE((void*)this_ptr);
8278 Persist_free(this_ptr_conv);
8281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
8283 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8284 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8285 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
8286 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8287 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
8288 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8289 return (long)ret_conv;
8292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8293 LDKOutPoint this_ptr_conv;
8294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8295 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8296 OutPoint_free(this_ptr_conv);
8299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8300 LDKOutPoint orig_conv;
8301 orig_conv.inner = (void*)(orig & (~1));
8302 orig_conv.is_owned = false;
8303 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
8304 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8305 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8306 long ret_ref = (long)ret_var.inner;
8307 if (ret_var.is_owned) {
8313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
8314 LDKOutPoint this_ptr_conv;
8315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8316 this_ptr_conv.is_owned = false;
8317 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
8322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8323 LDKOutPoint this_ptr_conv;
8324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8325 this_ptr_conv.is_owned = false;
8326 LDKThirtyTwoBytes val_ref;
8327 CHECK((*env)->GetArrayLength(env, val) == 32);
8328 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8329 OutPoint_set_txid(&this_ptr_conv, val_ref);
8332 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
8333 LDKOutPoint this_ptr_conv;
8334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8335 this_ptr_conv.is_owned = false;
8336 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
8340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
8341 LDKOutPoint this_ptr_conv;
8342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8343 this_ptr_conv.is_owned = false;
8344 OutPoint_set_index(&this_ptr_conv, val);
8347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
8348 LDKThirtyTwoBytes txid_arg_ref;
8349 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
8350 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
8351 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
8352 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8353 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8354 long ret_ref = (long)ret_var.inner;
8355 if (ret_var.is_owned) {
8361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8362 LDKOutPoint this_arg_conv;
8363 this_arg_conv.inner = (void*)(this_arg & (~1));
8364 this_arg_conv.is_owned = false;
8365 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
8366 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
8370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
8371 LDKOutPoint obj_conv;
8372 obj_conv.inner = (void*)(obj & (~1));
8373 obj_conv.is_owned = false;
8374 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
8375 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8376 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8377 CVec_u8Z_free(arg_var);
8381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8383 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8384 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8385 LDKOutPoint ret_var = OutPoint_read(ser_ref);
8386 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8387 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8388 long ret_ref = (long)ret_var.inner;
8389 if (ret_var.is_owned) {
8392 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8397 if ((this_ptr & 1) != 0) return;
8398 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
8399 FREE((void*)this_ptr);
8400 SpendableOutputDescriptor_free(this_ptr_conv);
8403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8404 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
8405 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
8406 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
8407 long ret_ref = (long)ret_copy;
8411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
8412 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
8413 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
8414 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8415 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8416 CVec_u8Z_free(arg_var);
8420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8422 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8423 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8424 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8425 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
8426 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8427 return (long)ret_conv;
8430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8431 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
8432 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8433 *ret = ChannelKeys_clone(orig_conv);
8437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8438 if ((this_ptr & 1) != 0) return;
8439 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)(((uint64_t)this_ptr) & ~1);
8440 FREE((void*)this_ptr);
8441 ChannelKeys_free(this_ptr_conv);
8444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8445 if ((this_ptr & 1) != 0) return;
8446 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
8447 FREE((void*)this_ptr);
8448 KeysInterface_free(this_ptr_conv);
8451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8452 LDKInMemoryChannelKeys this_ptr_conv;
8453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8455 InMemoryChannelKeys_free(this_ptr_conv);
8458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8459 LDKInMemoryChannelKeys orig_conv;
8460 orig_conv.inner = (void*)(orig & (~1));
8461 orig_conv.is_owned = false;
8462 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
8463 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8464 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8465 long ret_ref = (long)ret_var.inner;
8466 if (ret_var.is_owned) {
8472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8473 LDKInMemoryChannelKeys this_ptr_conv;
8474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8475 this_ptr_conv.is_owned = false;
8476 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8477 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
8481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8482 LDKInMemoryChannelKeys this_ptr_conv;
8483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8484 this_ptr_conv.is_owned = false;
8485 LDKSecretKey val_ref;
8486 CHECK((*env)->GetArrayLength(env, val) == 32);
8487 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8488 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
8491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8492 LDKInMemoryChannelKeys this_ptr_conv;
8493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8494 this_ptr_conv.is_owned = false;
8495 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8496 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
8500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8501 LDKInMemoryChannelKeys this_ptr_conv;
8502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8503 this_ptr_conv.is_owned = false;
8504 LDKSecretKey val_ref;
8505 CHECK((*env)->GetArrayLength(env, val) == 32);
8506 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8507 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
8510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8511 LDKInMemoryChannelKeys this_ptr_conv;
8512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8513 this_ptr_conv.is_owned = false;
8514 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8515 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
8519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8520 LDKInMemoryChannelKeys this_ptr_conv;
8521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8522 this_ptr_conv.is_owned = false;
8523 LDKSecretKey val_ref;
8524 CHECK((*env)->GetArrayLength(env, val) == 32);
8525 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8526 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
8529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8530 LDKInMemoryChannelKeys this_ptr_conv;
8531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8532 this_ptr_conv.is_owned = false;
8533 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8534 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
8538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8539 LDKInMemoryChannelKeys this_ptr_conv;
8540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8541 this_ptr_conv.is_owned = false;
8542 LDKSecretKey val_ref;
8543 CHECK((*env)->GetArrayLength(env, val) == 32);
8544 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8545 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
8548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8549 LDKInMemoryChannelKeys this_ptr_conv;
8550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8551 this_ptr_conv.is_owned = false;
8552 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8553 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
8557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8558 LDKInMemoryChannelKeys this_ptr_conv;
8559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8560 this_ptr_conv.is_owned = false;
8561 LDKSecretKey val_ref;
8562 CHECK((*env)->GetArrayLength(env, val) == 32);
8563 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8564 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
8567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
8568 LDKInMemoryChannelKeys this_ptr_conv;
8569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8570 this_ptr_conv.is_owned = false;
8571 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8572 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
8576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8577 LDKInMemoryChannelKeys this_ptr_conv;
8578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8579 this_ptr_conv.is_owned = false;
8580 LDKThirtyTwoBytes val_ref;
8581 CHECK((*env)->GetArrayLength(env, val) == 32);
8582 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8583 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
8586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_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, int64_t key_derivation_params) {
8587 LDKSecretKey funding_key_ref;
8588 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
8589 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
8590 LDKSecretKey revocation_base_key_ref;
8591 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
8592 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
8593 LDKSecretKey payment_key_ref;
8594 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
8595 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
8596 LDKSecretKey delayed_payment_base_key_ref;
8597 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
8598 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
8599 LDKSecretKey htlc_base_key_ref;
8600 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
8601 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
8602 LDKThirtyTwoBytes commitment_seed_ref;
8603 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
8604 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
8605 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)key_derivation_params) & ~1);
8606 FREE((void*)key_derivation_params);
8607 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
8608 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8609 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8610 long ret_ref = (long)ret_var.inner;
8611 if (ret_var.is_owned) {
8617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
8618 LDKInMemoryChannelKeys this_arg_conv;
8619 this_arg_conv.inner = (void*)(this_arg & (~1));
8620 this_arg_conv.is_owned = false;
8621 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
8622 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8623 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8624 long ret_ref = (long)ret_var.inner;
8625 if (ret_var.is_owned) {
8631 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
8632 LDKInMemoryChannelKeys this_arg_conv;
8633 this_arg_conv.inner = (void*)(this_arg & (~1));
8634 this_arg_conv.is_owned = false;
8635 int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
8639 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
8640 LDKInMemoryChannelKeys this_arg_conv;
8641 this_arg_conv.inner = (void*)(this_arg & (~1));
8642 this_arg_conv.is_owned = false;
8643 int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
8647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
8648 LDKInMemoryChannelKeys this_arg_conv;
8649 this_arg_conv.inner = (void*)(this_arg & (~1));
8650 this_arg_conv.is_owned = false;
8651 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
8655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
8656 LDKInMemoryChannelKeys this_arg_conv;
8657 this_arg_conv.inner = (void*)(this_arg & (~1));
8658 this_arg_conv.is_owned = false;
8659 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
8660 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8661 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8662 long ret_ref = (long)ret_var.inner;
8663 if (ret_var.is_owned) {
8669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
8670 LDKInMemoryChannelKeys this_arg_conv;
8671 this_arg_conv.inner = (void*)(this_arg & (~1));
8672 this_arg_conv.is_owned = false;
8673 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
8674 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8675 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8676 long ret_ref = (long)ret_var.inner;
8677 if (ret_var.is_owned) {
8683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv *env, jclass clz, int64_t this_arg) {
8684 LDKInMemoryChannelKeys this_arg_conv;
8685 this_arg_conv.inner = (void*)(this_arg & (~1));
8686 this_arg_conv.is_owned = false;
8687 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8688 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
8692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
8693 LDKInMemoryChannelKeys obj_conv;
8694 obj_conv.inner = (void*)(obj & (~1));
8695 obj_conv.is_owned = false;
8696 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
8697 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8698 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8699 CVec_u8Z_free(arg_var);
8703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8705 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8706 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8707 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
8708 *ret_conv = InMemoryChannelKeys_read(ser_ref);
8709 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8710 return (long)ret_conv;
8713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8714 LDKKeysManager this_ptr_conv;
8715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8717 KeysManager_free(this_ptr_conv);
8720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, jclass network, int64_t starting_time_secs, int32_t starting_time_nanos) {
8721 unsigned char seed_arr[32];
8722 CHECK((*env)->GetArrayLength(env, seed) == 32);
8723 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
8724 unsigned char (*seed_ref)[32] = &seed_arr;
8725 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
8726 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
8727 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8728 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8729 long ret_ref = (long)ret_var.inner;
8730 if (ret_var.is_owned) {
8736 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, int64_t params_1, int64_t params_2) {
8737 LDKKeysManager this_arg_conv;
8738 this_arg_conv.inner = (void*)(this_arg & (~1));
8739 this_arg_conv.is_owned = false;
8740 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
8741 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8742 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8743 long ret_ref = (long)ret_var.inner;
8744 if (ret_var.is_owned) {
8750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
8751 LDKKeysManager this_arg_conv;
8752 this_arg_conv.inner = (void*)(this_arg & (~1));
8753 this_arg_conv.is_owned = false;
8754 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
8755 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
8759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8760 LDKChannelManager this_ptr_conv;
8761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8762 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8763 ChannelManager_free(this_ptr_conv);
8766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8767 LDKChannelDetails this_ptr_conv;
8768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8770 ChannelDetails_free(this_ptr_conv);
8773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8774 LDKChannelDetails orig_conv;
8775 orig_conv.inner = (void*)(orig & (~1));
8776 orig_conv.is_owned = false;
8777 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
8778 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8779 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8780 long ret_ref = (long)ret_var.inner;
8781 if (ret_var.is_owned) {
8787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8788 LDKChannelDetails this_ptr_conv;
8789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8790 this_ptr_conv.is_owned = false;
8791 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8792 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
8796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8797 LDKChannelDetails this_ptr_conv;
8798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8799 this_ptr_conv.is_owned = false;
8800 LDKThirtyTwoBytes val_ref;
8801 CHECK((*env)->GetArrayLength(env, val) == 32);
8802 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8803 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
8806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8807 LDKChannelDetails this_ptr_conv;
8808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8809 this_ptr_conv.is_owned = false;
8810 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
8811 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
8815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8816 LDKChannelDetails this_ptr_conv;
8817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8818 this_ptr_conv.is_owned = false;
8819 LDKPublicKey val_ref;
8820 CHECK((*env)->GetArrayLength(env, val) == 33);
8821 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
8822 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
8825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
8826 LDKChannelDetails this_ptr_conv;
8827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8828 this_ptr_conv.is_owned = false;
8829 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
8830 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8831 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8832 long ret_ref = (long)ret_var.inner;
8833 if (ret_var.is_owned) {
8839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8840 LDKChannelDetails this_ptr_conv;
8841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8842 this_ptr_conv.is_owned = false;
8843 LDKInitFeatures val_conv;
8844 val_conv.inner = (void*)(val & (~1));
8845 val_conv.is_owned = (val & 1) || (val == 0);
8846 // Warning: we need a move here but no clone is available for LDKInitFeatures
8847 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
8850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
8851 LDKChannelDetails this_ptr_conv;
8852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8853 this_ptr_conv.is_owned = false;
8854 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
8858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8859 LDKChannelDetails this_ptr_conv;
8860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8861 this_ptr_conv.is_owned = false;
8862 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
8865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8866 LDKChannelDetails this_ptr_conv;
8867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8868 this_ptr_conv.is_owned = false;
8869 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
8873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8874 LDKChannelDetails this_ptr_conv;
8875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8876 this_ptr_conv.is_owned = false;
8877 ChannelDetails_set_user_id(&this_ptr_conv, val);
8880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
8881 LDKChannelDetails this_ptr_conv;
8882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8883 this_ptr_conv.is_owned = false;
8884 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
8888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8889 LDKChannelDetails this_ptr_conv;
8890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8891 this_ptr_conv.is_owned = false;
8892 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
8895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
8896 LDKChannelDetails this_ptr_conv;
8897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8898 this_ptr_conv.is_owned = false;
8899 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
8903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8904 LDKChannelDetails this_ptr_conv;
8905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8906 this_ptr_conv.is_owned = false;
8907 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
8910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
8911 LDKChannelDetails this_ptr_conv;
8912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8913 this_ptr_conv.is_owned = false;
8914 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
8918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
8919 LDKChannelDetails this_ptr_conv;
8920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8921 this_ptr_conv.is_owned = false;
8922 ChannelDetails_set_is_live(&this_ptr_conv, val);
8925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8926 LDKPaymentSendFailure this_ptr_conv;
8927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8928 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8929 PaymentSendFailure_free(this_ptr_conv);
8932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8933 LDKPaymentSendFailure orig_conv;
8934 orig_conv.inner = (void*)(orig & (~1));
8935 orig_conv.is_owned = false;
8936 LDKPaymentSendFailure ret_var = PaymentSendFailure_clone(&orig_conv);
8937 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8938 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8939 long ret_ref = (long)ret_var.inner;
8940 if (ret_var.is_owned) {
8946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, jclass network, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t current_blockchain_height) {
8947 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
8948 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
8949 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
8950 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8951 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
8953 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
8954 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
8955 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8956 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
8958 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
8959 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8960 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8961 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
8963 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
8964 if (logger_conv.free == LDKLogger_JCalls_free) {
8965 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8966 LDKLogger_JCalls_clone(logger_conv.this_arg);
8968 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
8969 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
8970 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8971 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
8973 LDKUserConfig config_conv;
8974 config_conv.inner = (void*)(config & (~1));
8975 config_conv.is_owned = (config & 1) || (config == 0);
8976 config_conv = UserConfig_clone(&config_conv);
8977 LDKChannelManager ret_var = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
8978 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8979 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8980 long ret_ref = (long)ret_var.inner;
8981 if (ret_var.is_owned) {
8987 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) {
8988 LDKChannelManager this_arg_conv;
8989 this_arg_conv.inner = (void*)(this_arg & (~1));
8990 this_arg_conv.is_owned = false;
8991 LDKPublicKey their_network_key_ref;
8992 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
8993 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
8994 LDKUserConfig override_config_conv;
8995 override_config_conv.inner = (void*)(override_config & (~1));
8996 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
8997 override_config_conv = UserConfig_clone(&override_config_conv);
8998 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8999 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
9000 return (long)ret_conv;
9003 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9004 LDKChannelManager this_arg_conv;
9005 this_arg_conv.inner = (void*)(this_arg & (~1));
9006 this_arg_conv.is_owned = false;
9007 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
9008 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9009 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9010 for (size_t q = 0; q < ret_var.datalen; q++) {
9011 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9012 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9013 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9014 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9015 if (arr_conv_16_var.is_owned) {
9016 arr_conv_16_ref |= 1;
9018 ret_arr_ptr[q] = arr_conv_16_ref;
9020 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9025 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9026 LDKChannelManager this_arg_conv;
9027 this_arg_conv.inner = (void*)(this_arg & (~1));
9028 this_arg_conv.is_owned = false;
9029 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
9030 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9031 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9032 for (size_t q = 0; q < ret_var.datalen; q++) {
9033 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9034 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9035 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9036 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9037 if (arr_conv_16_var.is_owned) {
9038 arr_conv_16_ref |= 1;
9040 ret_arr_ptr[q] = arr_conv_16_ref;
9042 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
9048 LDKChannelManager this_arg_conv;
9049 this_arg_conv.inner = (void*)(this_arg & (~1));
9050 this_arg_conv.is_owned = false;
9051 unsigned char channel_id_arr[32];
9052 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
9053 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
9054 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9055 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9056 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
9057 return (long)ret_conv;
9060 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) {
9061 LDKChannelManager this_arg_conv;
9062 this_arg_conv.inner = (void*)(this_arg & (~1));
9063 this_arg_conv.is_owned = false;
9064 unsigned char channel_id_arr[32];
9065 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
9066 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
9067 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9068 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9069 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
9070 return (long)ret_conv;
9073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9074 LDKChannelManager this_arg_conv;
9075 this_arg_conv.inner = (void*)(this_arg & (~1));
9076 this_arg_conv.is_owned = false;
9077 ChannelManager_force_close_all_channels(&this_arg_conv);
9080 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) {
9081 LDKChannelManager this_arg_conv;
9082 this_arg_conv.inner = (void*)(this_arg & (~1));
9083 this_arg_conv.is_owned = false;
9084 LDKRoute route_conv;
9085 route_conv.inner = (void*)(route & (~1));
9086 route_conv.is_owned = false;
9087 LDKThirtyTwoBytes payment_hash_ref;
9088 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
9089 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
9090 LDKThirtyTwoBytes payment_secret_ref;
9091 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9092 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9093 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9094 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
9095 return (long)ret_conv;
9098 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) {
9099 LDKChannelManager this_arg_conv;
9100 this_arg_conv.inner = (void*)(this_arg & (~1));
9101 this_arg_conv.is_owned = false;
9102 unsigned char temporary_channel_id_arr[32];
9103 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
9104 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
9105 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
9106 LDKOutPoint funding_txo_conv;
9107 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9108 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
9109 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9110 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
9113 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) {
9114 LDKChannelManager this_arg_conv;
9115 this_arg_conv.inner = (void*)(this_arg & (~1));
9116 this_arg_conv.is_owned = false;
9117 LDKThreeBytes rgb_ref;
9118 CHECK((*env)->GetArrayLength(env, rgb) == 3);
9119 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
9120 LDKThirtyTwoBytes alias_ref;
9121 CHECK((*env)->GetArrayLength(env, alias) == 32);
9122 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
9123 LDKCVec_NetAddressZ addresses_constr;
9124 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
9125 if (addresses_constr.datalen > 0)
9126 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9128 addresses_constr.data = NULL;
9129 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
9130 for (size_t m = 0; m < addresses_constr.datalen; m++) {
9131 int64_t arr_conv_12 = addresses_vals[m];
9132 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
9133 FREE((void*)arr_conv_12);
9134 addresses_constr.data[m] = arr_conv_12_conv;
9136 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
9137 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
9140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
9141 LDKChannelManager this_arg_conv;
9142 this_arg_conv.inner = (void*)(this_arg & (~1));
9143 this_arg_conv.is_owned = false;
9144 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
9147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
9148 LDKChannelManager this_arg_conv;
9149 this_arg_conv.inner = (void*)(this_arg & (~1));
9150 this_arg_conv.is_owned = false;
9151 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
9154 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) {
9155 LDKChannelManager this_arg_conv;
9156 this_arg_conv.inner = (void*)(this_arg & (~1));
9157 this_arg_conv.is_owned = false;
9158 unsigned char payment_hash_arr[32];
9159 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
9160 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
9161 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
9162 LDKThirtyTwoBytes payment_secret_ref;
9163 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9164 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9165 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
9169 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) {
9170 LDKChannelManager this_arg_conv;
9171 this_arg_conv.inner = (void*)(this_arg & (~1));
9172 this_arg_conv.is_owned = false;
9173 LDKThirtyTwoBytes payment_preimage_ref;
9174 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
9175 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
9176 LDKThirtyTwoBytes payment_secret_ref;
9177 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9178 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9179 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
9183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9184 LDKChannelManager this_arg_conv;
9185 this_arg_conv.inner = (void*)(this_arg & (~1));
9186 this_arg_conv.is_owned = false;
9187 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9188 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
9192 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) {
9193 LDKChannelManager this_arg_conv;
9194 this_arg_conv.inner = (void*)(this_arg & (~1));
9195 this_arg_conv.is_owned = false;
9196 LDKOutPoint funding_txo_conv;
9197 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9198 funding_txo_conv.is_owned = false;
9199 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
9202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9203 LDKChannelManager this_arg_conv;
9204 this_arg_conv.inner = (void*)(this_arg & (~1));
9205 this_arg_conv.is_owned = false;
9206 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9207 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
9211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9212 LDKChannelManager this_arg_conv;
9213 this_arg_conv.inner = (void*)(this_arg & (~1));
9214 this_arg_conv.is_owned = false;
9215 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9216 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
9220 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) {
9221 LDKChannelManager this_arg_conv;
9222 this_arg_conv.inner = (void*)(this_arg & (~1));
9223 this_arg_conv.is_owned = false;
9224 unsigned char header_arr[80];
9225 CHECK((*env)->GetArrayLength(env, header) == 80);
9226 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9227 unsigned char (*header_ref)[80] = &header_arr;
9228 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9229 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
9230 if (txdata_constr.datalen > 0)
9231 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9233 txdata_constr.data = NULL;
9234 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
9235 for (size_t y = 0; y < txdata_constr.datalen; y++) {
9236 int64_t arr_conv_24 = txdata_vals[y];
9237 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
9238 FREE((void*)arr_conv_24);
9239 txdata_constr.data[y] = arr_conv_24_conv;
9241 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
9242 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
9246 LDKChannelManager this_arg_conv;
9247 this_arg_conv.inner = (void*)(this_arg & (~1));
9248 this_arg_conv.is_owned = false;
9249 unsigned char header_arr[80];
9250 CHECK((*env)->GetArrayLength(env, header) == 80);
9251 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9252 unsigned char (*header_ref)[80] = &header_arr;
9253 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
9256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
9257 LDKChannelManager this_arg_conv;
9258 this_arg_conv.inner = (void*)(this_arg & (~1));
9259 this_arg_conv.is_owned = false;
9260 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9261 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
9265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
9266 LDKChannelManager obj_conv;
9267 obj_conv.inner = (void*)(obj & (~1));
9268 obj_conv.is_owned = false;
9269 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
9270 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
9271 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
9272 CVec_u8Z_free(arg_var);
9276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9277 LDKChannelManagerReadArgs this_ptr_conv;
9278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9280 ChannelManagerReadArgs_free(this_ptr_conv);
9283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
9284 LDKChannelManagerReadArgs this_ptr_conv;
9285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9286 this_ptr_conv.is_owned = false;
9287 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
9291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9292 LDKChannelManagerReadArgs this_ptr_conv;
9293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9294 this_ptr_conv.is_owned = false;
9295 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
9296 if (val_conv.free == LDKKeysInterface_JCalls_free) {
9297 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9298 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
9300 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
9303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
9304 LDKChannelManagerReadArgs this_ptr_conv;
9305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9306 this_ptr_conv.is_owned = false;
9307 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
9311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9312 LDKChannelManagerReadArgs this_ptr_conv;
9313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9314 this_ptr_conv.is_owned = false;
9315 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
9316 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
9317 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9318 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
9320 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
9323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
9324 LDKChannelManagerReadArgs this_ptr_conv;
9325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9326 this_ptr_conv.is_owned = false;
9327 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
9331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9332 LDKChannelManagerReadArgs this_ptr_conv;
9333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9334 this_ptr_conv.is_owned = false;
9335 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
9336 if (val_conv.free == LDKWatch_JCalls_free) {
9337 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9338 LDKWatch_JCalls_clone(val_conv.this_arg);
9340 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
9343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
9344 LDKChannelManagerReadArgs this_ptr_conv;
9345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9346 this_ptr_conv.is_owned = false;
9347 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
9351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9352 LDKChannelManagerReadArgs this_ptr_conv;
9353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9354 this_ptr_conv.is_owned = false;
9355 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
9356 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
9357 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9358 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
9360 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
9363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
9364 LDKChannelManagerReadArgs this_ptr_conv;
9365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9366 this_ptr_conv.is_owned = false;
9367 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
9371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9372 LDKChannelManagerReadArgs this_ptr_conv;
9373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9374 this_ptr_conv.is_owned = false;
9375 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
9376 if (val_conv.free == LDKLogger_JCalls_free) {
9377 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9378 LDKLogger_JCalls_clone(val_conv.this_arg);
9380 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
9383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
9384 LDKChannelManagerReadArgs this_ptr_conv;
9385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9386 this_ptr_conv.is_owned = false;
9387 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
9388 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9389 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9390 long ret_ref = (long)ret_var.inner;
9391 if (ret_var.is_owned) {
9397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9398 LDKChannelManagerReadArgs this_ptr_conv;
9399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9400 this_ptr_conv.is_owned = false;
9401 LDKUserConfig val_conv;
9402 val_conv.inner = (void*)(val & (~1));
9403 val_conv.is_owned = (val & 1) || (val == 0);
9404 val_conv = UserConfig_clone(&val_conv);
9405 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
9408 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) {
9409 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
9410 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9411 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9412 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9414 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9415 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
9416 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9417 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
9419 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
9420 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
9421 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9422 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
9424 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
9425 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9426 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9427 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9429 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9430 if (logger_conv.free == LDKLogger_JCalls_free) {
9431 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9432 LDKLogger_JCalls_clone(logger_conv.this_arg);
9434 LDKUserConfig default_config_conv;
9435 default_config_conv.inner = (void*)(default_config & (~1));
9436 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
9437 default_config_conv = UserConfig_clone(&default_config_conv);
9438 LDKCVec_ChannelMonitorZ channel_monitors_constr;
9439 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
9440 if (channel_monitors_constr.datalen > 0)
9441 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9443 channel_monitors_constr.data = NULL;
9444 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
9445 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
9446 int64_t arr_conv_16 = channel_monitors_vals[q];
9447 LDKChannelMonitor arr_conv_16_conv;
9448 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
9449 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
9450 channel_monitors_constr.data[q] = arr_conv_16_conv;
9452 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
9453 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);
9454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9456 long ret_ref = (long)ret_var.inner;
9457 if (ret_var.is_owned) {
9463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
9465 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
9466 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
9467 LDKChannelManagerReadArgs arg_conv;
9468 arg_conv.inner = (void*)(arg & (~1));
9469 arg_conv.is_owned = (arg & 1) || (arg == 0);
9470 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
9471 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9472 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
9473 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
9474 return (long)ret_conv;
9477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9478 LDKDecodeError this_ptr_conv;
9479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9481 DecodeError_free(this_ptr_conv);
9484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9485 LDKDecodeError orig_conv;
9486 orig_conv.inner = (void*)(orig & (~1));
9487 orig_conv.is_owned = false;
9488 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
9489 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9490 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9491 long ret_ref = (long)ret_var.inner;
9492 if (ret_var.is_owned) {
9498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9499 LDKInit this_ptr_conv;
9500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9502 Init_free(this_ptr_conv);
9505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9507 orig_conv.inner = (void*)(orig & (~1));
9508 orig_conv.is_owned = false;
9509 LDKInit ret_var = Init_clone(&orig_conv);
9510 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9511 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9512 long ret_ref = (long)ret_var.inner;
9513 if (ret_var.is_owned) {
9519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9520 LDKErrorMessage this_ptr_conv;
9521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9523 ErrorMessage_free(this_ptr_conv);
9526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9527 LDKErrorMessage orig_conv;
9528 orig_conv.inner = (void*)(orig & (~1));
9529 orig_conv.is_owned = false;
9530 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
9531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9533 long ret_ref = (long)ret_var.inner;
9534 if (ret_var.is_owned) {
9540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9541 LDKErrorMessage this_ptr_conv;
9542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9543 this_ptr_conv.is_owned = false;
9544 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9545 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
9549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9550 LDKErrorMessage this_ptr_conv;
9551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9552 this_ptr_conv.is_owned = false;
9553 LDKThirtyTwoBytes val_ref;
9554 CHECK((*env)->GetArrayLength(env, val) == 32);
9555 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9556 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
9559 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
9560 LDKErrorMessage this_ptr_conv;
9561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9562 this_ptr_conv.is_owned = false;
9563 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
9564 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
9568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9569 LDKErrorMessage this_ptr_conv;
9570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9571 this_ptr_conv.is_owned = false;
9572 LDKCVec_u8Z val_ref;
9573 val_ref.datalen = (*env)->GetArrayLength(env, val);
9574 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9575 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
9576 ErrorMessage_set_data(&this_ptr_conv, val_ref);
9579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
9580 LDKThirtyTwoBytes channel_id_arg_ref;
9581 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
9582 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9583 LDKCVec_u8Z data_arg_ref;
9584 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
9585 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9586 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
9587 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
9588 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9589 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9590 long ret_ref = (long)ret_var.inner;
9591 if (ret_var.is_owned) {
9597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9598 LDKPing this_ptr_conv;
9599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9601 Ping_free(this_ptr_conv);
9604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9606 orig_conv.inner = (void*)(orig & (~1));
9607 orig_conv.is_owned = false;
9608 LDKPing ret_var = Ping_clone(&orig_conv);
9609 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9610 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9611 long ret_ref = (long)ret_var.inner;
9612 if (ret_var.is_owned) {
9618 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9619 LDKPing this_ptr_conv;
9620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9621 this_ptr_conv.is_owned = false;
9622 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
9626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9627 LDKPing this_ptr_conv;
9628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9629 this_ptr_conv.is_owned = false;
9630 Ping_set_ponglen(&this_ptr_conv, val);
9633 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9634 LDKPing this_ptr_conv;
9635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9636 this_ptr_conv.is_owned = false;
9637 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
9641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9642 LDKPing this_ptr_conv;
9643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9644 this_ptr_conv.is_owned = false;
9645 Ping_set_byteslen(&this_ptr_conv, val);
9648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
9649 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
9650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9652 long ret_ref = (long)ret_var.inner;
9653 if (ret_var.is_owned) {
9659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9660 LDKPong this_ptr_conv;
9661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9663 Pong_free(this_ptr_conv);
9666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9668 orig_conv.inner = (void*)(orig & (~1));
9669 orig_conv.is_owned = false;
9670 LDKPong ret_var = Pong_clone(&orig_conv);
9671 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9672 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9673 long ret_ref = (long)ret_var.inner;
9674 if (ret_var.is_owned) {
9680 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9681 LDKPong this_ptr_conv;
9682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9683 this_ptr_conv.is_owned = false;
9684 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
9688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9689 LDKPong this_ptr_conv;
9690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9691 this_ptr_conv.is_owned = false;
9692 Pong_set_byteslen(&this_ptr_conv, val);
9695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
9696 LDKPong ret_var = Pong_new(byteslen_arg);
9697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9699 long ret_ref = (long)ret_var.inner;
9700 if (ret_var.is_owned) {
9706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9707 LDKOpenChannel this_ptr_conv;
9708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9710 OpenChannel_free(this_ptr_conv);
9713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9714 LDKOpenChannel orig_conv;
9715 orig_conv.inner = (void*)(orig & (~1));
9716 orig_conv.is_owned = false;
9717 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
9718 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9719 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9720 long ret_ref = (long)ret_var.inner;
9721 if (ret_var.is_owned) {
9727 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
9728 LDKOpenChannel this_ptr_conv;
9729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9730 this_ptr_conv.is_owned = false;
9731 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9732 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
9736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9737 LDKOpenChannel this_ptr_conv;
9738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9739 this_ptr_conv.is_owned = false;
9740 LDKThirtyTwoBytes val_ref;
9741 CHECK((*env)->GetArrayLength(env, val) == 32);
9742 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9743 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
9746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9747 LDKOpenChannel this_ptr_conv;
9748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9749 this_ptr_conv.is_owned = false;
9750 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9751 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
9755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9756 LDKOpenChannel this_ptr_conv;
9757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9758 this_ptr_conv.is_owned = false;
9759 LDKThirtyTwoBytes val_ref;
9760 CHECK((*env)->GetArrayLength(env, val) == 32);
9761 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9762 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
9765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9766 LDKOpenChannel this_ptr_conv;
9767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9768 this_ptr_conv.is_owned = false;
9769 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
9773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9774 LDKOpenChannel this_ptr_conv;
9775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9776 this_ptr_conv.is_owned = false;
9777 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
9780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9781 LDKOpenChannel this_ptr_conv;
9782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9783 this_ptr_conv.is_owned = false;
9784 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
9788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9789 LDKOpenChannel this_ptr_conv;
9790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9791 this_ptr_conv.is_owned = false;
9792 OpenChannel_set_push_msat(&this_ptr_conv, val);
9795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9796 LDKOpenChannel this_ptr_conv;
9797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9798 this_ptr_conv.is_owned = false;
9799 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
9803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9804 LDKOpenChannel this_ptr_conv;
9805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9806 this_ptr_conv.is_owned = false;
9807 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
9810 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) {
9811 LDKOpenChannel this_ptr_conv;
9812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9813 this_ptr_conv.is_owned = false;
9814 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
9818 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) {
9819 LDKOpenChannel this_ptr_conv;
9820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9821 this_ptr_conv.is_owned = false;
9822 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9826 LDKOpenChannel this_ptr_conv;
9827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9828 this_ptr_conv.is_owned = false;
9829 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
9833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9834 LDKOpenChannel this_ptr_conv;
9835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9836 this_ptr_conv.is_owned = false;
9837 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
9840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9841 LDKOpenChannel this_ptr_conv;
9842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9843 this_ptr_conv.is_owned = false;
9844 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
9848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9849 LDKOpenChannel this_ptr_conv;
9850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9851 this_ptr_conv.is_owned = false;
9852 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
9855 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
9856 LDKOpenChannel this_ptr_conv;
9857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9858 this_ptr_conv.is_owned = false;
9859 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
9863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9864 LDKOpenChannel this_ptr_conv;
9865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9866 this_ptr_conv.is_owned = false;
9867 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
9870 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9871 LDKOpenChannel this_ptr_conv;
9872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9873 this_ptr_conv.is_owned = false;
9874 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
9878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9879 LDKOpenChannel this_ptr_conv;
9880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9881 this_ptr_conv.is_owned = false;
9882 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
9885 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
9886 LDKOpenChannel this_ptr_conv;
9887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9888 this_ptr_conv.is_owned = false;
9889 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
9893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9894 LDKOpenChannel this_ptr_conv;
9895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9896 this_ptr_conv.is_owned = false;
9897 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
9900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
9901 LDKOpenChannel this_ptr_conv;
9902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9903 this_ptr_conv.is_owned = false;
9904 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9905 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
9909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9910 LDKOpenChannel this_ptr_conv;
9911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9912 this_ptr_conv.is_owned = false;
9913 LDKPublicKey val_ref;
9914 CHECK((*env)->GetArrayLength(env, val) == 33);
9915 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
9916 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
9919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
9920 LDKOpenChannel this_ptr_conv;
9921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9922 this_ptr_conv.is_owned = false;
9923 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9924 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
9928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9929 LDKOpenChannel this_ptr_conv;
9930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9931 this_ptr_conv.is_owned = false;
9932 LDKPublicKey val_ref;
9933 CHECK((*env)->GetArrayLength(env, val) == 33);
9934 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
9935 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
9938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
9939 LDKOpenChannel this_ptr_conv;
9940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9941 this_ptr_conv.is_owned = false;
9942 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9943 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
9947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9948 LDKOpenChannel this_ptr_conv;
9949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9950 this_ptr_conv.is_owned = false;
9951 LDKPublicKey val_ref;
9952 CHECK((*env)->GetArrayLength(env, val) == 33);
9953 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
9954 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
9957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
9958 LDKOpenChannel this_ptr_conv;
9959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9960 this_ptr_conv.is_owned = false;
9961 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9962 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
9966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9967 LDKOpenChannel this_ptr_conv;
9968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9969 this_ptr_conv.is_owned = false;
9970 LDKPublicKey val_ref;
9971 CHECK((*env)->GetArrayLength(env, val) == 33);
9972 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
9973 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
9976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
9977 LDKOpenChannel this_ptr_conv;
9978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9979 this_ptr_conv.is_owned = false;
9980 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9981 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
9985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9986 LDKOpenChannel this_ptr_conv;
9987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9988 this_ptr_conv.is_owned = false;
9989 LDKPublicKey val_ref;
9990 CHECK((*env)->GetArrayLength(env, val) == 33);
9991 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
9992 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
9995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
9996 LDKOpenChannel this_ptr_conv;
9997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9998 this_ptr_conv.is_owned = false;
9999 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10000 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10004 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) {
10005 LDKOpenChannel this_ptr_conv;
10006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10007 this_ptr_conv.is_owned = false;
10008 LDKPublicKey val_ref;
10009 CHECK((*env)->GetArrayLength(env, val) == 33);
10010 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10011 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10014 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
10015 LDKOpenChannel this_ptr_conv;
10016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10017 this_ptr_conv.is_owned = false;
10018 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
10022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
10023 LDKOpenChannel this_ptr_conv;
10024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10025 this_ptr_conv.is_owned = false;
10026 OpenChannel_set_channel_flags(&this_ptr_conv, val);
10029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10030 LDKAcceptChannel this_ptr_conv;
10031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10033 AcceptChannel_free(this_ptr_conv);
10036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10037 LDKAcceptChannel orig_conv;
10038 orig_conv.inner = (void*)(orig & (~1));
10039 orig_conv.is_owned = false;
10040 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
10041 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10042 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10043 long ret_ref = (long)ret_var.inner;
10044 if (ret_var.is_owned) {
10050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10051 LDKAcceptChannel this_ptr_conv;
10052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10053 this_ptr_conv.is_owned = false;
10054 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10055 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
10059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10060 LDKAcceptChannel this_ptr_conv;
10061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10062 this_ptr_conv.is_owned = false;
10063 LDKThirtyTwoBytes val_ref;
10064 CHECK((*env)->GetArrayLength(env, val) == 32);
10065 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10066 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
10069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10070 LDKAcceptChannel this_ptr_conv;
10071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10072 this_ptr_conv.is_owned = false;
10073 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
10077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10078 LDKAcceptChannel this_ptr_conv;
10079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10080 this_ptr_conv.is_owned = false;
10081 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
10084 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) {
10085 LDKAcceptChannel this_ptr_conv;
10086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10087 this_ptr_conv.is_owned = false;
10088 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
10092 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) {
10093 LDKAcceptChannel this_ptr_conv;
10094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10095 this_ptr_conv.is_owned = false;
10096 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10100 LDKAcceptChannel this_ptr_conv;
10101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10102 this_ptr_conv.is_owned = false;
10103 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
10107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10108 LDKAcceptChannel this_ptr_conv;
10109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10110 this_ptr_conv.is_owned = false;
10111 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
10114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10115 LDKAcceptChannel this_ptr_conv;
10116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10117 this_ptr_conv.is_owned = false;
10118 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
10122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10123 LDKAcceptChannel this_ptr_conv;
10124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10125 this_ptr_conv.is_owned = false;
10126 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
10129 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
10130 LDKAcceptChannel this_ptr_conv;
10131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10132 this_ptr_conv.is_owned = false;
10133 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
10137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10138 LDKAcceptChannel this_ptr_conv;
10139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10140 this_ptr_conv.is_owned = false;
10141 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
10144 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10145 LDKAcceptChannel this_ptr_conv;
10146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10147 this_ptr_conv.is_owned = false;
10148 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
10152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10153 LDKAcceptChannel this_ptr_conv;
10154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10155 this_ptr_conv.is_owned = false;
10156 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
10159 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
10160 LDKAcceptChannel this_ptr_conv;
10161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10162 this_ptr_conv.is_owned = false;
10163 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
10167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10168 LDKAcceptChannel this_ptr_conv;
10169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10170 this_ptr_conv.is_owned = false;
10171 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
10174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10175 LDKAcceptChannel this_ptr_conv;
10176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10177 this_ptr_conv.is_owned = false;
10178 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10179 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
10183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10184 LDKAcceptChannel this_ptr_conv;
10185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10186 this_ptr_conv.is_owned = false;
10187 LDKPublicKey val_ref;
10188 CHECK((*env)->GetArrayLength(env, val) == 33);
10189 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10190 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
10193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10194 LDKAcceptChannel this_ptr_conv;
10195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10196 this_ptr_conv.is_owned = false;
10197 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10198 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10203 LDKAcceptChannel this_ptr_conv;
10204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10205 this_ptr_conv.is_owned = false;
10206 LDKPublicKey val_ref;
10207 CHECK((*env)->GetArrayLength(env, val) == 33);
10208 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10209 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
10212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10213 LDKAcceptChannel this_ptr_conv;
10214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10215 this_ptr_conv.is_owned = false;
10216 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10217 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
10221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10222 LDKAcceptChannel this_ptr_conv;
10223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10224 this_ptr_conv.is_owned = false;
10225 LDKPublicKey val_ref;
10226 CHECK((*env)->GetArrayLength(env, val) == 33);
10227 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10228 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
10231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10232 LDKAcceptChannel this_ptr_conv;
10233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10234 this_ptr_conv.is_owned = false;
10235 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10236 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10241 LDKAcceptChannel this_ptr_conv;
10242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10243 this_ptr_conv.is_owned = false;
10244 LDKPublicKey val_ref;
10245 CHECK((*env)->GetArrayLength(env, val) == 33);
10246 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10247 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10251 LDKAcceptChannel this_ptr_conv;
10252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10253 this_ptr_conv.is_owned = false;
10254 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10255 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10260 LDKAcceptChannel this_ptr_conv;
10261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10262 this_ptr_conv.is_owned = false;
10263 LDKPublicKey val_ref;
10264 CHECK((*env)->GetArrayLength(env, val) == 33);
10265 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10266 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10270 LDKAcceptChannel this_ptr_conv;
10271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10272 this_ptr_conv.is_owned = false;
10273 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10274 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10278 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) {
10279 LDKAcceptChannel this_ptr_conv;
10280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10281 this_ptr_conv.is_owned = false;
10282 LDKPublicKey val_ref;
10283 CHECK((*env)->GetArrayLength(env, val) == 33);
10284 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10285 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10289 LDKFundingCreated this_ptr_conv;
10290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10292 FundingCreated_free(this_ptr_conv);
10295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10296 LDKFundingCreated orig_conv;
10297 orig_conv.inner = (void*)(orig & (~1));
10298 orig_conv.is_owned = false;
10299 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
10300 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10301 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10302 long ret_ref = (long)ret_var.inner;
10303 if (ret_var.is_owned) {
10309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10310 LDKFundingCreated this_ptr_conv;
10311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10312 this_ptr_conv.is_owned = false;
10313 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10314 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
10318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10319 LDKFundingCreated this_ptr_conv;
10320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10321 this_ptr_conv.is_owned = false;
10322 LDKThirtyTwoBytes val_ref;
10323 CHECK((*env)->GetArrayLength(env, val) == 32);
10324 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10325 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
10328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
10329 LDKFundingCreated this_ptr_conv;
10330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10331 this_ptr_conv.is_owned = false;
10332 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10333 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
10337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10338 LDKFundingCreated this_ptr_conv;
10339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10340 this_ptr_conv.is_owned = false;
10341 LDKThirtyTwoBytes val_ref;
10342 CHECK((*env)->GetArrayLength(env, val) == 32);
10343 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10344 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
10347 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
10348 LDKFundingCreated this_ptr_conv;
10349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10350 this_ptr_conv.is_owned = false;
10351 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
10355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10356 LDKFundingCreated this_ptr_conv;
10357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10358 this_ptr_conv.is_owned = false;
10359 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
10362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10363 LDKFundingCreated this_ptr_conv;
10364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10365 this_ptr_conv.is_owned = false;
10366 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10367 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
10371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10372 LDKFundingCreated this_ptr_conv;
10373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10374 this_ptr_conv.is_owned = false;
10375 LDKSignature val_ref;
10376 CHECK((*env)->GetArrayLength(env, val) == 64);
10377 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10378 FundingCreated_set_signature(&this_ptr_conv, val_ref);
10381 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) {
10382 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
10383 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
10384 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
10385 LDKThirtyTwoBytes funding_txid_arg_ref;
10386 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
10387 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
10388 LDKSignature signature_arg_ref;
10389 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10390 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10391 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
10392 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10393 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10394 long ret_ref = (long)ret_var.inner;
10395 if (ret_var.is_owned) {
10401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10402 LDKFundingSigned this_ptr_conv;
10403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10405 FundingSigned_free(this_ptr_conv);
10408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10409 LDKFundingSigned orig_conv;
10410 orig_conv.inner = (void*)(orig & (~1));
10411 orig_conv.is_owned = false;
10412 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
10413 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10414 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10415 long ret_ref = (long)ret_var.inner;
10416 if (ret_var.is_owned) {
10422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10423 LDKFundingSigned this_ptr_conv;
10424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10425 this_ptr_conv.is_owned = false;
10426 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10427 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
10431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10432 LDKFundingSigned this_ptr_conv;
10433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10434 this_ptr_conv.is_owned = false;
10435 LDKThirtyTwoBytes val_ref;
10436 CHECK((*env)->GetArrayLength(env, val) == 32);
10437 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10438 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
10441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10442 LDKFundingSigned this_ptr_conv;
10443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10444 this_ptr_conv.is_owned = false;
10445 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10446 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
10450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10451 LDKFundingSigned this_ptr_conv;
10452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10453 this_ptr_conv.is_owned = false;
10454 LDKSignature val_ref;
10455 CHECK((*env)->GetArrayLength(env, val) == 64);
10456 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10457 FundingSigned_set_signature(&this_ptr_conv, val_ref);
10460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
10461 LDKThirtyTwoBytes channel_id_arg_ref;
10462 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10463 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10464 LDKSignature signature_arg_ref;
10465 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10466 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10467 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
10468 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10469 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10470 long ret_ref = (long)ret_var.inner;
10471 if (ret_var.is_owned) {
10477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10478 LDKFundingLocked this_ptr_conv;
10479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10481 FundingLocked_free(this_ptr_conv);
10484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10485 LDKFundingLocked orig_conv;
10486 orig_conv.inner = (void*)(orig & (~1));
10487 orig_conv.is_owned = false;
10488 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
10489 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10490 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10491 long ret_ref = (long)ret_var.inner;
10492 if (ret_var.is_owned) {
10498 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10499 LDKFundingLocked this_ptr_conv;
10500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10501 this_ptr_conv.is_owned = false;
10502 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10503 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
10507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10508 LDKFundingLocked this_ptr_conv;
10509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10510 this_ptr_conv.is_owned = false;
10511 LDKThirtyTwoBytes val_ref;
10512 CHECK((*env)->GetArrayLength(env, val) == 32);
10513 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10514 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
10517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10518 LDKFundingLocked this_ptr_conv;
10519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10520 this_ptr_conv.is_owned = false;
10521 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10522 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
10526 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) {
10527 LDKFundingLocked this_ptr_conv;
10528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10529 this_ptr_conv.is_owned = false;
10530 LDKPublicKey val_ref;
10531 CHECK((*env)->GetArrayLength(env, val) == 33);
10532 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10533 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
10536 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) {
10537 LDKThirtyTwoBytes channel_id_arg_ref;
10538 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10539 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10540 LDKPublicKey next_per_commitment_point_arg_ref;
10541 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
10542 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
10543 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
10544 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10545 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10546 long ret_ref = (long)ret_var.inner;
10547 if (ret_var.is_owned) {
10553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10554 LDKShutdown this_ptr_conv;
10555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10557 Shutdown_free(this_ptr_conv);
10560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10561 LDKShutdown orig_conv;
10562 orig_conv.inner = (void*)(orig & (~1));
10563 orig_conv.is_owned = false;
10564 LDKShutdown ret_var = Shutdown_clone(&orig_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 int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10575 LDKShutdown this_ptr_conv;
10576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10577 this_ptr_conv.is_owned = false;
10578 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10579 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
10583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10584 LDKShutdown this_ptr_conv;
10585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10586 this_ptr_conv.is_owned = false;
10587 LDKThirtyTwoBytes val_ref;
10588 CHECK((*env)->GetArrayLength(env, val) == 32);
10589 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10590 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
10593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10594 LDKShutdown this_ptr_conv;
10595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10596 this_ptr_conv.is_owned = false;
10597 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
10598 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10599 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10604 LDKShutdown this_ptr_conv;
10605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10606 this_ptr_conv.is_owned = false;
10607 LDKCVec_u8Z val_ref;
10608 val_ref.datalen = (*env)->GetArrayLength(env, val);
10609 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
10610 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
10611 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
10614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
10615 LDKThirtyTwoBytes channel_id_arg_ref;
10616 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10617 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10618 LDKCVec_u8Z scriptpubkey_arg_ref;
10619 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
10620 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
10621 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
10622 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
10623 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10624 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10625 long ret_ref = (long)ret_var.inner;
10626 if (ret_var.is_owned) {
10632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10633 LDKClosingSigned this_ptr_conv;
10634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10636 ClosingSigned_free(this_ptr_conv);
10639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10640 LDKClosingSigned orig_conv;
10641 orig_conv.inner = (void*)(orig & (~1));
10642 orig_conv.is_owned = false;
10643 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
10644 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10645 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10646 long ret_ref = (long)ret_var.inner;
10647 if (ret_var.is_owned) {
10653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10654 LDKClosingSigned this_ptr_conv;
10655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10656 this_ptr_conv.is_owned = false;
10657 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10658 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
10662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10663 LDKClosingSigned this_ptr_conv;
10664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10665 this_ptr_conv.is_owned = false;
10666 LDKThirtyTwoBytes val_ref;
10667 CHECK((*env)->GetArrayLength(env, val) == 32);
10668 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10669 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
10672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10673 LDKClosingSigned this_ptr_conv;
10674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10675 this_ptr_conv.is_owned = false;
10676 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
10680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10681 LDKClosingSigned this_ptr_conv;
10682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10683 this_ptr_conv.is_owned = false;
10684 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
10687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10688 LDKClosingSigned this_ptr_conv;
10689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10690 this_ptr_conv.is_owned = false;
10691 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10692 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
10696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10697 LDKClosingSigned this_ptr_conv;
10698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10699 this_ptr_conv.is_owned = false;
10700 LDKSignature val_ref;
10701 CHECK((*env)->GetArrayLength(env, val) == 64);
10702 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10703 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
10706 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) {
10707 LDKThirtyTwoBytes channel_id_arg_ref;
10708 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10709 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10710 LDKSignature signature_arg_ref;
10711 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10712 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10713 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
10714 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10715 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10716 long ret_ref = (long)ret_var.inner;
10717 if (ret_var.is_owned) {
10723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10724 LDKUpdateAddHTLC this_ptr_conv;
10725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10726 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10727 UpdateAddHTLC_free(this_ptr_conv);
10730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10731 LDKUpdateAddHTLC orig_conv;
10732 orig_conv.inner = (void*)(orig & (~1));
10733 orig_conv.is_owned = false;
10734 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
10735 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10736 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10737 long ret_ref = (long)ret_var.inner;
10738 if (ret_var.is_owned) {
10744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10745 LDKUpdateAddHTLC this_ptr_conv;
10746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10747 this_ptr_conv.is_owned = false;
10748 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10749 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
10753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10754 LDKUpdateAddHTLC this_ptr_conv;
10755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10756 this_ptr_conv.is_owned = false;
10757 LDKThirtyTwoBytes val_ref;
10758 CHECK((*env)->GetArrayLength(env, val) == 32);
10759 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10760 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
10763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10764 LDKUpdateAddHTLC this_ptr_conv;
10765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10766 this_ptr_conv.is_owned = false;
10767 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
10771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10772 LDKUpdateAddHTLC this_ptr_conv;
10773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10774 this_ptr_conv.is_owned = false;
10775 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
10778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10779 LDKUpdateAddHTLC this_ptr_conv;
10780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10781 this_ptr_conv.is_owned = false;
10782 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
10786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10787 LDKUpdateAddHTLC this_ptr_conv;
10788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10789 this_ptr_conv.is_owned = false;
10790 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
10793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
10794 LDKUpdateAddHTLC this_ptr_conv;
10795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10796 this_ptr_conv.is_owned = false;
10797 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10798 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
10802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10803 LDKUpdateAddHTLC this_ptr_conv;
10804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10805 this_ptr_conv.is_owned = false;
10806 LDKThirtyTwoBytes val_ref;
10807 CHECK((*env)->GetArrayLength(env, val) == 32);
10808 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10809 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
10812 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
10813 LDKUpdateAddHTLC this_ptr_conv;
10814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10815 this_ptr_conv.is_owned = false;
10816 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
10820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10821 LDKUpdateAddHTLC this_ptr_conv;
10822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10823 this_ptr_conv.is_owned = false;
10824 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
10827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10828 LDKUpdateFulfillHTLC this_ptr_conv;
10829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10831 UpdateFulfillHTLC_free(this_ptr_conv);
10834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10835 LDKUpdateFulfillHTLC orig_conv;
10836 orig_conv.inner = (void*)(orig & (~1));
10837 orig_conv.is_owned = false;
10838 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
10839 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10840 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10841 long ret_ref = (long)ret_var.inner;
10842 if (ret_var.is_owned) {
10848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10849 LDKUpdateFulfillHTLC this_ptr_conv;
10850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10851 this_ptr_conv.is_owned = false;
10852 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10853 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
10857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10858 LDKUpdateFulfillHTLC this_ptr_conv;
10859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10860 this_ptr_conv.is_owned = false;
10861 LDKThirtyTwoBytes val_ref;
10862 CHECK((*env)->GetArrayLength(env, val) == 32);
10863 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10864 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
10867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10868 LDKUpdateFulfillHTLC this_ptr_conv;
10869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10870 this_ptr_conv.is_owned = false;
10871 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
10875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10876 LDKUpdateFulfillHTLC this_ptr_conv;
10877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10878 this_ptr_conv.is_owned = false;
10879 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
10882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
10883 LDKUpdateFulfillHTLC this_ptr_conv;
10884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10885 this_ptr_conv.is_owned = false;
10886 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10887 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
10891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10892 LDKUpdateFulfillHTLC this_ptr_conv;
10893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10894 this_ptr_conv.is_owned = false;
10895 LDKThirtyTwoBytes val_ref;
10896 CHECK((*env)->GetArrayLength(env, val) == 32);
10897 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10898 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
10901 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) {
10902 LDKThirtyTwoBytes channel_id_arg_ref;
10903 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10904 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10905 LDKThirtyTwoBytes payment_preimage_arg_ref;
10906 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
10907 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
10908 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
10909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10911 long ret_ref = (long)ret_var.inner;
10912 if (ret_var.is_owned) {
10918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10919 LDKUpdateFailHTLC this_ptr_conv;
10920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10922 UpdateFailHTLC_free(this_ptr_conv);
10925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10926 LDKUpdateFailHTLC orig_conv;
10927 orig_conv.inner = (void*)(orig & (~1));
10928 orig_conv.is_owned = false;
10929 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
10930 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10931 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10932 long ret_ref = (long)ret_var.inner;
10933 if (ret_var.is_owned) {
10939 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10940 LDKUpdateFailHTLC this_ptr_conv;
10941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10942 this_ptr_conv.is_owned = false;
10943 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10944 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
10948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10949 LDKUpdateFailHTLC this_ptr_conv;
10950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10951 this_ptr_conv.is_owned = false;
10952 LDKThirtyTwoBytes val_ref;
10953 CHECK((*env)->GetArrayLength(env, val) == 32);
10954 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10955 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
10958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10959 LDKUpdateFailHTLC this_ptr_conv;
10960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10961 this_ptr_conv.is_owned = false;
10962 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
10966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10967 LDKUpdateFailHTLC this_ptr_conv;
10968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10969 this_ptr_conv.is_owned = false;
10970 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
10973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10974 LDKUpdateFailMalformedHTLC this_ptr_conv;
10975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10976 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10977 UpdateFailMalformedHTLC_free(this_ptr_conv);
10980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10981 LDKUpdateFailMalformedHTLC orig_conv;
10982 orig_conv.inner = (void*)(orig & (~1));
10983 orig_conv.is_owned = false;
10984 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
10985 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10986 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10987 long ret_ref = (long)ret_var.inner;
10988 if (ret_var.is_owned) {
10994 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10995 LDKUpdateFailMalformedHTLC this_ptr_conv;
10996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10997 this_ptr_conv.is_owned = false;
10998 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10999 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
11003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11004 LDKUpdateFailMalformedHTLC this_ptr_conv;
11005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11006 this_ptr_conv.is_owned = false;
11007 LDKThirtyTwoBytes val_ref;
11008 CHECK((*env)->GetArrayLength(env, val) == 32);
11009 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11010 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
11013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11014 LDKUpdateFailMalformedHTLC this_ptr_conv;
11015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11016 this_ptr_conv.is_owned = false;
11017 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
11021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11022 LDKUpdateFailMalformedHTLC this_ptr_conv;
11023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11024 this_ptr_conv.is_owned = false;
11025 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
11028 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
11029 LDKUpdateFailMalformedHTLC this_ptr_conv;
11030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11031 this_ptr_conv.is_owned = false;
11032 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
11036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11037 LDKUpdateFailMalformedHTLC this_ptr_conv;
11038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11039 this_ptr_conv.is_owned = false;
11040 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
11043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11044 LDKCommitmentSigned this_ptr_conv;
11045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11047 CommitmentSigned_free(this_ptr_conv);
11050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11051 LDKCommitmentSigned orig_conv;
11052 orig_conv.inner = (void*)(orig & (~1));
11053 orig_conv.is_owned = false;
11054 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
11055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11057 long ret_ref = (long)ret_var.inner;
11058 if (ret_var.is_owned) {
11064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11065 LDKCommitmentSigned this_ptr_conv;
11066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11067 this_ptr_conv.is_owned = false;
11068 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11069 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
11073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11074 LDKCommitmentSigned this_ptr_conv;
11075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11076 this_ptr_conv.is_owned = false;
11077 LDKThirtyTwoBytes val_ref;
11078 CHECK((*env)->GetArrayLength(env, val) == 32);
11079 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11080 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
11083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11084 LDKCommitmentSigned this_ptr_conv;
11085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11086 this_ptr_conv.is_owned = false;
11087 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11088 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
11092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11093 LDKCommitmentSigned this_ptr_conv;
11094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11095 this_ptr_conv.is_owned = false;
11096 LDKSignature val_ref;
11097 CHECK((*env)->GetArrayLength(env, val) == 64);
11098 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11099 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
11102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
11103 LDKCommitmentSigned this_ptr_conv;
11104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11105 this_ptr_conv.is_owned = false;
11106 LDKCVec_SignatureZ val_constr;
11107 val_constr.datalen = (*env)->GetArrayLength(env, val);
11108 if (val_constr.datalen > 0)
11109 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11111 val_constr.data = NULL;
11112 for (size_t i = 0; i < val_constr.datalen; i++) {
11113 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
11114 LDKSignature arr_conv_8_ref;
11115 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
11116 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11117 val_constr.data[i] = arr_conv_8_ref;
11119 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
11122 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) {
11123 LDKThirtyTwoBytes channel_id_arg_ref;
11124 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11125 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11126 LDKSignature signature_arg_ref;
11127 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
11128 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11129 LDKCVec_SignatureZ htlc_signatures_arg_constr;
11130 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
11131 if (htlc_signatures_arg_constr.datalen > 0)
11132 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11134 htlc_signatures_arg_constr.data = NULL;
11135 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
11136 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
11137 LDKSignature arr_conv_8_ref;
11138 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
11139 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11140 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
11142 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
11143 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11144 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11145 long ret_ref = (long)ret_var.inner;
11146 if (ret_var.is_owned) {
11152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11153 LDKRevokeAndACK this_ptr_conv;
11154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11156 RevokeAndACK_free(this_ptr_conv);
11159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11160 LDKRevokeAndACK orig_conv;
11161 orig_conv.inner = (void*)(orig & (~1));
11162 orig_conv.is_owned = false;
11163 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
11164 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11165 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11166 long ret_ref = (long)ret_var.inner;
11167 if (ret_var.is_owned) {
11173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11174 LDKRevokeAndACK this_ptr_conv;
11175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11176 this_ptr_conv.is_owned = false;
11177 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11178 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
11182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11183 LDKRevokeAndACK this_ptr_conv;
11184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11185 this_ptr_conv.is_owned = false;
11186 LDKThirtyTwoBytes val_ref;
11187 CHECK((*env)->GetArrayLength(env, val) == 32);
11188 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11189 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
11192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
11193 LDKRevokeAndACK this_ptr_conv;
11194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11195 this_ptr_conv.is_owned = false;
11196 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11197 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
11201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11202 LDKRevokeAndACK this_ptr_conv;
11203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11204 this_ptr_conv.is_owned = false;
11205 LDKThirtyTwoBytes val_ref;
11206 CHECK((*env)->GetArrayLength(env, val) == 32);
11207 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11208 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
11211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11212 LDKRevokeAndACK this_ptr_conv;
11213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11214 this_ptr_conv.is_owned = false;
11215 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11216 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
11220 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) {
11221 LDKRevokeAndACK this_ptr_conv;
11222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11223 this_ptr_conv.is_owned = false;
11224 LDKPublicKey val_ref;
11225 CHECK((*env)->GetArrayLength(env, val) == 33);
11226 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11227 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
11230 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) {
11231 LDKThirtyTwoBytes channel_id_arg_ref;
11232 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11233 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11234 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
11235 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
11236 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
11237 LDKPublicKey next_per_commitment_point_arg_ref;
11238 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
11239 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
11240 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
11241 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11242 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11243 long ret_ref = (long)ret_var.inner;
11244 if (ret_var.is_owned) {
11250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11251 LDKUpdateFee this_ptr_conv;
11252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11254 UpdateFee_free(this_ptr_conv);
11257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11258 LDKUpdateFee orig_conv;
11259 orig_conv.inner = (void*)(orig & (~1));
11260 orig_conv.is_owned = false;
11261 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
11262 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11263 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11264 long ret_ref = (long)ret_var.inner;
11265 if (ret_var.is_owned) {
11271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11272 LDKUpdateFee this_ptr_conv;
11273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11274 this_ptr_conv.is_owned = false;
11275 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11276 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
11280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11281 LDKUpdateFee this_ptr_conv;
11282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11283 this_ptr_conv.is_owned = false;
11284 LDKThirtyTwoBytes val_ref;
11285 CHECK((*env)->GetArrayLength(env, val) == 32);
11286 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11287 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
11290 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
11291 LDKUpdateFee this_ptr_conv;
11292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11293 this_ptr_conv.is_owned = false;
11294 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
11298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11299 LDKUpdateFee this_ptr_conv;
11300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11301 this_ptr_conv.is_owned = false;
11302 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
11305 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) {
11306 LDKThirtyTwoBytes channel_id_arg_ref;
11307 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11308 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11309 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
11310 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11311 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11312 long ret_ref = (long)ret_var.inner;
11313 if (ret_var.is_owned) {
11319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11320 LDKDataLossProtect this_ptr_conv;
11321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11322 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11323 DataLossProtect_free(this_ptr_conv);
11326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11327 LDKDataLossProtect orig_conv;
11328 orig_conv.inner = (void*)(orig & (~1));
11329 orig_conv.is_owned = false;
11330 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
11331 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11332 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11333 long ret_ref = (long)ret_var.inner;
11334 if (ret_var.is_owned) {
11340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
11341 LDKDataLossProtect this_ptr_conv;
11342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11343 this_ptr_conv.is_owned = false;
11344 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11345 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
11349 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) {
11350 LDKDataLossProtect this_ptr_conv;
11351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11352 this_ptr_conv.is_owned = false;
11353 LDKThirtyTwoBytes val_ref;
11354 CHECK((*env)->GetArrayLength(env, val) == 32);
11355 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11356 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
11359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11360 LDKDataLossProtect this_ptr_conv;
11361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11362 this_ptr_conv.is_owned = false;
11363 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11364 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
11368 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) {
11369 LDKDataLossProtect this_ptr_conv;
11370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11371 this_ptr_conv.is_owned = false;
11372 LDKPublicKey val_ref;
11373 CHECK((*env)->GetArrayLength(env, val) == 33);
11374 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11375 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
11378 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) {
11379 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
11380 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
11381 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
11382 LDKPublicKey my_current_per_commitment_point_arg_ref;
11383 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
11384 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
11385 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
11386 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11387 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11388 long ret_ref = (long)ret_var.inner;
11389 if (ret_var.is_owned) {
11395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11396 LDKChannelReestablish this_ptr_conv;
11397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11399 ChannelReestablish_free(this_ptr_conv);
11402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11403 LDKChannelReestablish orig_conv;
11404 orig_conv.inner = (void*)(orig & (~1));
11405 orig_conv.is_owned = false;
11406 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
11407 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11408 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11409 long ret_ref = (long)ret_var.inner;
11410 if (ret_var.is_owned) {
11416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11417 LDKChannelReestablish this_ptr_conv;
11418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11419 this_ptr_conv.is_owned = false;
11420 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11421 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
11425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11426 LDKChannelReestablish this_ptr_conv;
11427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11428 this_ptr_conv.is_owned = false;
11429 LDKThirtyTwoBytes val_ref;
11430 CHECK((*env)->GetArrayLength(env, val) == 32);
11431 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11432 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
11435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
11436 LDKChannelReestablish this_ptr_conv;
11437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11438 this_ptr_conv.is_owned = false;
11439 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
11443 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) {
11444 LDKChannelReestablish this_ptr_conv;
11445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11446 this_ptr_conv.is_owned = false;
11447 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
11450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
11451 LDKChannelReestablish this_ptr_conv;
11452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11453 this_ptr_conv.is_owned = false;
11454 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
11458 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) {
11459 LDKChannelReestablish this_ptr_conv;
11460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11461 this_ptr_conv.is_owned = false;
11462 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
11465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11466 LDKAnnouncementSignatures this_ptr_conv;
11467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11469 AnnouncementSignatures_free(this_ptr_conv);
11472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11473 LDKAnnouncementSignatures orig_conv;
11474 orig_conv.inner = (void*)(orig & (~1));
11475 orig_conv.is_owned = false;
11476 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
11477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11479 long ret_ref = (long)ret_var.inner;
11480 if (ret_var.is_owned) {
11486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11487 LDKAnnouncementSignatures this_ptr_conv;
11488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11489 this_ptr_conv.is_owned = false;
11490 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11491 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
11495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11496 LDKAnnouncementSignatures this_ptr_conv;
11497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11498 this_ptr_conv.is_owned = false;
11499 LDKThirtyTwoBytes val_ref;
11500 CHECK((*env)->GetArrayLength(env, val) == 32);
11501 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11502 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
11505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11506 LDKAnnouncementSignatures this_ptr_conv;
11507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11508 this_ptr_conv.is_owned = false;
11509 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
11513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11514 LDKAnnouncementSignatures this_ptr_conv;
11515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11516 this_ptr_conv.is_owned = false;
11517 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
11520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11521 LDKAnnouncementSignatures this_ptr_conv;
11522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11523 this_ptr_conv.is_owned = false;
11524 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11525 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
11529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11530 LDKAnnouncementSignatures this_ptr_conv;
11531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11532 this_ptr_conv.is_owned = false;
11533 LDKSignature val_ref;
11534 CHECK((*env)->GetArrayLength(env, val) == 64);
11535 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11536 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
11539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11540 LDKAnnouncementSignatures this_ptr_conv;
11541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11542 this_ptr_conv.is_owned = false;
11543 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11544 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
11548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11549 LDKAnnouncementSignatures this_ptr_conv;
11550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11551 this_ptr_conv.is_owned = false;
11552 LDKSignature val_ref;
11553 CHECK((*env)->GetArrayLength(env, val) == 64);
11554 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11555 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
11558 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) {
11559 LDKThirtyTwoBytes channel_id_arg_ref;
11560 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11561 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11562 LDKSignature node_signature_arg_ref;
11563 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
11564 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
11565 LDKSignature bitcoin_signature_arg_ref;
11566 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
11567 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
11568 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
11569 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11570 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11571 long ret_ref = (long)ret_var.inner;
11572 if (ret_var.is_owned) {
11578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11579 if ((this_ptr & 1) != 0) return;
11580 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
11581 FREE((void*)this_ptr);
11582 NetAddress_free(this_ptr_conv);
11585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11586 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
11587 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
11588 *ret_copy = NetAddress_clone(orig_conv);
11589 long ret_ref = (long)ret_copy;
11593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
11594 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
11595 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
11596 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
11597 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
11598 CVec_u8Z_free(arg_var);
11602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11603 LDKu8slice ser_ref;
11604 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11605 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11606 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11607 *ret_conv = Result_read(ser_ref);
11608 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11609 return (long)ret_conv;
11612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11613 LDKUnsignedNodeAnnouncement this_ptr_conv;
11614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11616 UnsignedNodeAnnouncement_free(this_ptr_conv);
11619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11620 LDKUnsignedNodeAnnouncement orig_conv;
11621 orig_conv.inner = (void*)(orig & (~1));
11622 orig_conv.is_owned = false;
11623 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
11624 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11625 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11626 long ret_ref = (long)ret_var.inner;
11627 if (ret_var.is_owned) {
11633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11634 LDKUnsignedNodeAnnouncement this_ptr_conv;
11635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11636 this_ptr_conv.is_owned = false;
11637 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
11638 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11639 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11640 long ret_ref = (long)ret_var.inner;
11641 if (ret_var.is_owned) {
11647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11648 LDKUnsignedNodeAnnouncement this_ptr_conv;
11649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11650 this_ptr_conv.is_owned = false;
11651 LDKNodeFeatures val_conv;
11652 val_conv.inner = (void*)(val & (~1));
11653 val_conv.is_owned = (val & 1) || (val == 0);
11654 // Warning: we need a move here but no clone is available for LDKNodeFeatures
11655 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
11658 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
11659 LDKUnsignedNodeAnnouncement this_ptr_conv;
11660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11661 this_ptr_conv.is_owned = false;
11662 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
11666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11667 LDKUnsignedNodeAnnouncement this_ptr_conv;
11668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11669 this_ptr_conv.is_owned = false;
11670 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
11673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11674 LDKUnsignedNodeAnnouncement this_ptr_conv;
11675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11676 this_ptr_conv.is_owned = false;
11677 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11678 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
11682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11683 LDKUnsignedNodeAnnouncement this_ptr_conv;
11684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11685 this_ptr_conv.is_owned = false;
11686 LDKPublicKey val_ref;
11687 CHECK((*env)->GetArrayLength(env, val) == 33);
11688 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11689 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
11692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
11693 LDKUnsignedNodeAnnouncement this_ptr_conv;
11694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11695 this_ptr_conv.is_owned = false;
11696 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
11697 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
11701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11702 LDKUnsignedNodeAnnouncement this_ptr_conv;
11703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11704 this_ptr_conv.is_owned = false;
11705 LDKThreeBytes val_ref;
11706 CHECK((*env)->GetArrayLength(env, val) == 3);
11707 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
11708 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
11711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
11712 LDKUnsignedNodeAnnouncement this_ptr_conv;
11713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11714 this_ptr_conv.is_owned = false;
11715 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11716 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
11720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11721 LDKUnsignedNodeAnnouncement this_ptr_conv;
11722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11723 this_ptr_conv.is_owned = false;
11724 LDKThirtyTwoBytes val_ref;
11725 CHECK((*env)->GetArrayLength(env, val) == 32);
11726 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11727 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
11730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
11731 LDKUnsignedNodeAnnouncement this_ptr_conv;
11732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11733 this_ptr_conv.is_owned = false;
11734 LDKCVec_NetAddressZ val_constr;
11735 val_constr.datalen = (*env)->GetArrayLength(env, val);
11736 if (val_constr.datalen > 0)
11737 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11739 val_constr.data = NULL;
11740 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
11741 for (size_t m = 0; m < val_constr.datalen; m++) {
11742 int64_t arr_conv_12 = val_vals[m];
11743 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
11744 FREE((void*)arr_conv_12);
11745 val_constr.data[m] = arr_conv_12_conv;
11747 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
11748 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
11751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11752 LDKNodeAnnouncement this_ptr_conv;
11753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11755 NodeAnnouncement_free(this_ptr_conv);
11758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11759 LDKNodeAnnouncement orig_conv;
11760 orig_conv.inner = (void*)(orig & (~1));
11761 orig_conv.is_owned = false;
11762 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
11763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11765 long ret_ref = (long)ret_var.inner;
11766 if (ret_var.is_owned) {
11772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11773 LDKNodeAnnouncement this_ptr_conv;
11774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11775 this_ptr_conv.is_owned = false;
11776 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11777 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
11781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11782 LDKNodeAnnouncement this_ptr_conv;
11783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11784 this_ptr_conv.is_owned = false;
11785 LDKSignature val_ref;
11786 CHECK((*env)->GetArrayLength(env, val) == 64);
11787 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11788 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
11791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
11792 LDKNodeAnnouncement this_ptr_conv;
11793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11794 this_ptr_conv.is_owned = false;
11795 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
11796 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11797 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11798 long ret_ref = (long)ret_var.inner;
11799 if (ret_var.is_owned) {
11805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11806 LDKNodeAnnouncement this_ptr_conv;
11807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11808 this_ptr_conv.is_owned = false;
11809 LDKUnsignedNodeAnnouncement val_conv;
11810 val_conv.inner = (void*)(val & (~1));
11811 val_conv.is_owned = (val & 1) || (val == 0);
11812 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
11813 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
11816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
11817 LDKSignature signature_arg_ref;
11818 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
11819 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11820 LDKUnsignedNodeAnnouncement contents_arg_conv;
11821 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11822 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11823 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
11824 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
11825 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11826 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11827 long ret_ref = (long)ret_var.inner;
11828 if (ret_var.is_owned) {
11834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11835 LDKUnsignedChannelAnnouncement this_ptr_conv;
11836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11838 UnsignedChannelAnnouncement_free(this_ptr_conv);
11841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11842 LDKUnsignedChannelAnnouncement orig_conv;
11843 orig_conv.inner = (void*)(orig & (~1));
11844 orig_conv.is_owned = false;
11845 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
11846 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11847 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11848 long ret_ref = (long)ret_var.inner;
11849 if (ret_var.is_owned) {
11855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11856 LDKUnsignedChannelAnnouncement this_ptr_conv;
11857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11858 this_ptr_conv.is_owned = false;
11859 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
11860 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11861 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11862 long ret_ref = (long)ret_var.inner;
11863 if (ret_var.is_owned) {
11869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11870 LDKUnsignedChannelAnnouncement this_ptr_conv;
11871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11872 this_ptr_conv.is_owned = false;
11873 LDKChannelFeatures val_conv;
11874 val_conv.inner = (void*)(val & (~1));
11875 val_conv.is_owned = (val & 1) || (val == 0);
11876 // Warning: we need a move here but no clone is available for LDKChannelFeatures
11877 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
11880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
11881 LDKUnsignedChannelAnnouncement this_ptr_conv;
11882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11883 this_ptr_conv.is_owned = false;
11884 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11885 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
11889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11890 LDKUnsignedChannelAnnouncement this_ptr_conv;
11891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11892 this_ptr_conv.is_owned = false;
11893 LDKThirtyTwoBytes val_ref;
11894 CHECK((*env)->GetArrayLength(env, val) == 32);
11895 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11896 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
11899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11900 LDKUnsignedChannelAnnouncement this_ptr_conv;
11901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11902 this_ptr_conv.is_owned = false;
11903 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
11907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11908 LDKUnsignedChannelAnnouncement this_ptr_conv;
11909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11910 this_ptr_conv.is_owned = false;
11911 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
11914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
11915 LDKUnsignedChannelAnnouncement this_ptr_conv;
11916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11917 this_ptr_conv.is_owned = false;
11918 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11919 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
11923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11924 LDKUnsignedChannelAnnouncement this_ptr_conv;
11925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11926 this_ptr_conv.is_owned = false;
11927 LDKPublicKey val_ref;
11928 CHECK((*env)->GetArrayLength(env, val) == 33);
11929 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11930 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
11933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
11934 LDKUnsignedChannelAnnouncement this_ptr_conv;
11935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11936 this_ptr_conv.is_owned = false;
11937 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11938 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
11942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11943 LDKUnsignedChannelAnnouncement this_ptr_conv;
11944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11945 this_ptr_conv.is_owned = false;
11946 LDKPublicKey val_ref;
11947 CHECK((*env)->GetArrayLength(env, val) == 33);
11948 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11949 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
11952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
11953 LDKUnsignedChannelAnnouncement this_ptr_conv;
11954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11955 this_ptr_conv.is_owned = false;
11956 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11957 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
11961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11962 LDKUnsignedChannelAnnouncement this_ptr_conv;
11963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11964 this_ptr_conv.is_owned = false;
11965 LDKPublicKey val_ref;
11966 CHECK((*env)->GetArrayLength(env, val) == 33);
11967 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11968 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
11971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
11972 LDKUnsignedChannelAnnouncement this_ptr_conv;
11973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11974 this_ptr_conv.is_owned = false;
11975 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11976 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
11980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11981 LDKUnsignedChannelAnnouncement this_ptr_conv;
11982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11983 this_ptr_conv.is_owned = false;
11984 LDKPublicKey val_ref;
11985 CHECK((*env)->GetArrayLength(env, val) == 33);
11986 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11987 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
11990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11991 LDKChannelAnnouncement this_ptr_conv;
11992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11994 ChannelAnnouncement_free(this_ptr_conv);
11997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11998 LDKChannelAnnouncement orig_conv;
11999 orig_conv.inner = (void*)(orig & (~1));
12000 orig_conv.is_owned = false;
12001 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
12002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12004 long ret_ref = (long)ret_var.inner;
12005 if (ret_var.is_owned) {
12011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12012 LDKChannelAnnouncement this_ptr_conv;
12013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12014 this_ptr_conv.is_owned = false;
12015 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12016 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
12020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12021 LDKChannelAnnouncement this_ptr_conv;
12022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12023 this_ptr_conv.is_owned = false;
12024 LDKSignature val_ref;
12025 CHECK((*env)->GetArrayLength(env, val) == 64);
12026 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12027 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
12030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12031 LDKChannelAnnouncement this_ptr_conv;
12032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12033 this_ptr_conv.is_owned = false;
12034 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12035 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
12039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12040 LDKChannelAnnouncement this_ptr_conv;
12041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12042 this_ptr_conv.is_owned = false;
12043 LDKSignature val_ref;
12044 CHECK((*env)->GetArrayLength(env, val) == 64);
12045 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12046 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
12049 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12050 LDKChannelAnnouncement this_ptr_conv;
12051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12052 this_ptr_conv.is_owned = false;
12053 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12054 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
12058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12059 LDKChannelAnnouncement this_ptr_conv;
12060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12061 this_ptr_conv.is_owned = false;
12062 LDKSignature val_ref;
12063 CHECK((*env)->GetArrayLength(env, val) == 64);
12064 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12065 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
12068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12069 LDKChannelAnnouncement this_ptr_conv;
12070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12071 this_ptr_conv.is_owned = false;
12072 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12073 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
12077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12078 LDKChannelAnnouncement this_ptr_conv;
12079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12080 this_ptr_conv.is_owned = false;
12081 LDKSignature val_ref;
12082 CHECK((*env)->GetArrayLength(env, val) == 64);
12083 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12084 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
12087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
12088 LDKChannelAnnouncement this_ptr_conv;
12089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12090 this_ptr_conv.is_owned = false;
12091 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
12092 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12093 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12094 long ret_ref = (long)ret_var.inner;
12095 if (ret_var.is_owned) {
12101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12102 LDKChannelAnnouncement this_ptr_conv;
12103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12104 this_ptr_conv.is_owned = false;
12105 LDKUnsignedChannelAnnouncement val_conv;
12106 val_conv.inner = (void*)(val & (~1));
12107 val_conv.is_owned = (val & 1) || (val == 0);
12108 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
12109 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
12112 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) {
12113 LDKSignature node_signature_1_arg_ref;
12114 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
12115 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
12116 LDKSignature node_signature_2_arg_ref;
12117 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
12118 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
12119 LDKSignature bitcoin_signature_1_arg_ref;
12120 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
12121 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
12122 LDKSignature bitcoin_signature_2_arg_ref;
12123 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
12124 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
12125 LDKUnsignedChannelAnnouncement contents_arg_conv;
12126 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12127 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12128 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
12129 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);
12130 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12131 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12132 long ret_ref = (long)ret_var.inner;
12133 if (ret_var.is_owned) {
12139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12140 LDKUnsignedChannelUpdate this_ptr_conv;
12141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12143 UnsignedChannelUpdate_free(this_ptr_conv);
12146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12147 LDKUnsignedChannelUpdate orig_conv;
12148 orig_conv.inner = (void*)(orig & (~1));
12149 orig_conv.is_owned = false;
12150 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
12151 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12152 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12153 long ret_ref = (long)ret_var.inner;
12154 if (ret_var.is_owned) {
12160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12161 LDKUnsignedChannelUpdate this_ptr_conv;
12162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12163 this_ptr_conv.is_owned = false;
12164 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12165 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
12169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12170 LDKUnsignedChannelUpdate this_ptr_conv;
12171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12172 this_ptr_conv.is_owned = false;
12173 LDKThirtyTwoBytes val_ref;
12174 CHECK((*env)->GetArrayLength(env, val) == 32);
12175 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12176 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
12179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12180 LDKUnsignedChannelUpdate this_ptr_conv;
12181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12182 this_ptr_conv.is_owned = false;
12183 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
12187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12188 LDKUnsignedChannelUpdate this_ptr_conv;
12189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12190 this_ptr_conv.is_owned = false;
12191 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
12194 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
12195 LDKUnsignedChannelUpdate this_ptr_conv;
12196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12197 this_ptr_conv.is_owned = false;
12198 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
12202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12203 LDKUnsignedChannelUpdate this_ptr_conv;
12204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12205 this_ptr_conv.is_owned = false;
12206 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
12209 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
12210 LDKUnsignedChannelUpdate this_ptr_conv;
12211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12212 this_ptr_conv.is_owned = false;
12213 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
12217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
12218 LDKUnsignedChannelUpdate this_ptr_conv;
12219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12220 this_ptr_conv.is_owned = false;
12221 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
12224 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
12225 LDKUnsignedChannelUpdate this_ptr_conv;
12226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12227 this_ptr_conv.is_owned = false;
12228 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
12232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12233 LDKUnsignedChannelUpdate this_ptr_conv;
12234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12235 this_ptr_conv.is_owned = false;
12236 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
12239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12240 LDKUnsignedChannelUpdate this_ptr_conv;
12241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12242 this_ptr_conv.is_owned = false;
12243 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
12247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12248 LDKUnsignedChannelUpdate this_ptr_conv;
12249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12250 this_ptr_conv.is_owned = false;
12251 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
12254 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12255 LDKUnsignedChannelUpdate this_ptr_conv;
12256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12257 this_ptr_conv.is_owned = false;
12258 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
12262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12263 LDKUnsignedChannelUpdate this_ptr_conv;
12264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12265 this_ptr_conv.is_owned = false;
12266 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
12269 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
12270 LDKUnsignedChannelUpdate this_ptr_conv;
12271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12272 this_ptr_conv.is_owned = false;
12273 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
12277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12278 LDKUnsignedChannelUpdate this_ptr_conv;
12279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12280 this_ptr_conv.is_owned = false;
12281 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
12284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12285 LDKChannelUpdate this_ptr_conv;
12286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12288 ChannelUpdate_free(this_ptr_conv);
12291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12292 LDKChannelUpdate orig_conv;
12293 orig_conv.inner = (void*)(orig & (~1));
12294 orig_conv.is_owned = false;
12295 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
12296 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12297 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12298 long ret_ref = (long)ret_var.inner;
12299 if (ret_var.is_owned) {
12305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
12306 LDKChannelUpdate this_ptr_conv;
12307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12308 this_ptr_conv.is_owned = false;
12309 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12310 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
12314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12315 LDKChannelUpdate this_ptr_conv;
12316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12317 this_ptr_conv.is_owned = false;
12318 LDKSignature val_ref;
12319 CHECK((*env)->GetArrayLength(env, val) == 64);
12320 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12321 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
12324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
12325 LDKChannelUpdate this_ptr_conv;
12326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12327 this_ptr_conv.is_owned = false;
12328 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
12329 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12330 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12331 long ret_ref = (long)ret_var.inner;
12332 if (ret_var.is_owned) {
12338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12339 LDKChannelUpdate this_ptr_conv;
12340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12341 this_ptr_conv.is_owned = false;
12342 LDKUnsignedChannelUpdate val_conv;
12343 val_conv.inner = (void*)(val & (~1));
12344 val_conv.is_owned = (val & 1) || (val == 0);
12345 val_conv = UnsignedChannelUpdate_clone(&val_conv);
12346 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
12349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
12350 LDKSignature signature_arg_ref;
12351 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
12352 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
12353 LDKUnsignedChannelUpdate contents_arg_conv;
12354 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12355 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12356 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
12357 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
12358 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12359 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12360 long ret_ref = (long)ret_var.inner;
12361 if (ret_var.is_owned) {
12367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12368 LDKQueryChannelRange this_ptr_conv;
12369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12371 QueryChannelRange_free(this_ptr_conv);
12374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12375 LDKQueryChannelRange orig_conv;
12376 orig_conv.inner = (void*)(orig & (~1));
12377 orig_conv.is_owned = false;
12378 LDKQueryChannelRange ret_var = QueryChannelRange_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 int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12389 LDKQueryChannelRange this_ptr_conv;
12390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12391 this_ptr_conv.is_owned = false;
12392 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12393 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
12397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12398 LDKQueryChannelRange this_ptr_conv;
12399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12400 this_ptr_conv.is_owned = false;
12401 LDKThirtyTwoBytes val_ref;
12402 CHECK((*env)->GetArrayLength(env, val) == 32);
12403 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12404 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12407 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
12408 LDKQueryChannelRange this_ptr_conv;
12409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12410 this_ptr_conv.is_owned = false;
12411 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
12415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12416 LDKQueryChannelRange this_ptr_conv;
12417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12418 this_ptr_conv.is_owned = false;
12419 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
12422 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
12423 LDKQueryChannelRange this_ptr_conv;
12424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12425 this_ptr_conv.is_owned = false;
12426 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
12430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12431 LDKQueryChannelRange this_ptr_conv;
12432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12433 this_ptr_conv.is_owned = false;
12434 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12437 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) {
12438 LDKThirtyTwoBytes chain_hash_arg_ref;
12439 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12440 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12441 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
12442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12444 long ret_ref = (long)ret_var.inner;
12445 if (ret_var.is_owned) {
12451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12452 LDKReplyChannelRange this_ptr_conv;
12453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12455 ReplyChannelRange_free(this_ptr_conv);
12458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12459 LDKReplyChannelRange orig_conv;
12460 orig_conv.inner = (void*)(orig & (~1));
12461 orig_conv.is_owned = false;
12462 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
12463 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12464 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12465 long ret_ref = (long)ret_var.inner;
12466 if (ret_var.is_owned) {
12472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12473 LDKReplyChannelRange this_ptr_conv;
12474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12475 this_ptr_conv.is_owned = false;
12476 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12477 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
12481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12482 LDKReplyChannelRange this_ptr_conv;
12483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12484 this_ptr_conv.is_owned = false;
12485 LDKThirtyTwoBytes val_ref;
12486 CHECK((*env)->GetArrayLength(env, val) == 32);
12487 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12488 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12491 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
12492 LDKReplyChannelRange this_ptr_conv;
12493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12494 this_ptr_conv.is_owned = false;
12495 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
12499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12500 LDKReplyChannelRange this_ptr_conv;
12501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12502 this_ptr_conv.is_owned = false;
12503 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
12506 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
12507 LDKReplyChannelRange this_ptr_conv;
12508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12509 this_ptr_conv.is_owned = false;
12510 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
12514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12515 LDKReplyChannelRange this_ptr_conv;
12516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12517 this_ptr_conv.is_owned = false;
12518 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
12522 LDKReplyChannelRange this_ptr_conv;
12523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12524 this_ptr_conv.is_owned = false;
12525 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
12529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12530 LDKReplyChannelRange this_ptr_conv;
12531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12532 this_ptr_conv.is_owned = false;
12533 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
12536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12537 LDKReplyChannelRange this_ptr_conv;
12538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12539 this_ptr_conv.is_owned = false;
12540 LDKCVec_u64Z val_constr;
12541 val_constr.datalen = (*env)->GetArrayLength(env, val);
12542 if (val_constr.datalen > 0)
12543 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12545 val_constr.data = NULL;
12546 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12547 for (size_t g = 0; g < val_constr.datalen; g++) {
12548 int64_t arr_conv_6 = val_vals[g];
12549 val_constr.data[g] = arr_conv_6;
12551 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12552 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
12555 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 full_information_arg, int64_tArray short_channel_ids_arg) {
12556 LDKThirtyTwoBytes chain_hash_arg_ref;
12557 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12558 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12559 LDKCVec_u64Z short_channel_ids_arg_constr;
12560 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
12561 if (short_channel_ids_arg_constr.datalen > 0)
12562 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12564 short_channel_ids_arg_constr.data = NULL;
12565 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
12566 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12567 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
12568 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12570 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12571 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
12572 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12573 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12574 long ret_ref = (long)ret_var.inner;
12575 if (ret_var.is_owned) {
12581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12582 LDKQueryShortChannelIds this_ptr_conv;
12583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12585 QueryShortChannelIds_free(this_ptr_conv);
12588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12589 LDKQueryShortChannelIds orig_conv;
12590 orig_conv.inner = (void*)(orig & (~1));
12591 orig_conv.is_owned = false;
12592 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
12593 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12594 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12595 long ret_ref = (long)ret_var.inner;
12596 if (ret_var.is_owned) {
12602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12603 LDKQueryShortChannelIds this_ptr_conv;
12604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12605 this_ptr_conv.is_owned = false;
12606 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12607 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
12611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12612 LDKQueryShortChannelIds this_ptr_conv;
12613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12614 this_ptr_conv.is_owned = false;
12615 LDKThirtyTwoBytes val_ref;
12616 CHECK((*env)->GetArrayLength(env, val) == 32);
12617 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12618 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
12621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12622 LDKQueryShortChannelIds this_ptr_conv;
12623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12624 this_ptr_conv.is_owned = false;
12625 LDKCVec_u64Z val_constr;
12626 val_constr.datalen = (*env)->GetArrayLength(env, val);
12627 if (val_constr.datalen > 0)
12628 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12630 val_constr.data = NULL;
12631 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12632 for (size_t g = 0; g < val_constr.datalen; g++) {
12633 int64_t arr_conv_6 = val_vals[g];
12634 val_constr.data[g] = arr_conv_6;
12636 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12637 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
12640 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) {
12641 LDKThirtyTwoBytes chain_hash_arg_ref;
12642 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12643 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12644 LDKCVec_u64Z short_channel_ids_arg_constr;
12645 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
12646 if (short_channel_ids_arg_constr.datalen > 0)
12647 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12649 short_channel_ids_arg_constr.data = NULL;
12650 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
12651 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12652 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
12653 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12655 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12656 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
12657 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12658 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12659 long ret_ref = (long)ret_var.inner;
12660 if (ret_var.is_owned) {
12666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12667 LDKReplyShortChannelIdsEnd this_ptr_conv;
12668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12670 ReplyShortChannelIdsEnd_free(this_ptr_conv);
12673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12674 LDKReplyShortChannelIdsEnd orig_conv;
12675 orig_conv.inner = (void*)(orig & (~1));
12676 orig_conv.is_owned = false;
12677 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
12678 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12679 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12680 long ret_ref = (long)ret_var.inner;
12681 if (ret_var.is_owned) {
12687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12688 LDKReplyShortChannelIdsEnd this_ptr_conv;
12689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12690 this_ptr_conv.is_owned = false;
12691 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12692 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
12696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12697 LDKReplyShortChannelIdsEnd this_ptr_conv;
12698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12699 this_ptr_conv.is_owned = false;
12700 LDKThirtyTwoBytes val_ref;
12701 CHECK((*env)->GetArrayLength(env, val) == 32);
12702 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12703 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
12706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
12707 LDKReplyShortChannelIdsEnd this_ptr_conv;
12708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12709 this_ptr_conv.is_owned = false;
12710 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
12714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12715 LDKReplyShortChannelIdsEnd this_ptr_conv;
12716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12717 this_ptr_conv.is_owned = false;
12718 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
12721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
12722 LDKThirtyTwoBytes chain_hash_arg_ref;
12723 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12724 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12725 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
12726 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12727 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12728 long ret_ref = (long)ret_var.inner;
12729 if (ret_var.is_owned) {
12735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12736 LDKGossipTimestampFilter this_ptr_conv;
12737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12739 GossipTimestampFilter_free(this_ptr_conv);
12742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12743 LDKGossipTimestampFilter orig_conv;
12744 orig_conv.inner = (void*)(orig & (~1));
12745 orig_conv.is_owned = false;
12746 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
12747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12749 long ret_ref = (long)ret_var.inner;
12750 if (ret_var.is_owned) {
12756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12757 LDKGossipTimestampFilter this_ptr_conv;
12758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12759 this_ptr_conv.is_owned = false;
12760 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12761 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
12765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12766 LDKGossipTimestampFilter this_ptr_conv;
12767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12768 this_ptr_conv.is_owned = false;
12769 LDKThirtyTwoBytes val_ref;
12770 CHECK((*env)->GetArrayLength(env, val) == 32);
12771 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12772 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
12775 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
12776 LDKGossipTimestampFilter this_ptr_conv;
12777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12778 this_ptr_conv.is_owned = false;
12779 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
12783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12784 LDKGossipTimestampFilter this_ptr_conv;
12785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12786 this_ptr_conv.is_owned = false;
12787 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
12790 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
12791 LDKGossipTimestampFilter this_ptr_conv;
12792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12793 this_ptr_conv.is_owned = false;
12794 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
12798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12799 LDKGossipTimestampFilter this_ptr_conv;
12800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12801 this_ptr_conv.is_owned = false;
12802 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
12805 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) {
12806 LDKThirtyTwoBytes chain_hash_arg_ref;
12807 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12808 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12809 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
12810 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12811 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12812 long ret_ref = (long)ret_var.inner;
12813 if (ret_var.is_owned) {
12819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12820 if ((this_ptr & 1) != 0) return;
12821 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
12822 FREE((void*)this_ptr);
12823 ErrorAction_free(this_ptr_conv);
12826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12827 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
12828 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12829 *ret_copy = ErrorAction_clone(orig_conv);
12830 long ret_ref = (long)ret_copy;
12834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12835 LDKLightningError this_ptr_conv;
12836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12838 LightningError_free(this_ptr_conv);
12841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12842 LDKLightningError orig_conv;
12843 orig_conv.inner = (void*)(orig & (~1));
12844 orig_conv.is_owned = false;
12845 LDKLightningError ret_var = LightningError_clone(&orig_conv);
12846 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12847 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12848 long ret_ref = (long)ret_var.inner;
12849 if (ret_var.is_owned) {
12855 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
12856 LDKLightningError this_ptr_conv;
12857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12858 this_ptr_conv.is_owned = false;
12859 LDKStr _str = LightningError_get_err(&this_ptr_conv);
12860 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
12864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12865 LDKLightningError this_ptr_conv;
12866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12867 this_ptr_conv.is_owned = false;
12868 LDKCVec_u8Z val_ref;
12869 val_ref.datalen = (*env)->GetArrayLength(env, val);
12870 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12871 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
12872 LightningError_set_err(&this_ptr_conv, val_ref);
12875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
12876 LDKLightningError this_ptr_conv;
12877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12878 this_ptr_conv.is_owned = false;
12879 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12880 *ret_copy = LightningError_get_action(&this_ptr_conv);
12881 long ret_ref = (long)ret_copy;
12885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12886 LDKLightningError this_ptr_conv;
12887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12888 this_ptr_conv.is_owned = false;
12889 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
12891 LightningError_set_action(&this_ptr_conv, val_conv);
12894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
12895 LDKCVec_u8Z err_arg_ref;
12896 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
12897 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12898 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
12899 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
12900 FREE((void*)action_arg);
12901 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
12902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12904 long ret_ref = (long)ret_var.inner;
12905 if (ret_var.is_owned) {
12911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12912 LDKCommitmentUpdate this_ptr_conv;
12913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12915 CommitmentUpdate_free(this_ptr_conv);
12918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12919 LDKCommitmentUpdate orig_conv;
12920 orig_conv.inner = (void*)(orig & (~1));
12921 orig_conv.is_owned = false;
12922 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
12923 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12924 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12925 long ret_ref = (long)ret_var.inner;
12926 if (ret_var.is_owned) {
12932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12933 LDKCommitmentUpdate this_ptr_conv;
12934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12935 this_ptr_conv.is_owned = false;
12936 LDKCVec_UpdateAddHTLCZ val_constr;
12937 val_constr.datalen = (*env)->GetArrayLength(env, val);
12938 if (val_constr.datalen > 0)
12939 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12941 val_constr.data = NULL;
12942 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12943 for (size_t p = 0; p < val_constr.datalen; p++) {
12944 int64_t arr_conv_15 = val_vals[p];
12945 LDKUpdateAddHTLC arr_conv_15_conv;
12946 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
12947 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
12948 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
12949 val_constr.data[p] = arr_conv_15_conv;
12951 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12952 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
12955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12956 LDKCommitmentUpdate this_ptr_conv;
12957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12958 this_ptr_conv.is_owned = false;
12959 LDKCVec_UpdateFulfillHTLCZ val_constr;
12960 val_constr.datalen = (*env)->GetArrayLength(env, val);
12961 if (val_constr.datalen > 0)
12962 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12964 val_constr.data = NULL;
12965 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12966 for (size_t t = 0; t < val_constr.datalen; t++) {
12967 int64_t arr_conv_19 = val_vals[t];
12968 LDKUpdateFulfillHTLC arr_conv_19_conv;
12969 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
12970 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
12971 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
12972 val_constr.data[t] = arr_conv_19_conv;
12974 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12975 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
12978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12979 LDKCommitmentUpdate this_ptr_conv;
12980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12981 this_ptr_conv.is_owned = false;
12982 LDKCVec_UpdateFailHTLCZ val_constr;
12983 val_constr.datalen = (*env)->GetArrayLength(env, val);
12984 if (val_constr.datalen > 0)
12985 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12987 val_constr.data = NULL;
12988 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12989 for (size_t q = 0; q < val_constr.datalen; q++) {
12990 int64_t arr_conv_16 = val_vals[q];
12991 LDKUpdateFailHTLC arr_conv_16_conv;
12992 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
12993 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
12994 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
12995 val_constr.data[q] = arr_conv_16_conv;
12997 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12998 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
13001 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) {
13002 LDKCommitmentUpdate this_ptr_conv;
13003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13004 this_ptr_conv.is_owned = false;
13005 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
13006 val_constr.datalen = (*env)->GetArrayLength(env, val);
13007 if (val_constr.datalen > 0)
13008 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13010 val_constr.data = NULL;
13011 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13012 for (size_t z = 0; z < val_constr.datalen; z++) {
13013 int64_t arr_conv_25 = val_vals[z];
13014 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13015 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13016 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13017 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13018 val_constr.data[z] = arr_conv_25_conv;
13020 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13021 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
13024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
13025 LDKCommitmentUpdate this_ptr_conv;
13026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13027 this_ptr_conv.is_owned = false;
13028 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
13029 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13030 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13031 long ret_ref = (long)ret_var.inner;
13032 if (ret_var.is_owned) {
13038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13039 LDKCommitmentUpdate this_ptr_conv;
13040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13041 this_ptr_conv.is_owned = false;
13042 LDKUpdateFee val_conv;
13043 val_conv.inner = (void*)(val & (~1));
13044 val_conv.is_owned = (val & 1) || (val == 0);
13045 val_conv = UpdateFee_clone(&val_conv);
13046 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
13049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
13050 LDKCommitmentUpdate this_ptr_conv;
13051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13052 this_ptr_conv.is_owned = false;
13053 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
13054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13056 long ret_ref = (long)ret_var.inner;
13057 if (ret_var.is_owned) {
13063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13064 LDKCommitmentUpdate this_ptr_conv;
13065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13066 this_ptr_conv.is_owned = false;
13067 LDKCommitmentSigned val_conv;
13068 val_conv.inner = (void*)(val & (~1));
13069 val_conv.is_owned = (val & 1) || (val == 0);
13070 val_conv = CommitmentSigned_clone(&val_conv);
13071 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
13074 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) {
13075 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
13076 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
13077 if (update_add_htlcs_arg_constr.datalen > 0)
13078 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13080 update_add_htlcs_arg_constr.data = NULL;
13081 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
13082 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
13083 int64_t arr_conv_15 = update_add_htlcs_arg_vals[p];
13084 LDKUpdateAddHTLC arr_conv_15_conv;
13085 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13086 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13087 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
13088 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
13090 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
13091 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
13092 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
13093 if (update_fulfill_htlcs_arg_constr.datalen > 0)
13094 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13096 update_fulfill_htlcs_arg_constr.data = NULL;
13097 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
13098 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
13099 int64_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
13100 LDKUpdateFulfillHTLC arr_conv_19_conv;
13101 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13102 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13103 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
13104 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
13106 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
13107 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
13108 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
13109 if (update_fail_htlcs_arg_constr.datalen > 0)
13110 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13112 update_fail_htlcs_arg_constr.data = NULL;
13113 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
13114 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
13115 int64_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
13116 LDKUpdateFailHTLC arr_conv_16_conv;
13117 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13118 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13119 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13120 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
13122 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
13123 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
13124 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
13125 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
13126 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13128 update_fail_malformed_htlcs_arg_constr.data = NULL;
13129 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
13130 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
13131 int64_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
13132 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13133 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13134 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13135 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13136 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
13138 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
13139 LDKUpdateFee update_fee_arg_conv;
13140 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
13141 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
13142 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
13143 LDKCommitmentSigned commitment_signed_arg_conv;
13144 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
13145 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
13146 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
13147 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);
13148 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13149 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13150 long ret_ref = (long)ret_var.inner;
13151 if (ret_var.is_owned) {
13157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13158 if ((this_ptr & 1) != 0) return;
13159 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
13160 FREE((void*)this_ptr);
13161 HTLCFailChannelUpdate_free(this_ptr_conv);
13164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13165 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
13166 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
13167 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
13168 long ret_ref = (long)ret_copy;
13172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13173 if ((this_ptr & 1) != 0) return;
13174 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
13175 FREE((void*)this_ptr);
13176 ChannelMessageHandler_free(this_ptr_conv);
13179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13180 if ((this_ptr & 1) != 0) return;
13181 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
13182 FREE((void*)this_ptr);
13183 RoutingMessageHandler_free(this_ptr_conv);
13186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
13187 LDKAcceptChannel obj_conv;
13188 obj_conv.inner = (void*)(obj & (~1));
13189 obj_conv.is_owned = false;
13190 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
13191 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13192 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13193 CVec_u8Z_free(arg_var);
13197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13198 LDKu8slice ser_ref;
13199 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13200 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13201 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
13202 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13203 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13204 long ret_ref = (long)ret_var.inner;
13205 if (ret_var.is_owned) {
13208 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
13213 LDKAnnouncementSignatures obj_conv;
13214 obj_conv.inner = (void*)(obj & (~1));
13215 obj_conv.is_owned = false;
13216 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
13217 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13218 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13219 CVec_u8Z_free(arg_var);
13223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13224 LDKu8slice ser_ref;
13225 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13226 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13227 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
13228 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13229 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13230 long ret_ref = (long)ret_var.inner;
13231 if (ret_var.is_owned) {
13234 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
13239 LDKChannelReestablish obj_conv;
13240 obj_conv.inner = (void*)(obj & (~1));
13241 obj_conv.is_owned = false;
13242 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
13243 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13244 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13245 CVec_u8Z_free(arg_var);
13249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13250 LDKu8slice ser_ref;
13251 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13252 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13253 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13254 *ret_conv = ChannelReestablish_read(ser_ref);
13255 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13256 return (long)ret_conv;
13259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13260 LDKClosingSigned obj_conv;
13261 obj_conv.inner = (void*)(obj & (~1));
13262 obj_conv.is_owned = false;
13263 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
13264 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13265 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13266 CVec_u8Z_free(arg_var);
13270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13271 LDKu8slice ser_ref;
13272 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13273 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13274 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
13275 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13276 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13277 long ret_ref = (long)ret_var.inner;
13278 if (ret_var.is_owned) {
13281 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13286 LDKCommitmentSigned obj_conv;
13287 obj_conv.inner = (void*)(obj & (~1));
13288 obj_conv.is_owned = false;
13289 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
13290 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13291 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13292 CVec_u8Z_free(arg_var);
13296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13297 LDKu8slice ser_ref;
13298 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13299 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13300 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
13301 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13302 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13303 long ret_ref = (long)ret_var.inner;
13304 if (ret_var.is_owned) {
13307 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
13312 LDKFundingCreated obj_conv;
13313 obj_conv.inner = (void*)(obj & (~1));
13314 obj_conv.is_owned = false;
13315 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
13316 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13317 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13318 CVec_u8Z_free(arg_var);
13322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13323 LDKu8slice ser_ref;
13324 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13325 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13326 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
13327 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13328 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13329 long ret_ref = (long)ret_var.inner;
13330 if (ret_var.is_owned) {
13333 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13338 LDKFundingSigned obj_conv;
13339 obj_conv.inner = (void*)(obj & (~1));
13340 obj_conv.is_owned = false;
13341 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
13342 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13343 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13344 CVec_u8Z_free(arg_var);
13348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13349 LDKu8slice ser_ref;
13350 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13351 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13352 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
13353 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13354 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13355 long ret_ref = (long)ret_var.inner;
13356 if (ret_var.is_owned) {
13359 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
13364 LDKFundingLocked obj_conv;
13365 obj_conv.inner = (void*)(obj & (~1));
13366 obj_conv.is_owned = false;
13367 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
13368 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13369 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13370 CVec_u8Z_free(arg_var);
13374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13375 LDKu8slice ser_ref;
13376 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13377 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13378 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
13379 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13380 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13381 long ret_ref = (long)ret_var.inner;
13382 if (ret_var.is_owned) {
13385 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
13391 obj_conv.inner = (void*)(obj & (~1));
13392 obj_conv.is_owned = false;
13393 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
13394 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13395 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13396 CVec_u8Z_free(arg_var);
13400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13401 LDKu8slice ser_ref;
13402 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13403 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13404 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13405 *ret_conv = Init_read(ser_ref);
13406 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13407 return (long)ret_conv;
13410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
13411 LDKOpenChannel obj_conv;
13412 obj_conv.inner = (void*)(obj & (~1));
13413 obj_conv.is_owned = false;
13414 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
13415 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13416 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13417 CVec_u8Z_free(arg_var);
13421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13422 LDKu8slice ser_ref;
13423 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13424 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13425 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
13426 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13427 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13428 long ret_ref = (long)ret_var.inner;
13429 if (ret_var.is_owned) {
13432 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
13437 LDKRevokeAndACK obj_conv;
13438 obj_conv.inner = (void*)(obj & (~1));
13439 obj_conv.is_owned = false;
13440 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
13441 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13442 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13443 CVec_u8Z_free(arg_var);
13447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13448 LDKu8slice ser_ref;
13449 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13450 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13451 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
13452 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13453 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13454 long ret_ref = (long)ret_var.inner;
13455 if (ret_var.is_owned) {
13458 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
13463 LDKShutdown obj_conv;
13464 obj_conv.inner = (void*)(obj & (~1));
13465 obj_conv.is_owned = false;
13466 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
13467 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13468 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13469 CVec_u8Z_free(arg_var);
13473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13474 LDKu8slice ser_ref;
13475 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13476 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13477 LDKShutdown ret_var = Shutdown_read(ser_ref);
13478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13480 long ret_ref = (long)ret_var.inner;
13481 if (ret_var.is_owned) {
13484 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13489 LDKUpdateFailHTLC obj_conv;
13490 obj_conv.inner = (void*)(obj & (~1));
13491 obj_conv.is_owned = false;
13492 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
13493 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13494 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13495 CVec_u8Z_free(arg_var);
13499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13500 LDKu8slice ser_ref;
13501 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13502 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13503 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
13504 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13505 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13506 long ret_ref = (long)ret_var.inner;
13507 if (ret_var.is_owned) {
13510 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13515 LDKUpdateFailMalformedHTLC obj_conv;
13516 obj_conv.inner = (void*)(obj & (~1));
13517 obj_conv.is_owned = false;
13518 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
13519 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13520 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13521 CVec_u8Z_free(arg_var);
13525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13526 LDKu8slice ser_ref;
13527 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13528 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13529 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
13530 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13531 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13532 long ret_ref = (long)ret_var.inner;
13533 if (ret_var.is_owned) {
13536 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
13541 LDKUpdateFee obj_conv;
13542 obj_conv.inner = (void*)(obj & (~1));
13543 obj_conv.is_owned = false;
13544 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
13545 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13546 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13547 CVec_u8Z_free(arg_var);
13551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13552 LDKu8slice ser_ref;
13553 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13554 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13555 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
13556 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13557 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13558 long ret_ref = (long)ret_var.inner;
13559 if (ret_var.is_owned) {
13562 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13567 LDKUpdateFulfillHTLC obj_conv;
13568 obj_conv.inner = (void*)(obj & (~1));
13569 obj_conv.is_owned = false;
13570 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
13571 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13572 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13573 CVec_u8Z_free(arg_var);
13577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13578 LDKu8slice ser_ref;
13579 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13580 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13581 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
13582 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13583 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13584 long ret_ref = (long)ret_var.inner;
13585 if (ret_var.is_owned) {
13588 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13593 LDKUpdateAddHTLC obj_conv;
13594 obj_conv.inner = (void*)(obj & (~1));
13595 obj_conv.is_owned = false;
13596 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
13597 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13598 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13599 CVec_u8Z_free(arg_var);
13603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13604 LDKu8slice ser_ref;
13605 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13606 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13607 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
13608 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13609 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13610 long ret_ref = (long)ret_var.inner;
13611 if (ret_var.is_owned) {
13614 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
13620 obj_conv.inner = (void*)(obj & (~1));
13621 obj_conv.is_owned = false;
13622 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
13623 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13624 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13625 CVec_u8Z_free(arg_var);
13629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13630 LDKu8slice ser_ref;
13631 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13632 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13633 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13634 *ret_conv = Ping_read(ser_ref);
13635 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13636 return (long)ret_conv;
13639 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
13641 obj_conv.inner = (void*)(obj & (~1));
13642 obj_conv.is_owned = false;
13643 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
13644 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13645 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13646 CVec_u8Z_free(arg_var);
13650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13651 LDKu8slice ser_ref;
13652 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13653 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13654 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13655 *ret_conv = Pong_read(ser_ref);
13656 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13657 return (long)ret_conv;
13660 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13661 LDKUnsignedChannelAnnouncement obj_conv;
13662 obj_conv.inner = (void*)(obj & (~1));
13663 obj_conv.is_owned = false;
13664 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
13665 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13666 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13667 CVec_u8Z_free(arg_var);
13671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13672 LDKu8slice ser_ref;
13673 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13674 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13675 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13676 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
13677 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13678 return (long)ret_conv;
13681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13682 LDKChannelAnnouncement obj_conv;
13683 obj_conv.inner = (void*)(obj & (~1));
13684 obj_conv.is_owned = false;
13685 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
13686 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13687 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13688 CVec_u8Z_free(arg_var);
13692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13693 LDKu8slice ser_ref;
13694 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13695 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13696 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
13697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13699 long ret_ref = (long)ret_var.inner;
13700 if (ret_var.is_owned) {
13703 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13708 LDKUnsignedChannelUpdate obj_conv;
13709 obj_conv.inner = (void*)(obj & (~1));
13710 obj_conv.is_owned = false;
13711 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
13712 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13713 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13714 CVec_u8Z_free(arg_var);
13718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13719 LDKu8slice ser_ref;
13720 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13721 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13722 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13723 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
13724 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13725 return (long)ret_conv;
13728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13729 LDKChannelUpdate obj_conv;
13730 obj_conv.inner = (void*)(obj & (~1));
13731 obj_conv.is_owned = false;
13732 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
13733 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13734 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13735 CVec_u8Z_free(arg_var);
13739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13740 LDKu8slice ser_ref;
13741 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13742 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13743 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
13744 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13745 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13746 long ret_ref = (long)ret_var.inner;
13747 if (ret_var.is_owned) {
13750 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
13755 LDKErrorMessage obj_conv;
13756 obj_conv.inner = (void*)(obj & (~1));
13757 obj_conv.is_owned = false;
13758 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
13759 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13760 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13761 CVec_u8Z_free(arg_var);
13765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13766 LDKu8slice ser_ref;
13767 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13768 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13769 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13770 *ret_conv = ErrorMessage_read(ser_ref);
13771 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13772 return (long)ret_conv;
13775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13776 LDKUnsignedNodeAnnouncement obj_conv;
13777 obj_conv.inner = (void*)(obj & (~1));
13778 obj_conv.is_owned = false;
13779 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
13780 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13781 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13782 CVec_u8Z_free(arg_var);
13786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13787 LDKu8slice ser_ref;
13788 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13789 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13790 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13791 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
13792 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13793 return (long)ret_conv;
13796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13797 LDKNodeAnnouncement obj_conv;
13798 obj_conv.inner = (void*)(obj & (~1));
13799 obj_conv.is_owned = false;
13800 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
13801 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13802 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13803 CVec_u8Z_free(arg_var);
13807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13808 LDKu8slice ser_ref;
13809 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13810 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13811 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
13812 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13813 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13814 long ret_ref = (long)ret_var.inner;
13815 if (ret_var.is_owned) {
13818 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13823 LDKu8slice ser_ref;
13824 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13825 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13826 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13827 *ret_conv = QueryShortChannelIds_read(ser_ref);
13828 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13829 return (long)ret_conv;
13832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
13833 LDKQueryShortChannelIds obj_conv;
13834 obj_conv.inner = (void*)(obj & (~1));
13835 obj_conv.is_owned = false;
13836 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
13837 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13838 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13839 CVec_u8Z_free(arg_var);
13843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13844 LDKu8slice ser_ref;
13845 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13846 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13847 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13848 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
13849 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13850 return (long)ret_conv;
13853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
13854 LDKReplyShortChannelIdsEnd obj_conv;
13855 obj_conv.inner = (void*)(obj & (~1));
13856 obj_conv.is_owned = false;
13857 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
13858 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13859 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13860 CVec_u8Z_free(arg_var);
13864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13865 LDKu8slice ser_ref;
13866 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13867 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13868 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13869 *ret_conv = QueryChannelRange_read(ser_ref);
13870 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13871 return (long)ret_conv;
13874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
13875 LDKQueryChannelRange obj_conv;
13876 obj_conv.inner = (void*)(obj & (~1));
13877 obj_conv.is_owned = false;
13878 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
13879 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13880 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13881 CVec_u8Z_free(arg_var);
13885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13886 LDKu8slice ser_ref;
13887 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13888 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13889 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13890 *ret_conv = ReplyChannelRange_read(ser_ref);
13891 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13892 return (long)ret_conv;
13895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
13896 LDKReplyChannelRange obj_conv;
13897 obj_conv.inner = (void*)(obj & (~1));
13898 obj_conv.is_owned = false;
13899 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
13900 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13901 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13902 CVec_u8Z_free(arg_var);
13906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13907 LDKu8slice ser_ref;
13908 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13909 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13910 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13911 *ret_conv = GossipTimestampFilter_read(ser_ref);
13912 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13913 return (long)ret_conv;
13916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
13917 LDKGossipTimestampFilter obj_conv;
13918 obj_conv.inner = (void*)(obj & (~1));
13919 obj_conv.is_owned = false;
13920 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
13921 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13922 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13923 CVec_u8Z_free(arg_var);
13927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13928 LDKMessageHandler this_ptr_conv;
13929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13931 MessageHandler_free(this_ptr_conv);
13934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
13935 LDKMessageHandler this_ptr_conv;
13936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13937 this_ptr_conv.is_owned = false;
13938 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
13942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13943 LDKMessageHandler this_ptr_conv;
13944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13945 this_ptr_conv.is_owned = false;
13946 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
13947 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
13948 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13949 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
13951 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
13954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
13955 LDKMessageHandler this_ptr_conv;
13956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13957 this_ptr_conv.is_owned = false;
13958 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
13962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13963 LDKMessageHandler this_ptr_conv;
13964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13965 this_ptr_conv.is_owned = false;
13966 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
13967 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
13968 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13969 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
13971 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
13974 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) {
13975 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
13976 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
13977 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13978 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
13980 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
13981 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
13982 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13983 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
13985 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
13986 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13987 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13988 long ret_ref = (long)ret_var.inner;
13989 if (ret_var.is_owned) {
13995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13996 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
13997 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13998 *ret = SocketDescriptor_clone(orig_conv);
14002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14003 if ((this_ptr & 1) != 0) return;
14004 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
14005 FREE((void*)this_ptr);
14006 SocketDescriptor_free(this_ptr_conv);
14009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14010 LDKPeerHandleError this_ptr_conv;
14011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14012 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14013 PeerHandleError_free(this_ptr_conv);
14016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14017 LDKPeerHandleError orig_conv;
14018 orig_conv.inner = (void*)(orig & (~1));
14019 orig_conv.is_owned = false;
14020 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
14021 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14022 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14023 long ret_ref = (long)ret_var.inner;
14024 if (ret_var.is_owned) {
14030 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
14031 LDKPeerHandleError this_ptr_conv;
14032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14033 this_ptr_conv.is_owned = false;
14034 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
14038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14039 LDKPeerHandleError this_ptr_conv;
14040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14041 this_ptr_conv.is_owned = false;
14042 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
14045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
14046 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
14047 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14048 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14049 long ret_ref = (long)ret_var.inner;
14050 if (ret_var.is_owned) {
14056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14057 LDKPeerManager this_ptr_conv;
14058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14060 PeerManager_free(this_ptr_conv);
14063 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) {
14064 LDKMessageHandler message_handler_conv;
14065 message_handler_conv.inner = (void*)(message_handler & (~1));
14066 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
14067 // Warning: we need a move here but no clone is available for LDKMessageHandler
14068 LDKSecretKey our_node_secret_ref;
14069 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
14070 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
14071 unsigned char ephemeral_random_data_arr[32];
14072 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
14073 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
14074 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
14075 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14076 if (logger_conv.free == LDKLogger_JCalls_free) {
14077 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14078 LDKLogger_JCalls_clone(logger_conv.this_arg);
14080 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
14081 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14082 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14083 long ret_ref = (long)ret_var.inner;
14084 if (ret_var.is_owned) {
14090 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
14091 LDKPeerManager this_arg_conv;
14092 this_arg_conv.inner = (void*)(this_arg & (~1));
14093 this_arg_conv.is_owned = false;
14094 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
14095 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14097 for (size_t i = 0; i < ret_var.datalen; i++) {
14098 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 33);
14099 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
14100 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
14102 FREE(ret_var.data);
14106 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) {
14107 LDKPeerManager this_arg_conv;
14108 this_arg_conv.inner = (void*)(this_arg & (~1));
14109 this_arg_conv.is_owned = false;
14110 LDKPublicKey their_node_id_ref;
14111 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14112 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14113 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
14114 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14115 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14116 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14118 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
14119 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
14120 return (long)ret_conv;
14123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14124 LDKPeerManager this_arg_conv;
14125 this_arg_conv.inner = (void*)(this_arg & (~1));
14126 this_arg_conv.is_owned = false;
14127 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
14128 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14129 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14130 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14132 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14133 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
14134 return (long)ret_conv;
14137 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) {
14138 LDKPeerManager this_arg_conv;
14139 this_arg_conv.inner = (void*)(this_arg & (~1));
14140 this_arg_conv.is_owned = false;
14141 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14142 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14143 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
14144 return (long)ret_conv;
14147 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) {
14148 LDKPeerManager this_arg_conv;
14149 this_arg_conv.inner = (void*)(this_arg & (~1));
14150 this_arg_conv.is_owned = false;
14151 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
14152 LDKu8slice data_ref;
14153 data_ref.datalen = (*env)->GetArrayLength(env, data);
14154 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
14155 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
14156 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
14157 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
14158 return (long)ret_conv;
14161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14162 LDKPeerManager this_arg_conv;
14163 this_arg_conv.inner = (void*)(this_arg & (~1));
14164 this_arg_conv.is_owned = false;
14165 PeerManager_process_events(&this_arg_conv);
14168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14169 LDKPeerManager this_arg_conv;
14170 this_arg_conv.inner = (void*)(this_arg & (~1));
14171 this_arg_conv.is_owned = false;
14172 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14173 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
14176 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) {
14177 LDKPeerManager this_arg_conv;
14178 this_arg_conv.inner = (void*)(this_arg & (~1));
14179 this_arg_conv.is_owned = false;
14180 LDKPublicKey node_id_ref;
14181 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14182 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14183 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
14186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv *env, jclass clz, int64_t this_arg) {
14187 LDKPeerManager this_arg_conv;
14188 this_arg_conv.inner = (void*)(this_arg & (~1));
14189 this_arg_conv.is_owned = false;
14190 PeerManager_timer_tick_occured(&this_arg_conv);
14193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
14194 unsigned char commitment_seed_arr[32];
14195 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
14196 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
14197 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
14198 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
14199 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
14203 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) {
14204 LDKPublicKey per_commitment_point_ref;
14205 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14206 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14207 unsigned char base_secret_arr[32];
14208 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
14209 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
14210 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
14211 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14212 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
14213 return (long)ret_conv;
14216 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) {
14217 LDKPublicKey per_commitment_point_ref;
14218 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14219 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14220 LDKPublicKey base_point_ref;
14221 CHECK((*env)->GetArrayLength(env, base_point) == 33);
14222 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
14223 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14224 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
14225 return (long)ret_conv;
14228 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) {
14229 unsigned char per_commitment_secret_arr[32];
14230 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
14231 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
14232 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
14233 unsigned char countersignatory_revocation_base_secret_arr[32];
14234 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
14235 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
14236 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
14237 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14238 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
14239 return (long)ret_conv;
14242 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) {
14243 LDKPublicKey per_commitment_point_ref;
14244 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14245 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14246 LDKPublicKey countersignatory_revocation_base_point_ref;
14247 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
14248 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
14249 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14250 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
14251 return (long)ret_conv;
14254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14255 LDKTxCreationKeys this_ptr_conv;
14256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14257 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14258 TxCreationKeys_free(this_ptr_conv);
14261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14262 LDKTxCreationKeys orig_conv;
14263 orig_conv.inner = (void*)(orig & (~1));
14264 orig_conv.is_owned = false;
14265 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
14266 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14267 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14268 long ret_ref = (long)ret_var.inner;
14269 if (ret_var.is_owned) {
14275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14276 LDKTxCreationKeys this_ptr_conv;
14277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14278 this_ptr_conv.is_owned = false;
14279 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14280 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
14284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14285 LDKTxCreationKeys this_ptr_conv;
14286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14287 this_ptr_conv.is_owned = false;
14288 LDKPublicKey val_ref;
14289 CHECK((*env)->GetArrayLength(env, val) == 33);
14290 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14291 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
14294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14295 LDKTxCreationKeys this_ptr_conv;
14296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14297 this_ptr_conv.is_owned = false;
14298 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14299 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
14303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14304 LDKTxCreationKeys this_ptr_conv;
14305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14306 this_ptr_conv.is_owned = false;
14307 LDKPublicKey val_ref;
14308 CHECK((*env)->GetArrayLength(env, val) == 33);
14309 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14310 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
14313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14314 LDKTxCreationKeys this_ptr_conv;
14315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14316 this_ptr_conv.is_owned = false;
14317 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14318 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
14322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14323 LDKTxCreationKeys this_ptr_conv;
14324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14325 this_ptr_conv.is_owned = false;
14326 LDKPublicKey val_ref;
14327 CHECK((*env)->GetArrayLength(env, val) == 33);
14328 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14329 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
14332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14333 LDKTxCreationKeys this_ptr_conv;
14334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14335 this_ptr_conv.is_owned = false;
14336 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14337 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
14341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14342 LDKTxCreationKeys this_ptr_conv;
14343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14344 this_ptr_conv.is_owned = false;
14345 LDKPublicKey val_ref;
14346 CHECK((*env)->GetArrayLength(env, val) == 33);
14347 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14348 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
14351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14352 LDKTxCreationKeys this_ptr_conv;
14353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14354 this_ptr_conv.is_owned = false;
14355 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14356 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
14360 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) {
14361 LDKTxCreationKeys this_ptr_conv;
14362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14363 this_ptr_conv.is_owned = false;
14364 LDKPublicKey val_ref;
14365 CHECK((*env)->GetArrayLength(env, val) == 33);
14366 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14367 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
14370 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) {
14371 LDKPublicKey per_commitment_point_arg_ref;
14372 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14373 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14374 LDKPublicKey revocation_key_arg_ref;
14375 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
14376 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
14377 LDKPublicKey broadcaster_htlc_key_arg_ref;
14378 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
14379 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
14380 LDKPublicKey countersignatory_htlc_key_arg_ref;
14381 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
14382 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
14383 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
14384 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
14385 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
14386 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);
14387 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14388 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14389 long ret_ref = (long)ret_var.inner;
14390 if (ret_var.is_owned) {
14396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
14397 LDKTxCreationKeys obj_conv;
14398 obj_conv.inner = (void*)(obj & (~1));
14399 obj_conv.is_owned = false;
14400 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
14401 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14402 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14403 CVec_u8Z_free(arg_var);
14407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14408 LDKu8slice ser_ref;
14409 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14410 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14411 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
14412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14414 long ret_ref = (long)ret_var.inner;
14415 if (ret_var.is_owned) {
14418 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14423 LDKChannelPublicKeys this_ptr_conv;
14424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14426 ChannelPublicKeys_free(this_ptr_conv);
14429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14430 LDKChannelPublicKeys orig_conv;
14431 orig_conv.inner = (void*)(orig & (~1));
14432 orig_conv.is_owned = false;
14433 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
14434 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14435 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14436 long ret_ref = (long)ret_var.inner;
14437 if (ret_var.is_owned) {
14443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14444 LDKChannelPublicKeys this_ptr_conv;
14445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14446 this_ptr_conv.is_owned = false;
14447 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14448 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
14452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14453 LDKChannelPublicKeys this_ptr_conv;
14454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14455 this_ptr_conv.is_owned = false;
14456 LDKPublicKey val_ref;
14457 CHECK((*env)->GetArrayLength(env, val) == 33);
14458 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14459 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
14462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14463 LDKChannelPublicKeys this_ptr_conv;
14464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14465 this_ptr_conv.is_owned = false;
14466 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14467 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
14471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14472 LDKChannelPublicKeys this_ptr_conv;
14473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14474 this_ptr_conv.is_owned = false;
14475 LDKPublicKey val_ref;
14476 CHECK((*env)->GetArrayLength(env, val) == 33);
14477 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14478 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
14481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14482 LDKChannelPublicKeys this_ptr_conv;
14483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14484 this_ptr_conv.is_owned = false;
14485 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14486 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
14490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14491 LDKChannelPublicKeys this_ptr_conv;
14492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14493 this_ptr_conv.is_owned = false;
14494 LDKPublicKey val_ref;
14495 CHECK((*env)->GetArrayLength(env, val) == 33);
14496 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14497 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
14500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14501 LDKChannelPublicKeys this_ptr_conv;
14502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14503 this_ptr_conv.is_owned = false;
14504 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14505 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
14509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14510 LDKChannelPublicKeys this_ptr_conv;
14511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14512 this_ptr_conv.is_owned = false;
14513 LDKPublicKey val_ref;
14514 CHECK((*env)->GetArrayLength(env, val) == 33);
14515 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14516 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
14519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14520 LDKChannelPublicKeys this_ptr_conv;
14521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14522 this_ptr_conv.is_owned = false;
14523 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14524 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
14528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14529 LDKChannelPublicKeys this_ptr_conv;
14530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14531 this_ptr_conv.is_owned = false;
14532 LDKPublicKey val_ref;
14533 CHECK((*env)->GetArrayLength(env, val) == 33);
14534 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14535 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
14538 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) {
14539 LDKPublicKey funding_pubkey_arg_ref;
14540 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
14541 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
14542 LDKPublicKey revocation_basepoint_arg_ref;
14543 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
14544 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
14545 LDKPublicKey payment_point_arg_ref;
14546 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
14547 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
14548 LDKPublicKey delayed_payment_basepoint_arg_ref;
14549 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
14550 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
14551 LDKPublicKey htlc_basepoint_arg_ref;
14552 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
14553 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
14554 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);
14555 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14556 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14557 long ret_ref = (long)ret_var.inner;
14558 if (ret_var.is_owned) {
14564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
14565 LDKChannelPublicKeys obj_conv;
14566 obj_conv.inner = (void*)(obj & (~1));
14567 obj_conv.is_owned = false;
14568 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
14569 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14570 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14571 CVec_u8Z_free(arg_var);
14575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14576 LDKu8slice ser_ref;
14577 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14578 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14579 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
14580 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14581 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14582 long ret_ref = (long)ret_var.inner;
14583 if (ret_var.is_owned) {
14586 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14590 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) {
14591 LDKPublicKey per_commitment_point_ref;
14592 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14593 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14594 LDKPublicKey broadcaster_delayed_payment_base_ref;
14595 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
14596 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
14597 LDKPublicKey broadcaster_htlc_base_ref;
14598 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
14599 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
14600 LDKPublicKey countersignatory_revocation_base_ref;
14601 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
14602 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
14603 LDKPublicKey countersignatory_htlc_base_ref;
14604 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
14605 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
14606 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14607 *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);
14608 return (long)ret_conv;
14611 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) {
14612 LDKPublicKey per_commitment_point_ref;
14613 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14614 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14615 LDKChannelPublicKeys broadcaster_keys_conv;
14616 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
14617 broadcaster_keys_conv.is_owned = false;
14618 LDKChannelPublicKeys countersignatory_keys_conv;
14619 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
14620 countersignatory_keys_conv.is_owned = false;
14621 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14622 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
14623 return (long)ret_conv;
14626 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) {
14627 LDKPublicKey revocation_key_ref;
14628 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
14629 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14630 LDKPublicKey broadcaster_delayed_payment_key_ref;
14631 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
14632 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14633 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
14634 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14635 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14636 CVec_u8Z_free(arg_var);
14640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14641 LDKHTLCOutputInCommitment this_ptr_conv;
14642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14644 HTLCOutputInCommitment_free(this_ptr_conv);
14647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14648 LDKHTLCOutputInCommitment orig_conv;
14649 orig_conv.inner = (void*)(orig & (~1));
14650 orig_conv.is_owned = false;
14651 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
14652 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14653 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14654 long ret_ref = (long)ret_var.inner;
14655 if (ret_var.is_owned) {
14661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
14662 LDKHTLCOutputInCommitment this_ptr_conv;
14663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14664 this_ptr_conv.is_owned = false;
14665 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
14669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14670 LDKHTLCOutputInCommitment this_ptr_conv;
14671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14672 this_ptr_conv.is_owned = false;
14673 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
14676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14677 LDKHTLCOutputInCommitment this_ptr_conv;
14678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14679 this_ptr_conv.is_owned = false;
14680 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
14684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14685 LDKHTLCOutputInCommitment this_ptr_conv;
14686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14687 this_ptr_conv.is_owned = false;
14688 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
14691 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
14692 LDKHTLCOutputInCommitment this_ptr_conv;
14693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14694 this_ptr_conv.is_owned = false;
14695 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
14699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14700 LDKHTLCOutputInCommitment this_ptr_conv;
14701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14702 this_ptr_conv.is_owned = false;
14703 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
14706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14707 LDKHTLCOutputInCommitment this_ptr_conv;
14708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14709 this_ptr_conv.is_owned = false;
14710 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14711 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
14715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14716 LDKHTLCOutputInCommitment this_ptr_conv;
14717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14718 this_ptr_conv.is_owned = false;
14719 LDKThirtyTwoBytes val_ref;
14720 CHECK((*env)->GetArrayLength(env, val) == 32);
14721 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14722 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
14725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
14726 LDKHTLCOutputInCommitment obj_conv;
14727 obj_conv.inner = (void*)(obj & (~1));
14728 obj_conv.is_owned = false;
14729 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
14730 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14731 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14732 CVec_u8Z_free(arg_var);
14736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14737 LDKu8slice ser_ref;
14738 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14739 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14740 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
14741 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14742 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14743 long ret_ref = (long)ret_var.inner;
14744 if (ret_var.is_owned) {
14747 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
14752 LDKHTLCOutputInCommitment htlc_conv;
14753 htlc_conv.inner = (void*)(htlc & (~1));
14754 htlc_conv.is_owned = false;
14755 LDKTxCreationKeys keys_conv;
14756 keys_conv.inner = (void*)(keys & (~1));
14757 keys_conv.is_owned = false;
14758 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
14759 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14760 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14761 CVec_u8Z_free(arg_var);
14765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
14766 LDKPublicKey broadcaster_ref;
14767 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
14768 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
14769 LDKPublicKey countersignatory_ref;
14770 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
14771 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
14772 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
14773 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14774 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14775 CVec_u8Z_free(arg_var);
14779 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) {
14780 unsigned char prev_hash_arr[32];
14781 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
14782 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
14783 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
14784 LDKHTLCOutputInCommitment htlc_conv;
14785 htlc_conv.inner = (void*)(htlc & (~1));
14786 htlc_conv.is_owned = false;
14787 LDKPublicKey broadcaster_delayed_payment_key_ref;
14788 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
14789 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14790 LDKPublicKey revocation_key_ref;
14791 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
14792 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14793 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
14794 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14795 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14796 Transaction_free(arg_var);
14800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14801 LDKChannelTransactionParameters this_ptr_conv;
14802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14803 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14804 ChannelTransactionParameters_free(this_ptr_conv);
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14808 LDKChannelTransactionParameters orig_conv;
14809 orig_conv.inner = (void*)(orig & (~1));
14810 orig_conv.is_owned = false;
14811 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
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_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
14822 LDKChannelTransactionParameters this_ptr_conv;
14823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14824 this_ptr_conv.is_owned = false;
14825 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_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_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14836 LDKChannelTransactionParameters this_ptr_conv;
14837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14838 this_ptr_conv.is_owned = false;
14839 LDKChannelPublicKeys val_conv;
14840 val_conv.inner = (void*)(val & (~1));
14841 val_conv.is_owned = (val & 1) || (val == 0);
14842 val_conv = ChannelPublicKeys_clone(&val_conv);
14843 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
14846 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14847 LDKChannelTransactionParameters this_ptr_conv;
14848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14849 this_ptr_conv.is_owned = false;
14850 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
14854 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) {
14855 LDKChannelTransactionParameters this_ptr_conv;
14856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14857 this_ptr_conv.is_owned = false;
14858 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
14861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
14862 LDKChannelTransactionParameters this_ptr_conv;
14863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14864 this_ptr_conv.is_owned = false;
14865 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
14869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14870 LDKChannelTransactionParameters this_ptr_conv;
14871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14872 this_ptr_conv.is_owned = false;
14873 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
14876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
14877 LDKChannelTransactionParameters this_ptr_conv;
14878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14879 this_ptr_conv.is_owned = false;
14880 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
14881 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14882 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14883 long ret_ref = (long)ret_var.inner;
14884 if (ret_var.is_owned) {
14890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14891 LDKChannelTransactionParameters this_ptr_conv;
14892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14893 this_ptr_conv.is_owned = false;
14894 LDKCounterpartyChannelTransactionParameters val_conv;
14895 val_conv.inner = (void*)(val & (~1));
14896 val_conv.is_owned = (val & 1) || (val == 0);
14897 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
14898 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
14901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14902 LDKChannelTransactionParameters this_ptr_conv;
14903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14904 this_ptr_conv.is_owned = false;
14905 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
14906 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14907 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14908 long ret_ref = (long)ret_var.inner;
14909 if (ret_var.is_owned) {
14915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14916 LDKChannelTransactionParameters this_ptr_conv;
14917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14918 this_ptr_conv.is_owned = false;
14919 LDKOutPoint val_conv;
14920 val_conv.inner = (void*)(val & (~1));
14921 val_conv.is_owned = (val & 1) || (val == 0);
14922 val_conv = OutPoint_clone(&val_conv);
14923 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
14926 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) {
14927 LDKChannelPublicKeys holder_pubkeys_arg_conv;
14928 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
14929 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
14930 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
14931 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
14932 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
14933 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
14934 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
14935 LDKOutPoint funding_outpoint_arg_conv;
14936 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
14937 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
14938 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
14939 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);
14940 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14941 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14942 long ret_ref = (long)ret_var.inner;
14943 if (ret_var.is_owned) {
14949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14950 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14952 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14953 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
14956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14957 LDKCounterpartyChannelTransactionParameters orig_conv;
14958 orig_conv.inner = (void*)(orig & (~1));
14959 orig_conv.is_owned = false;
14960 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
14961 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14962 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14963 long ret_ref = (long)ret_var.inner;
14964 if (ret_var.is_owned) {
14970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
14971 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14973 this_ptr_conv.is_owned = false;
14974 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
14975 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14976 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14977 long ret_ref = (long)ret_var.inner;
14978 if (ret_var.is_owned) {
14984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14985 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14987 this_ptr_conv.is_owned = false;
14988 LDKChannelPublicKeys val_conv;
14989 val_conv.inner = (void*)(val & (~1));
14990 val_conv.is_owned = (val & 1) || (val == 0);
14991 val_conv = ChannelPublicKeys_clone(&val_conv);
14992 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
14995 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14996 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14998 this_ptr_conv.is_owned = false;
14999 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
15003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15004 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15006 this_ptr_conv.is_owned = false;
15007 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
15010 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) {
15011 LDKChannelPublicKeys pubkeys_arg_conv;
15012 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
15013 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
15014 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
15015 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
15016 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15017 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15018 long ret_ref = (long)ret_var.inner;
15019 if (ret_var.is_owned) {
15025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
15026 LDKChannelTransactionParameters this_arg_conv;
15027 this_arg_conv.inner = (void*)(this_arg & (~1));
15028 this_arg_conv.is_owned = false;
15029 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
15033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
15034 LDKChannelTransactionParameters this_arg_conv;
15035 this_arg_conv.inner = (void*)(this_arg & (~1));
15036 this_arg_conv.is_owned = false;
15037 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
15038 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15039 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15040 long ret_ref = (long)ret_var.inner;
15041 if (ret_var.is_owned) {
15047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
15048 LDKChannelTransactionParameters this_arg_conv;
15049 this_arg_conv.inner = (void*)(this_arg & (~1));
15050 this_arg_conv.is_owned = false;
15051 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
15052 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15053 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15054 long ret_ref = (long)ret_var.inner;
15055 if (ret_var.is_owned) {
15061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
15062 LDKCounterpartyChannelTransactionParameters obj_conv;
15063 obj_conv.inner = (void*)(obj & (~1));
15064 obj_conv.is_owned = false;
15065 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
15066 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15067 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15068 CVec_u8Z_free(arg_var);
15072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15073 LDKu8slice ser_ref;
15074 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15075 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15076 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
15077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15079 long ret_ref = (long)ret_var.inner;
15080 if (ret_var.is_owned) {
15083 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
15088 LDKChannelTransactionParameters obj_conv;
15089 obj_conv.inner = (void*)(obj & (~1));
15090 obj_conv.is_owned = false;
15091 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
15092 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15093 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15094 CVec_u8Z_free(arg_var);
15098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15099 LDKu8slice ser_ref;
15100 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15101 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15102 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
15103 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15104 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15105 long ret_ref = (long)ret_var.inner;
15106 if (ret_var.is_owned) {
15109 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15114 LDKDirectedChannelTransactionParameters this_ptr_conv;
15115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15116 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15117 DirectedChannelTransactionParameters_free(this_ptr_conv);
15120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15121 LDKDirectedChannelTransactionParameters this_arg_conv;
15122 this_arg_conv.inner = (void*)(this_arg & (~1));
15123 this_arg_conv.is_owned = false;
15124 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
15125 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15126 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15127 long ret_ref = (long)ret_var.inner;
15128 if (ret_var.is_owned) {
15134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15135 LDKDirectedChannelTransactionParameters this_arg_conv;
15136 this_arg_conv.inner = (void*)(this_arg & (~1));
15137 this_arg_conv.is_owned = false;
15138 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
15139 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15140 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15141 long ret_ref = (long)ret_var.inner;
15142 if (ret_var.is_owned) {
15148 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15149 LDKDirectedChannelTransactionParameters this_arg_conv;
15150 this_arg_conv.inner = (void*)(this_arg & (~1));
15151 this_arg_conv.is_owned = false;
15152 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
15156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
15157 LDKDirectedChannelTransactionParameters this_arg_conv;
15158 this_arg_conv.inner = (void*)(this_arg & (~1));
15159 this_arg_conv.is_owned = false;
15160 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
15164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
15165 LDKDirectedChannelTransactionParameters this_arg_conv;
15166 this_arg_conv.inner = (void*)(this_arg & (~1));
15167 this_arg_conv.is_owned = false;
15168 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
15169 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15170 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15171 long ret_ref = (long)ret_var.inner;
15172 if (ret_var.is_owned) {
15178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15179 LDKHolderCommitmentTransaction this_ptr_conv;
15180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15182 HolderCommitmentTransaction_free(this_ptr_conv);
15185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15186 LDKHolderCommitmentTransaction orig_conv;
15187 orig_conv.inner = (void*)(orig & (~1));
15188 orig_conv.is_owned = false;
15189 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
15190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15192 long ret_ref = (long)ret_var.inner;
15193 if (ret_var.is_owned) {
15199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
15200 LDKHolderCommitmentTransaction this_ptr_conv;
15201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15202 this_ptr_conv.is_owned = false;
15203 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
15204 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
15208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15209 LDKHolderCommitmentTransaction this_ptr_conv;
15210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15211 this_ptr_conv.is_owned = false;
15212 LDKSignature val_ref;
15213 CHECK((*env)->GetArrayLength(env, val) == 64);
15214 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15215 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
15218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
15219 LDKHolderCommitmentTransaction this_ptr_conv;
15220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15221 this_ptr_conv.is_owned = false;
15222 LDKCVec_SignatureZ val_constr;
15223 val_constr.datalen = (*env)->GetArrayLength(env, val);
15224 if (val_constr.datalen > 0)
15225 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15227 val_constr.data = NULL;
15228 for (size_t i = 0; i < val_constr.datalen; i++) {
15229 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
15230 LDKSignature arr_conv_8_ref;
15231 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
15232 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15233 val_constr.data[i] = arr_conv_8_ref;
15235 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
15238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15239 LDKHolderCommitmentTransaction obj_conv;
15240 obj_conv.inner = (void*)(obj & (~1));
15241 obj_conv.is_owned = false;
15242 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
15243 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15244 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15245 CVec_u8Z_free(arg_var);
15249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15250 LDKu8slice ser_ref;
15251 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15252 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15253 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
15254 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15255 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15256 long ret_ref = (long)ret_var.inner;
15257 if (ret_var.is_owned) {
15260 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15264 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) {
15265 LDKCommitmentTransaction commitment_tx_conv;
15266 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
15267 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
15268 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
15269 LDKSignature counterparty_sig_ref;
15270 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
15271 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
15272 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
15273 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
15274 if (counterparty_htlc_sigs_constr.datalen > 0)
15275 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15277 counterparty_htlc_sigs_constr.data = NULL;
15278 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
15279 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
15280 LDKSignature arr_conv_8_ref;
15281 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
15282 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15283 counterparty_htlc_sigs_constr.data[i] = arr_conv_8_ref;
15285 LDKPublicKey holder_funding_key_ref;
15286 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
15287 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
15288 LDKPublicKey counterparty_funding_key_ref;
15289 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
15290 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
15291 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
15292 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15293 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15294 long ret_ref = (long)ret_var.inner;
15295 if (ret_var.is_owned) {
15301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15302 LDKBuiltCommitmentTransaction this_ptr_conv;
15303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15305 BuiltCommitmentTransaction_free(this_ptr_conv);
15308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15309 LDKBuiltCommitmentTransaction orig_conv;
15310 orig_conv.inner = (void*)(orig & (~1));
15311 orig_conv.is_owned = false;
15312 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
15313 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15314 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15315 long ret_ref = (long)ret_var.inner;
15316 if (ret_var.is_owned) {
15322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
15323 LDKBuiltCommitmentTransaction this_ptr_conv;
15324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15325 this_ptr_conv.is_owned = false;
15326 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
15327 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15328 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15329 Transaction_free(arg_var);
15333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15334 LDKBuiltCommitmentTransaction this_ptr_conv;
15335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15336 this_ptr_conv.is_owned = false;
15337 LDKTransaction val_ref;
15338 val_ref.datalen = (*env)->GetArrayLength(env, val);
15339 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
15340 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
15341 val_ref.data_is_owned = true;
15342 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
15345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
15346 LDKBuiltCommitmentTransaction this_ptr_conv;
15347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15348 this_ptr_conv.is_owned = false;
15349 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15350 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
15354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15355 LDKBuiltCommitmentTransaction this_ptr_conv;
15356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15357 this_ptr_conv.is_owned = false;
15358 LDKThirtyTwoBytes val_ref;
15359 CHECK((*env)->GetArrayLength(env, val) == 32);
15360 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15361 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
15364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
15365 LDKTransaction transaction_arg_ref;
15366 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
15367 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
15368 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
15369 transaction_arg_ref.data_is_owned = true;
15370 LDKThirtyTwoBytes txid_arg_ref;
15371 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
15372 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
15373 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
15374 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15375 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15376 long ret_ref = (long)ret_var.inner;
15377 if (ret_var.is_owned) {
15383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15384 LDKBuiltCommitmentTransaction obj_conv;
15385 obj_conv.inner = (void*)(obj & (~1));
15386 obj_conv.is_owned = false;
15387 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
15388 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15389 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15390 CVec_u8Z_free(arg_var);
15394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15395 LDKu8slice ser_ref;
15396 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15397 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15398 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
15399 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15400 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15401 long ret_ref = (long)ret_var.inner;
15402 if (ret_var.is_owned) {
15405 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15409 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) {
15410 LDKBuiltCommitmentTransaction this_arg_conv;
15411 this_arg_conv.inner = (void*)(this_arg & (~1));
15412 this_arg_conv.is_owned = false;
15413 LDKu8slice funding_redeemscript_ref;
15414 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
15415 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
15416 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
15417 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
15418 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15422 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) {
15423 LDKBuiltCommitmentTransaction this_arg_conv;
15424 this_arg_conv.inner = (void*)(this_arg & (~1));
15425 this_arg_conv.is_owned = false;
15426 unsigned char funding_key_arr[32];
15427 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
15428 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
15429 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
15430 LDKu8slice funding_redeemscript_ref;
15431 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
15432 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
15433 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
15434 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
15435 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15440 LDKCommitmentTransaction this_ptr_conv;
15441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15443 CommitmentTransaction_free(this_ptr_conv);
15446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15447 LDKCommitmentTransaction orig_conv;
15448 orig_conv.inner = (void*)(orig & (~1));
15449 orig_conv.is_owned = false;
15450 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
15451 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15452 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15453 long ret_ref = (long)ret_var.inner;
15454 if (ret_var.is_owned) {
15460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15461 LDKCommitmentTransaction obj_conv;
15462 obj_conv.inner = (void*)(obj & (~1));
15463 obj_conv.is_owned = false;
15464 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
15465 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15466 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15467 CVec_u8Z_free(arg_var);
15471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15472 LDKu8slice ser_ref;
15473 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15474 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15475 LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
15476 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15477 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15478 long ret_ref = (long)ret_var.inner;
15479 if (ret_var.is_owned) {
15482 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
15487 LDKCommitmentTransaction this_arg_conv;
15488 this_arg_conv.inner = (void*)(this_arg & (~1));
15489 this_arg_conv.is_owned = false;
15490 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
15494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
15495 LDKCommitmentTransaction this_arg_conv;
15496 this_arg_conv.inner = (void*)(this_arg & (~1));
15497 this_arg_conv.is_owned = false;
15498 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
15502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
15503 LDKCommitmentTransaction this_arg_conv;
15504 this_arg_conv.inner = (void*)(this_arg & (~1));
15505 this_arg_conv.is_owned = false;
15506 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
15510 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
15511 LDKCommitmentTransaction this_arg_conv;
15512 this_arg_conv.inner = (void*)(this_arg & (~1));
15513 this_arg_conv.is_owned = false;
15514 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
15518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
15519 LDKCommitmentTransaction this_arg_conv;
15520 this_arg_conv.inner = (void*)(this_arg & (~1));
15521 this_arg_conv.is_owned = false;
15522 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
15523 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15524 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15525 long ret_ref = (long)ret_var.inner;
15526 if (ret_var.is_owned) {
15532 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) {
15533 LDKCommitmentTransaction this_arg_conv;
15534 this_arg_conv.inner = (void*)(this_arg & (~1));
15535 this_arg_conv.is_owned = false;
15536 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15537 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15538 channel_parameters_conv.is_owned = false;
15539 LDKChannelPublicKeys broadcaster_keys_conv;
15540 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
15541 broadcaster_keys_conv.is_owned = false;
15542 LDKChannelPublicKeys countersignatory_keys_conv;
15543 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
15544 countersignatory_keys_conv.is_owned = false;
15545 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15546 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
15547 return (long)ret_conv;
15550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15551 LDKTrustedCommitmentTransaction this_ptr_conv;
15552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15554 TrustedCommitmentTransaction_free(this_ptr_conv);
15557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
15558 LDKTrustedCommitmentTransaction this_arg_conv;
15559 this_arg_conv.inner = (void*)(this_arg & (~1));
15560 this_arg_conv.is_owned = false;
15561 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
15562 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
15566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
15567 LDKTrustedCommitmentTransaction this_arg_conv;
15568 this_arg_conv.inner = (void*)(this_arg & (~1));
15569 this_arg_conv.is_owned = false;
15570 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
15571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15573 long ret_ref = (long)ret_var.inner;
15574 if (ret_var.is_owned) {
15580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
15581 LDKTrustedCommitmentTransaction this_arg_conv;
15582 this_arg_conv.inner = (void*)(this_arg & (~1));
15583 this_arg_conv.is_owned = false;
15584 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
15585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15587 long ret_ref = (long)ret_var.inner;
15588 if (ret_var.is_owned) {
15594 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) {
15595 LDKTrustedCommitmentTransaction this_arg_conv;
15596 this_arg_conv.inner = (void*)(this_arg & (~1));
15597 this_arg_conv.is_owned = false;
15598 unsigned char htlc_base_key_arr[32];
15599 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
15600 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
15601 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
15602 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15603 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15604 channel_parameters_conv.is_owned = false;
15605 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15606 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
15607 return (long)ret_conv;
15610 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) {
15611 LDKPublicKey broadcaster_payment_basepoint_ref;
15612 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
15613 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
15614 LDKPublicKey countersignatory_payment_basepoint_ref;
15615 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
15616 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
15617 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
15621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15622 LDKInitFeatures this_ptr_conv;
15623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15625 InitFeatures_free(this_ptr_conv);
15628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15629 LDKNodeFeatures this_ptr_conv;
15630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15632 NodeFeatures_free(this_ptr_conv);
15635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15636 LDKChannelFeatures this_ptr_conv;
15637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15639 ChannelFeatures_free(this_ptr_conv);
15642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15643 LDKRouteHop this_ptr_conv;
15644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15646 RouteHop_free(this_ptr_conv);
15649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15650 LDKRouteHop orig_conv;
15651 orig_conv.inner = (void*)(orig & (~1));
15652 orig_conv.is_owned = false;
15653 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
15654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15656 long ret_ref = (long)ret_var.inner;
15657 if (ret_var.is_owned) {
15663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15664 LDKRouteHop this_ptr_conv;
15665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15666 this_ptr_conv.is_owned = false;
15667 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
15668 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
15672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15673 LDKRouteHop this_ptr_conv;
15674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15675 this_ptr_conv.is_owned = false;
15676 LDKPublicKey val_ref;
15677 CHECK((*env)->GetArrayLength(env, val) == 33);
15678 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15679 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
15682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15683 LDKRouteHop this_ptr_conv;
15684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15685 this_ptr_conv.is_owned = false;
15686 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
15687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15689 long ret_ref = (long)ret_var.inner;
15690 if (ret_var.is_owned) {
15696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15697 LDKRouteHop this_ptr_conv;
15698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15699 this_ptr_conv.is_owned = false;
15700 LDKNodeFeatures val_conv;
15701 val_conv.inner = (void*)(val & (~1));
15702 val_conv.is_owned = (val & 1) || (val == 0);
15703 // Warning: we need a move here but no clone is available for LDKNodeFeatures
15704 RouteHop_set_node_features(&this_ptr_conv, val_conv);
15707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15708 LDKRouteHop this_ptr_conv;
15709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15710 this_ptr_conv.is_owned = false;
15711 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
15715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15716 LDKRouteHop this_ptr_conv;
15717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15718 this_ptr_conv.is_owned = false;
15719 RouteHop_set_short_channel_id(&this_ptr_conv, val);
15722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15723 LDKRouteHop this_ptr_conv;
15724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15725 this_ptr_conv.is_owned = false;
15726 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
15727 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15728 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15729 long ret_ref = (long)ret_var.inner;
15730 if (ret_var.is_owned) {
15736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15737 LDKRouteHop this_ptr_conv;
15738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15739 this_ptr_conv.is_owned = false;
15740 LDKChannelFeatures val_conv;
15741 val_conv.inner = (void*)(val & (~1));
15742 val_conv.is_owned = (val & 1) || (val == 0);
15743 // Warning: we need a move here but no clone is available for LDKChannelFeatures
15744 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
15747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15748 LDKRouteHop this_ptr_conv;
15749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15750 this_ptr_conv.is_owned = false;
15751 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
15755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15756 LDKRouteHop this_ptr_conv;
15757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15758 this_ptr_conv.is_owned = false;
15759 RouteHop_set_fee_msat(&this_ptr_conv, val);
15762 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15763 LDKRouteHop this_ptr_conv;
15764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15765 this_ptr_conv.is_owned = false;
15766 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
15770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15771 LDKRouteHop this_ptr_conv;
15772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15773 this_ptr_conv.is_owned = false;
15774 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
15777 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) {
15778 LDKPublicKey pubkey_arg_ref;
15779 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
15780 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
15781 LDKNodeFeatures node_features_arg_conv;
15782 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
15783 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
15784 // Warning: we need a move here but no clone is available for LDKNodeFeatures
15785 LDKChannelFeatures channel_features_arg_conv;
15786 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
15787 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
15788 // Warning: we need a move here but no clone is available for LDKChannelFeatures
15789 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);
15790 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15791 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15792 long ret_ref = (long)ret_var.inner;
15793 if (ret_var.is_owned) {
15799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15800 LDKRoute this_ptr_conv;
15801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15803 Route_free(this_ptr_conv);
15806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15807 LDKRoute orig_conv;
15808 orig_conv.inner = (void*)(orig & (~1));
15809 orig_conv.is_owned = false;
15810 LDKRoute ret_var = Route_clone(&orig_conv);
15811 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15812 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15813 long ret_ref = (long)ret_var.inner;
15814 if (ret_var.is_owned) {
15820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
15821 LDKRoute this_ptr_conv;
15822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15823 this_ptr_conv.is_owned = false;
15824 LDKCVec_CVec_RouteHopZZ val_constr;
15825 val_constr.datalen = (*env)->GetArrayLength(env, val);
15826 if (val_constr.datalen > 0)
15827 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15829 val_constr.data = NULL;
15830 for (size_t m = 0; m < val_constr.datalen; m++) {
15831 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
15832 LDKCVec_RouteHopZ arr_conv_12_constr;
15833 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
15834 if (arr_conv_12_constr.datalen > 0)
15835 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15837 arr_conv_12_constr.data = NULL;
15838 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
15839 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15840 int64_t arr_conv_10 = arr_conv_12_vals[k];
15841 LDKRouteHop arr_conv_10_conv;
15842 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15843 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15844 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
15845 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15847 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
15848 val_constr.data[m] = arr_conv_12_constr;
15850 Route_set_paths(&this_ptr_conv, val_constr);
15853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
15854 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
15855 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
15856 if (paths_arg_constr.datalen > 0)
15857 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15859 paths_arg_constr.data = NULL;
15860 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
15861 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
15862 LDKCVec_RouteHopZ arr_conv_12_constr;
15863 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
15864 if (arr_conv_12_constr.datalen > 0)
15865 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15867 arr_conv_12_constr.data = NULL;
15868 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
15869 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15870 int64_t arr_conv_10 = arr_conv_12_vals[k];
15871 LDKRouteHop arr_conv_10_conv;
15872 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15873 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15874 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
15875 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15877 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
15878 paths_arg_constr.data[m] = arr_conv_12_constr;
15880 LDKRoute ret_var = Route_new(paths_arg_constr);
15881 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15882 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15883 long ret_ref = (long)ret_var.inner;
15884 if (ret_var.is_owned) {
15890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
15892 obj_conv.inner = (void*)(obj & (~1));
15893 obj_conv.is_owned = false;
15894 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
15895 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15896 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15897 CVec_u8Z_free(arg_var);
15901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15902 LDKu8slice ser_ref;
15903 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15904 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15905 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15906 *ret_conv = Route_read(ser_ref);
15907 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15908 return (long)ret_conv;
15911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15912 LDKRouteHint this_ptr_conv;
15913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15915 RouteHint_free(this_ptr_conv);
15918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15919 LDKRouteHint orig_conv;
15920 orig_conv.inner = (void*)(orig & (~1));
15921 orig_conv.is_owned = false;
15922 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
15923 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15924 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15925 long ret_ref = (long)ret_var.inner;
15926 if (ret_var.is_owned) {
15932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15933 LDKRouteHint this_ptr_conv;
15934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15935 this_ptr_conv.is_owned = false;
15936 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
15937 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
15941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15942 LDKRouteHint this_ptr_conv;
15943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15944 this_ptr_conv.is_owned = false;
15945 LDKPublicKey val_ref;
15946 CHECK((*env)->GetArrayLength(env, val) == 33);
15947 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15948 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
15951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15952 LDKRouteHint this_ptr_conv;
15953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15954 this_ptr_conv.is_owned = false;
15955 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
15959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15960 LDKRouteHint this_ptr_conv;
15961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15962 this_ptr_conv.is_owned = false;
15963 RouteHint_set_short_channel_id(&this_ptr_conv, val);
15966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
15967 LDKRouteHint this_ptr_conv;
15968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15969 this_ptr_conv.is_owned = false;
15970 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
15971 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15972 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15973 long ret_ref = (long)ret_var.inner;
15974 if (ret_var.is_owned) {
15980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15981 LDKRouteHint this_ptr_conv;
15982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15983 this_ptr_conv.is_owned = false;
15984 LDKRoutingFees val_conv;
15985 val_conv.inner = (void*)(val & (~1));
15986 val_conv.is_owned = (val & 1) || (val == 0);
15987 val_conv = RoutingFees_clone(&val_conv);
15988 RouteHint_set_fees(&this_ptr_conv, val_conv);
15991 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15992 LDKRouteHint this_ptr_conv;
15993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15994 this_ptr_conv.is_owned = false;
15995 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
15999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16000 LDKRouteHint this_ptr_conv;
16001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16002 this_ptr_conv.is_owned = false;
16003 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
16006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16007 LDKRouteHint this_ptr_conv;
16008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16009 this_ptr_conv.is_owned = false;
16010 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
16014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16015 LDKRouteHint this_ptr_conv;
16016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16017 this_ptr_conv.is_owned = false;
16018 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
16021 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) {
16022 LDKPublicKey src_node_id_arg_ref;
16023 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
16024 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
16025 LDKRoutingFees fees_arg_conv;
16026 fees_arg_conv.inner = (void*)(fees_arg & (~1));
16027 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
16028 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
16029 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);
16030 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16031 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16032 long ret_ref = (long)ret_var.inner;
16033 if (ret_var.is_owned) {
16039 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 target, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
16040 LDKPublicKey our_node_id_ref;
16041 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
16042 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
16043 LDKNetworkGraph network_conv;
16044 network_conv.inner = (void*)(network & (~1));
16045 network_conv.is_owned = false;
16046 LDKPublicKey target_ref;
16047 CHECK((*env)->GetArrayLength(env, target) == 33);
16048 (*env)->GetByteArrayRegion(env, target, 0, 33, target_ref.compressed_form);
16049 LDKCVec_ChannelDetailsZ first_hops_constr;
16050 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
16051 if (first_hops_constr.datalen > 0)
16052 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16054 first_hops_constr.data = NULL;
16055 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
16056 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
16057 int64_t arr_conv_16 = first_hops_vals[q];
16058 LDKChannelDetails arr_conv_16_conv;
16059 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
16060 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
16061 first_hops_constr.data[q] = arr_conv_16_conv;
16063 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
16064 LDKCVec_RouteHintZ last_hops_constr;
16065 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
16066 if (last_hops_constr.datalen > 0)
16067 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16069 last_hops_constr.data = NULL;
16070 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
16071 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
16072 int64_t arr_conv_11 = last_hops_vals[l];
16073 LDKRouteHint arr_conv_11_conv;
16074 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
16075 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
16076 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
16077 last_hops_constr.data[l] = arr_conv_11_conv;
16079 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
16080 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16081 if (logger_conv.free == LDKLogger_JCalls_free) {
16082 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16083 LDKLogger_JCalls_clone(logger_conv.this_arg);
16085 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16086 *ret_conv = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
16087 FREE(first_hops_constr.data);
16088 return (long)ret_conv;
16091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16092 LDKNetworkGraph this_ptr_conv;
16093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16095 NetworkGraph_free(this_ptr_conv);
16098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16099 LDKLockedNetworkGraph this_ptr_conv;
16100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16102 LockedNetworkGraph_free(this_ptr_conv);
16105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16106 LDKNetGraphMsgHandler this_ptr_conv;
16107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16109 NetGraphMsgHandler_free(this_ptr_conv);
16112 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) {
16113 LDKThirtyTwoBytes genesis_hash_ref;
16114 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
16115 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
16116 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16117 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16118 if (logger_conv.free == LDKLogger_JCalls_free) {
16119 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16120 LDKLogger_JCalls_clone(logger_conv.this_arg);
16122 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
16123 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16124 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16125 long ret_ref = (long)ret_var.inner;
16126 if (ret_var.is_owned) {
16132 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) {
16133 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16134 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16135 if (logger_conv.free == LDKLogger_JCalls_free) {
16136 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16137 LDKLogger_JCalls_clone(logger_conv.this_arg);
16139 LDKNetworkGraph network_graph_conv;
16140 network_graph_conv.inner = (void*)(network_graph & (~1));
16141 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
16142 // Warning: we need a move here but no clone is available for LDKNetworkGraph
16143 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
16144 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16145 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16146 long ret_ref = (long)ret_var.inner;
16147 if (ret_var.is_owned) {
16153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
16154 LDKNetGraphMsgHandler this_arg_conv;
16155 this_arg_conv.inner = (void*)(this_arg & (~1));
16156 this_arg_conv.is_owned = false;
16157 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
16158 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16159 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16160 long ret_ref = (long)ret_var.inner;
16161 if (ret_var.is_owned) {
16167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
16168 LDKLockedNetworkGraph this_arg_conv;
16169 this_arg_conv.inner = (void*)(this_arg & (~1));
16170 this_arg_conv.is_owned = false;
16171 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
16172 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16173 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16174 long ret_ref = (long)ret_var.inner;
16175 if (ret_var.is_owned) {
16181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16182 LDKNetGraphMsgHandler this_arg_conv;
16183 this_arg_conv.inner = (void*)(this_arg & (~1));
16184 this_arg_conv.is_owned = false;
16185 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16186 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
16190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16191 LDKNetGraphMsgHandler this_arg_conv;
16192 this_arg_conv.inner = (void*)(this_arg & (~1));
16193 this_arg_conv.is_owned = false;
16194 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16195 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
16199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16200 LDKDirectionalChannelInfo this_ptr_conv;
16201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16203 DirectionalChannelInfo_free(this_ptr_conv);
16206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16207 LDKDirectionalChannelInfo orig_conv;
16208 orig_conv.inner = (void*)(orig & (~1));
16209 orig_conv.is_owned = false;
16210 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
16211 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16212 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16213 long ret_ref = (long)ret_var.inner;
16214 if (ret_var.is_owned) {
16220 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
16221 LDKDirectionalChannelInfo this_ptr_conv;
16222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16223 this_ptr_conv.is_owned = false;
16224 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
16228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16229 LDKDirectionalChannelInfo this_ptr_conv;
16230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16231 this_ptr_conv.is_owned = false;
16232 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
16235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
16236 LDKDirectionalChannelInfo this_ptr_conv;
16237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16238 this_ptr_conv.is_owned = false;
16239 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
16243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16244 LDKDirectionalChannelInfo this_ptr_conv;
16245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16246 this_ptr_conv.is_owned = false;
16247 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
16250 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16251 LDKDirectionalChannelInfo this_ptr_conv;
16252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16253 this_ptr_conv.is_owned = false;
16254 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
16258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16259 LDKDirectionalChannelInfo this_ptr_conv;
16260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16261 this_ptr_conv.is_owned = false;
16262 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
16265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16266 LDKDirectionalChannelInfo this_ptr_conv;
16267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16268 this_ptr_conv.is_owned = false;
16269 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
16273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16274 LDKDirectionalChannelInfo this_ptr_conv;
16275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16276 this_ptr_conv.is_owned = false;
16277 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
16280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16281 LDKDirectionalChannelInfo this_ptr_conv;
16282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16283 this_ptr_conv.is_owned = false;
16284 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
16285 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16286 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16287 long ret_ref = (long)ret_var.inner;
16288 if (ret_var.is_owned) {
16294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16295 LDKDirectionalChannelInfo this_ptr_conv;
16296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16297 this_ptr_conv.is_owned = false;
16298 LDKRoutingFees val_conv;
16299 val_conv.inner = (void*)(val & (~1));
16300 val_conv.is_owned = (val & 1) || (val == 0);
16301 val_conv = RoutingFees_clone(&val_conv);
16302 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
16305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16306 LDKDirectionalChannelInfo this_ptr_conv;
16307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16308 this_ptr_conv.is_owned = false;
16309 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
16310 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16311 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16312 long ret_ref = (long)ret_var.inner;
16313 if (ret_var.is_owned) {
16319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16320 LDKDirectionalChannelInfo this_ptr_conv;
16321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16322 this_ptr_conv.is_owned = false;
16323 LDKChannelUpdate val_conv;
16324 val_conv.inner = (void*)(val & (~1));
16325 val_conv.is_owned = (val & 1) || (val == 0);
16326 val_conv = ChannelUpdate_clone(&val_conv);
16327 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
16330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16331 LDKDirectionalChannelInfo obj_conv;
16332 obj_conv.inner = (void*)(obj & (~1));
16333 obj_conv.is_owned = false;
16334 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
16335 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16336 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16337 CVec_u8Z_free(arg_var);
16341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16342 LDKu8slice ser_ref;
16343 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16344 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16345 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
16346 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16347 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16348 long ret_ref = (long)ret_var.inner;
16349 if (ret_var.is_owned) {
16352 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16357 LDKChannelInfo this_ptr_conv;
16358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16360 ChannelInfo_free(this_ptr_conv);
16363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16364 LDKChannelInfo this_ptr_conv;
16365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16366 this_ptr_conv.is_owned = false;
16367 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
16368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16370 long ret_ref = (long)ret_var.inner;
16371 if (ret_var.is_owned) {
16377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16378 LDKChannelInfo this_ptr_conv;
16379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16380 this_ptr_conv.is_owned = false;
16381 LDKChannelFeatures val_conv;
16382 val_conv.inner = (void*)(val & (~1));
16383 val_conv.is_owned = (val & 1) || (val == 0);
16384 // Warning: we need a move here but no clone is available for LDKChannelFeatures
16385 ChannelInfo_set_features(&this_ptr_conv, val_conv);
16388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
16389 LDKChannelInfo this_ptr_conv;
16390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16391 this_ptr_conv.is_owned = false;
16392 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16393 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
16397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16398 LDKChannelInfo this_ptr_conv;
16399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16400 this_ptr_conv.is_owned = false;
16401 LDKPublicKey val_ref;
16402 CHECK((*env)->GetArrayLength(env, val) == 33);
16403 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16404 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
16407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
16408 LDKChannelInfo this_ptr_conv;
16409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16410 this_ptr_conv.is_owned = false;
16411 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
16412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16414 long ret_ref = (long)ret_var.inner;
16415 if (ret_var.is_owned) {
16421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16422 LDKChannelInfo this_ptr_conv;
16423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16424 this_ptr_conv.is_owned = false;
16425 LDKDirectionalChannelInfo val_conv;
16426 val_conv.inner = (void*)(val & (~1));
16427 val_conv.is_owned = (val & 1) || (val == 0);
16428 val_conv = DirectionalChannelInfo_clone(&val_conv);
16429 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
16432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
16433 LDKChannelInfo this_ptr_conv;
16434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16435 this_ptr_conv.is_owned = false;
16436 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16437 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
16441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16442 LDKChannelInfo this_ptr_conv;
16443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16444 this_ptr_conv.is_owned = false;
16445 LDKPublicKey val_ref;
16446 CHECK((*env)->GetArrayLength(env, val) == 33);
16447 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16448 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
16451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
16452 LDKChannelInfo this_ptr_conv;
16453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16454 this_ptr_conv.is_owned = false;
16455 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
16456 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16457 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16458 long ret_ref = (long)ret_var.inner;
16459 if (ret_var.is_owned) {
16465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16466 LDKChannelInfo this_ptr_conv;
16467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16468 this_ptr_conv.is_owned = false;
16469 LDKDirectionalChannelInfo val_conv;
16470 val_conv.inner = (void*)(val & (~1));
16471 val_conv.is_owned = (val & 1) || (val == 0);
16472 val_conv = DirectionalChannelInfo_clone(&val_conv);
16473 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
16476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16477 LDKChannelInfo this_ptr_conv;
16478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16479 this_ptr_conv.is_owned = false;
16480 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
16481 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16482 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16483 long ret_ref = (long)ret_var.inner;
16484 if (ret_var.is_owned) {
16490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16491 LDKChannelInfo this_ptr_conv;
16492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16493 this_ptr_conv.is_owned = false;
16494 LDKChannelAnnouncement val_conv;
16495 val_conv.inner = (void*)(val & (~1));
16496 val_conv.is_owned = (val & 1) || (val == 0);
16497 val_conv = ChannelAnnouncement_clone(&val_conv);
16498 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
16501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16502 LDKChannelInfo obj_conv;
16503 obj_conv.inner = (void*)(obj & (~1));
16504 obj_conv.is_owned = false;
16505 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
16506 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16507 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16508 CVec_u8Z_free(arg_var);
16512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16513 LDKu8slice ser_ref;
16514 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16515 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16516 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
16517 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16518 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16519 long ret_ref = (long)ret_var.inner;
16520 if (ret_var.is_owned) {
16523 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16528 LDKRoutingFees this_ptr_conv;
16529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16531 RoutingFees_free(this_ptr_conv);
16534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16535 LDKRoutingFees orig_conv;
16536 orig_conv.inner = (void*)(orig & (~1));
16537 orig_conv.is_owned = false;
16538 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
16539 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16540 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16541 long ret_ref = (long)ret_var.inner;
16542 if (ret_var.is_owned) {
16548 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16549 LDKRoutingFees this_ptr_conv;
16550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16551 this_ptr_conv.is_owned = false;
16552 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
16556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16557 LDKRoutingFees this_ptr_conv;
16558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16559 this_ptr_conv.is_owned = false;
16560 RoutingFees_set_base_msat(&this_ptr_conv, val);
16563 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
16564 LDKRoutingFees this_ptr_conv;
16565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16566 this_ptr_conv.is_owned = false;
16567 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
16571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16572 LDKRoutingFees this_ptr_conv;
16573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16574 this_ptr_conv.is_owned = false;
16575 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
16578 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) {
16579 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
16580 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16581 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16582 long ret_ref = (long)ret_var.inner;
16583 if (ret_var.is_owned) {
16589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16590 LDKu8slice ser_ref;
16591 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16592 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16593 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16594 *ret_conv = RoutingFees_read(ser_ref);
16595 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16596 return (long)ret_conv;
16599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
16600 LDKRoutingFees obj_conv;
16601 obj_conv.inner = (void*)(obj & (~1));
16602 obj_conv.is_owned = false;
16603 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
16604 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16605 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16606 CVec_u8Z_free(arg_var);
16610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16611 LDKNodeAnnouncementInfo this_ptr_conv;
16612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16614 NodeAnnouncementInfo_free(this_ptr_conv);
16617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16618 LDKNodeAnnouncementInfo orig_conv;
16619 orig_conv.inner = (void*)(orig & (~1));
16620 orig_conv.is_owned = false;
16621 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
16622 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16623 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16624 long ret_ref = (long)ret_var.inner;
16625 if (ret_var.is_owned) {
16631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16632 LDKNodeAnnouncementInfo this_ptr_conv;
16633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16634 this_ptr_conv.is_owned = false;
16635 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
16636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16638 long ret_ref = (long)ret_var.inner;
16639 if (ret_var.is_owned) {
16645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16646 LDKNodeAnnouncementInfo this_ptr_conv;
16647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16648 this_ptr_conv.is_owned = false;
16649 LDKNodeFeatures val_conv;
16650 val_conv.inner = (void*)(val & (~1));
16651 val_conv.is_owned = (val & 1) || (val == 0);
16652 // Warning: we need a move here but no clone is available for LDKNodeFeatures
16653 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
16656 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
16657 LDKNodeAnnouncementInfo this_ptr_conv;
16658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16659 this_ptr_conv.is_owned = false;
16660 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
16664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16665 LDKNodeAnnouncementInfo this_ptr_conv;
16666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16667 this_ptr_conv.is_owned = false;
16668 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
16671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
16672 LDKNodeAnnouncementInfo this_ptr_conv;
16673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16674 this_ptr_conv.is_owned = false;
16675 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
16676 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
16680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16681 LDKNodeAnnouncementInfo this_ptr_conv;
16682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16683 this_ptr_conv.is_owned = false;
16684 LDKThreeBytes val_ref;
16685 CHECK((*env)->GetArrayLength(env, val) == 3);
16686 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
16687 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
16690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
16691 LDKNodeAnnouncementInfo this_ptr_conv;
16692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16693 this_ptr_conv.is_owned = false;
16694 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16695 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
16699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16700 LDKNodeAnnouncementInfo this_ptr_conv;
16701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16702 this_ptr_conv.is_owned = false;
16703 LDKThirtyTwoBytes val_ref;
16704 CHECK((*env)->GetArrayLength(env, val) == 32);
16705 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16706 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
16709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16710 LDKNodeAnnouncementInfo this_ptr_conv;
16711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16712 this_ptr_conv.is_owned = false;
16713 LDKCVec_NetAddressZ val_constr;
16714 val_constr.datalen = (*env)->GetArrayLength(env, val);
16715 if (val_constr.datalen > 0)
16716 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16718 val_constr.data = NULL;
16719 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16720 for (size_t m = 0; m < val_constr.datalen; m++) {
16721 int64_t arr_conv_12 = val_vals[m];
16722 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
16723 FREE((void*)arr_conv_12);
16724 val_constr.data[m] = arr_conv_12_conv;
16726 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16727 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
16730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16731 LDKNodeAnnouncementInfo this_ptr_conv;
16732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16733 this_ptr_conv.is_owned = false;
16734 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
16735 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16736 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16737 long ret_ref = (long)ret_var.inner;
16738 if (ret_var.is_owned) {
16744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16745 LDKNodeAnnouncementInfo this_ptr_conv;
16746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16747 this_ptr_conv.is_owned = false;
16748 LDKNodeAnnouncement val_conv;
16749 val_conv.inner = (void*)(val & (~1));
16750 val_conv.is_owned = (val & 1) || (val == 0);
16751 val_conv = NodeAnnouncement_clone(&val_conv);
16752 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
16755 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) {
16756 LDKNodeFeatures features_arg_conv;
16757 features_arg_conv.inner = (void*)(features_arg & (~1));
16758 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16759 // Warning: we need a move here but no clone is available for LDKNodeFeatures
16760 LDKThreeBytes rgb_arg_ref;
16761 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
16762 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
16763 LDKThirtyTwoBytes alias_arg_ref;
16764 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
16765 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
16766 LDKCVec_NetAddressZ addresses_arg_constr;
16767 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
16768 if (addresses_arg_constr.datalen > 0)
16769 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16771 addresses_arg_constr.data = NULL;
16772 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
16773 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
16774 int64_t arr_conv_12 = addresses_arg_vals[m];
16775 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
16776 FREE((void*)arr_conv_12);
16777 addresses_arg_constr.data[m] = arr_conv_12_conv;
16779 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
16780 LDKNodeAnnouncement announcement_message_arg_conv;
16781 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
16782 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
16783 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
16784 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
16785 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16786 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16787 long ret_ref = (long)ret_var.inner;
16788 if (ret_var.is_owned) {
16794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16795 LDKNodeAnnouncementInfo obj_conv;
16796 obj_conv.inner = (void*)(obj & (~1));
16797 obj_conv.is_owned = false;
16798 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
16799 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16800 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16801 CVec_u8Z_free(arg_var);
16805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16806 LDKu8slice ser_ref;
16807 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16808 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16809 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16810 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
16811 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16812 return (long)ret_conv;
16815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16816 LDKNodeInfo this_ptr_conv;
16817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16819 NodeInfo_free(this_ptr_conv);
16822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16823 LDKNodeInfo orig_conv;
16824 orig_conv.inner = (void*)(orig & (~1));
16825 orig_conv.is_owned = false;
16826 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
16827 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16828 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16829 long ret_ref = (long)ret_var.inner;
16830 if (ret_var.is_owned) {
16836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16837 LDKNodeInfo this_ptr_conv;
16838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16839 this_ptr_conv.is_owned = false;
16840 LDKCVec_u64Z val_constr;
16841 val_constr.datalen = (*env)->GetArrayLength(env, val);
16842 if (val_constr.datalen > 0)
16843 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16845 val_constr.data = NULL;
16846 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16847 for (size_t g = 0; g < val_constr.datalen; g++) {
16848 int64_t arr_conv_6 = val_vals[g];
16849 val_constr.data[g] = arr_conv_6;
16851 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16852 NodeInfo_set_channels(&this_ptr_conv, val_constr);
16855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16856 LDKNodeInfo this_ptr_conv;
16857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16858 this_ptr_conv.is_owned = false;
16859 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
16860 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16861 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16862 long ret_ref = (long)ret_var.inner;
16863 if (ret_var.is_owned) {
16869 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) {
16870 LDKNodeInfo this_ptr_conv;
16871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16872 this_ptr_conv.is_owned = false;
16873 LDKRoutingFees val_conv;
16874 val_conv.inner = (void*)(val & (~1));
16875 val_conv.is_owned = (val & 1) || (val == 0);
16876 val_conv = RoutingFees_clone(&val_conv);
16877 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
16880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
16881 LDKNodeInfo this_ptr_conv;
16882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16883 this_ptr_conv.is_owned = false;
16884 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
16885 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16886 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16887 long ret_ref = (long)ret_var.inner;
16888 if (ret_var.is_owned) {
16894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16895 LDKNodeInfo this_ptr_conv;
16896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16897 this_ptr_conv.is_owned = false;
16898 LDKNodeAnnouncementInfo val_conv;
16899 val_conv.inner = (void*)(val & (~1));
16900 val_conv.is_owned = (val & 1) || (val == 0);
16901 val_conv = NodeAnnouncementInfo_clone(&val_conv);
16902 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
16905 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) {
16906 LDKCVec_u64Z channels_arg_constr;
16907 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
16908 if (channels_arg_constr.datalen > 0)
16909 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16911 channels_arg_constr.data = NULL;
16912 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
16913 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
16914 int64_t arr_conv_6 = channels_arg_vals[g];
16915 channels_arg_constr.data[g] = arr_conv_6;
16917 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
16918 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
16919 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
16920 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
16921 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
16922 LDKNodeAnnouncementInfo announcement_info_arg_conv;
16923 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
16924 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
16925 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
16926 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
16927 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16928 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16929 long ret_ref = (long)ret_var.inner;
16930 if (ret_var.is_owned) {
16936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16937 LDKNodeInfo obj_conv;
16938 obj_conv.inner = (void*)(obj & (~1));
16939 obj_conv.is_owned = false;
16940 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
16941 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16942 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16943 CVec_u8Z_free(arg_var);
16947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16948 LDKu8slice ser_ref;
16949 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16950 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16951 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16952 *ret_conv = NodeInfo_read(ser_ref);
16953 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16954 return (long)ret_conv;
16957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
16958 LDKNetworkGraph obj_conv;
16959 obj_conv.inner = (void*)(obj & (~1));
16960 obj_conv.is_owned = false;
16961 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
16962 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16963 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16964 CVec_u8Z_free(arg_var);
16968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16969 LDKu8slice ser_ref;
16970 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16971 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16972 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16973 *ret_conv = NetworkGraph_read(ser_ref);
16974 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16975 return (long)ret_conv;
16978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
16979 LDKThirtyTwoBytes genesis_hash_ref;
16980 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
16981 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
16982 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
16983 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16984 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16985 long ret_ref = (long)ret_var.inner;
16986 if (ret_var.is_owned) {
16992 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) {
16993 LDKNetworkGraph this_arg_conv;
16994 this_arg_conv.inner = (void*)(this_arg & (~1));
16995 this_arg_conv.is_owned = false;
16996 LDKNodeAnnouncement msg_conv;
16997 msg_conv.inner = (void*)(msg & (~1));
16998 msg_conv.is_owned = false;
16999 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17000 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
17001 return (long)ret_conv;
17004 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) {
17005 LDKNetworkGraph this_arg_conv;
17006 this_arg_conv.inner = (void*)(this_arg & (~1));
17007 this_arg_conv.is_owned = false;
17008 LDKUnsignedNodeAnnouncement msg_conv;
17009 msg_conv.inner = (void*)(msg & (~1));
17010 msg_conv.is_owned = false;
17011 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17012 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
17013 return (long)ret_conv;
17016 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) {
17017 LDKNetworkGraph this_arg_conv;
17018 this_arg_conv.inner = (void*)(this_arg & (~1));
17019 this_arg_conv.is_owned = false;
17020 LDKChannelAnnouncement msg_conv;
17021 msg_conv.inner = (void*)(msg & (~1));
17022 msg_conv.is_owned = false;
17023 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17024 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17025 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17026 return (long)ret_conv;
17029 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) {
17030 LDKNetworkGraph this_arg_conv;
17031 this_arg_conv.inner = (void*)(this_arg & (~1));
17032 this_arg_conv.is_owned = false;
17033 LDKUnsignedChannelAnnouncement msg_conv;
17034 msg_conv.inner = (void*)(msg & (~1));
17035 msg_conv.is_owned = false;
17036 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17037 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17038 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17039 return (long)ret_conv;
17042 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) {
17043 LDKNetworkGraph this_arg_conv;
17044 this_arg_conv.inner = (void*)(this_arg & (~1));
17045 this_arg_conv.is_owned = false;
17046 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
17049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17050 LDKNetworkGraph this_arg_conv;
17051 this_arg_conv.inner = (void*)(this_arg & (~1));
17052 this_arg_conv.is_owned = false;
17053 LDKChannelUpdate msg_conv;
17054 msg_conv.inner = (void*)(msg & (~1));
17055 msg_conv.is_owned = false;
17056 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17057 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
17058 return (long)ret_conv;
17061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17062 LDKNetworkGraph this_arg_conv;
17063 this_arg_conv.inner = (void*)(this_arg & (~1));
17064 this_arg_conv.is_owned = false;
17065 LDKUnsignedChannelUpdate msg_conv;
17066 msg_conv.inner = (void*)(msg & (~1));
17067 msg_conv.is_owned = false;
17068 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17069 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
17070 return (long)ret_conv;